Skip to content

Commit 9d42d13

Browse files
committed
First Commit
0 parents  commit 9d42d13

16 files changed

+6187
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"git.ignoreLimitWarning": true
3+
}

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Monaco Editor Test
2+
3+
This is a simple project to test Monaco Editor
4+

config/paths.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
// Source files
5+
src: path.resolve(__dirname, '../src'),
6+
7+
// Production build files
8+
build: path.resolve(__dirname, '../dist'),
9+
10+
// Static files that get copied to build folder
11+
public: path.resolve(__dirname, '../public'),
12+
}

config/webpack.base.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const paths = require('./paths')
2+
3+
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
4+
const CopyWebpackPlugin = require('copy-webpack-plugin')
5+
const HtmlWebpackPlugin = require('html-webpack-plugin')
6+
7+
module.exports = {
8+
// Where webpack looks to start building the bundle
9+
entry: [paths.src + '/app.ts'],
10+
11+
// Where webpack outputs the assets and bundles
12+
output: {
13+
path: paths.build,
14+
filename: '[name].bundle.js',
15+
publicPath: '/',
16+
},
17+
18+
// Customize the webpack build process
19+
plugins: [
20+
// Removes/cleans build folders and unused assets when rebuilding
21+
new CleanWebpackPlugin(),
22+
23+
// Copies files from target to destination folder
24+
new CopyWebpackPlugin({
25+
patterns: [
26+
{
27+
from: paths.public,
28+
to: 'assets',
29+
globOptions: {
30+
dot: true
31+
},
32+
},
33+
],
34+
}),
35+
36+
// Generates an HTML file from a template
37+
// Generates deprecation warning: https://github.com/jantimon/html-webpack-plugin/issues/1501
38+
new HtmlWebpackPlugin({
39+
favicon: paths.src + '/images/favicon.png',
40+
template: paths.src + '/index.html',
41+
filename: 'index.html'
42+
}),
43+
],
44+
45+
module: {
46+
rules: [
47+
{
48+
test: /\.(scss|css)$/,
49+
use: [
50+
'style-loader',
51+
{loader: 'css-loader', options: {sourceMap: true, importLoaders: 1}},
52+
{loader: 'sass-loader', options: {sourceMap: true}},
53+
],
54+
},
55+
56+
{test: /\.(?:ico|gif|png|jpg|jpeg)$/i, type: 'asset/resource'},
57+
58+
{test: /\.(woff(2)?|eot|ttf|otf|svg|)$/, type: 'asset/inline'},
59+
],
60+
},
61+
}

config/webpack.dev.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const paths = require('./paths')
2+
3+
const webpack = require('webpack')
4+
const { merge } = require('webpack-merge')
5+
const base = require('./webpack.base.js')
6+
7+
module.exports = merge(base, {
8+
mode: 'development',
9+
10+
devtool: 'source-map',
11+
12+
devServer: {
13+
historyApiFallback: true,
14+
contentBase: paths.build,
15+
open: true,
16+
compress: true,
17+
hot: true,
18+
port: 4200,
19+
},
20+
21+
plugins: [
22+
new webpack.HotModuleReplacementPlugin(),
23+
],
24+
})

config/webpack.prod.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const paths = require('./paths')
2+
const { merge } = require('webpack-merge')
3+
const base = require('./webpack.base.js')
4+
5+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
6+
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
7+
8+
module.exports = merge(base, {
9+
mode: 'production',
10+
devtool: false,
11+
output: {
12+
path: paths.build,
13+
publicPath: '/',
14+
filename: 'js/[name].[contenthash].bundle.js',
15+
},
16+
plugins: [
17+
// Extracts CSS into separate files
18+
// Note: style-loader is for development, MiniCssExtractPlugin is for production
19+
new MiniCssExtractPlugin({
20+
filename: 'styles/[name].[contenthash].css',
21+
chunkFilename: '[id].css',
22+
}),
23+
],
24+
module: {
25+
rules: [
26+
{
27+
test: /\.(scss|css)$/,
28+
use: [
29+
MiniCssExtractPlugin.loader,
30+
{
31+
loader: 'css-loader',
32+
options: {
33+
importLoaders: 2,
34+
sourceMap: false,
35+
},
36+
},
37+
'sass-loader'
38+
],
39+
},
40+
],
41+
},
42+
optimization: {
43+
minimize: true,
44+
minimizer: [new CssMinimizerPlugin(), "..."],
45+
// Once your build outputs multiple chunks, this option will ensure they share the webpack runtime
46+
// instead of having their own. This also helps with long-term caching, since the chunks will only
47+
// change when actual code changes, not the webpack runtime.
48+
runtimeChunk: {
49+
name: 'runtime',
50+
},
51+
},
52+
performance: {
53+
hints: false,
54+
maxEntrypointSize: 512000,
55+
maxAssetSize: 512000,
56+
},
57+
})

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "monaco-test",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"dependencies": {
7+
"monaco-editor": "^0.21.2"
8+
},
9+
"scripts": {
10+
"build": "NODE_ENV=production webpack --config config/webpack.prod.js",
11+
"start": "NODE_ENV=development webpack serve --config config/webpack.dev.js"
12+
},
13+
"devDependencies": {
14+
"clean-webpack-plugin": "^3.0.0",
15+
"copy-webpack-plugin": "^6.3.0",
16+
"css-loader": "^5.0.1",
17+
"css-minimizer-webpack-plugin": "^1.1.5",
18+
"html-webpack-plugin": "^4.5.0",
19+
"mini-css-extract-plugin": "^1.3.0",
20+
"npm-run-all": "^4.1.5",
21+
"sass-loader": "^10.0.5",
22+
"style-loader": "^2.0.0",
23+
"ts-loader": "^8.0.11",
24+
"webpack": "^5.4.0",
25+
"webpack-cli": "^4.2.0",
26+
"webpack-dev-server": "^3.11.0",
27+
"webpack-merge": "^5.3.0"
28+
}
29+
}

public/.gitkeep

Whitespace-only changes.

public/favicon.ico

179 KB
Binary file not shown.

src/app.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello World');

src/images/favicon.png

19.7 KB
Loading

src/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Monaco Test</title>
7+
</head>
8+
<body>
9+
<div class="root"></div>
10+
</body>
11+
</html>

src/styles/app.scss

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
html {
2+
font-size: 12;
3+
}

tsconfig.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"compilerOptions": {
3+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
4+
5+
/* Basic Options */
6+
// "incremental": true, /* Enable incremental compilation */
7+
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9+
// "lib": [], /* Specify library files to be included in the compilation. */
10+
// "allowJs": true, /* Allow javascript files to be compiled. */
11+
// "checkJs": true, /* Report errors in .js files. */
12+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
14+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15+
// "sourceMap": true, /* Generates corresponding '.map' file. */
16+
// "outFile": "./", /* Concatenate and emit output to single file. */
17+
"outDir": "./dist", /* Redirect output structure to the directory. */
18+
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19+
// "composite": true, /* Enable project compilation */
20+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21+
// "removeComments": true, /* Do not emit comments to output. */
22+
// "noEmit": true, /* Do not emit outputs. */
23+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
24+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26+
27+
/* Strict Type-Checking Options */
28+
"strict": true, /* Enable all strict type-checking options. */
29+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30+
// "strictNullChecks": true, /* Enable strict null checks. */
31+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
32+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36+
37+
/* Additional Checks */
38+
// "noUnusedLocals": true, /* Report errors on unused locals. */
39+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
40+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42+
43+
/* Module Resolution Options */
44+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48+
// "typeRoots": [], /* List of folders to include type definitions from. */
49+
// "types": [], /* Type declaration files to be included in compilation. */
50+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54+
55+
/* Source Map Options */
56+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60+
61+
/* Experimental Options */
62+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64+
65+
/* Advanced Options */
66+
"skipLibCheck": true, /* Skip type checking of declaration files. */
67+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68+
}
69+
}

0 commit comments

Comments
 (0)