Skip to content

Commit

Permalink
Move Monaco Build -> monaco-editor-es
Browse files Browse the repository at this point in the history
  • Loading branch information
evanplaice committed Jul 1, 2020
1 parent 84bfc40 commit 9d7eb10
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 85 deletions.
37 changes: 0 additions & 37 deletions .config/monaco.config.js

This file was deleted.

28 changes: 14 additions & 14 deletions index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion monaco/css.worker.js

This file was deleted.

2 changes: 1 addition & 1 deletion monaco/editor.main.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion monaco/editor.worker.js

This file was deleted.

1 change: 0 additions & 1 deletion monaco/html.worker.js

This file was deleted.

1 change: 0 additions & 1 deletion monaco/json.worker.js

This file was deleted.

1 change: 1 addition & 0 deletions monaco/workers/css.worker.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions monaco/workers/editor.worker.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions monaco/workers/html.worker.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions monaco/workers/json.worker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion monaco/ts.worker.js → monaco/workers/ts.worker.js

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,27 @@
"scripts": {
"start": "npx live-server --no-browser --port=5500 --open=dev",
"lint": "esmtk lint",
"build": "npm run build:main && npm run build:min",
"build": "npm run build:main && npm run build:min && npm run copy",
"build:main": "npx rollup --config .config/main.config.js",
"build:min": "npx rollup --config .config/min.config.js",
"build:monaco": "webpack --config .config/monaco.config.js",
"copy": "npm run cp:editor && npm run cp:font && npm run cp:workers",
"cp:editor": "cp node_modules/monaco-editor-es/editor.main.js monaco/",
"cp:font": "cp node_modules/monaco-editor-es/*.ttf monaco/",
"cp:workers": "cp -r node_modules/monaco-editor-es/workers/* monaco/workers/",
"package": "npx rimraf package && npm pack | tail -n 1 | xargs tar -xf",
"preversion": "npm run lint",
"postversion": "git push --follow-tags"
},
"devDependencies": {
"css": "^2.2.4",
"css-loader": "^3.5.3",
"esmtk": "^0.1.1",
"file-loader": "^6.0.0",
"monaco-editor": "^0.20.0",
"rollup-plugin-terser": "^5.2.0",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
"monaco-editor-es": "^0.20.0",
"rollup-plugin-terser": "^5.2.0"
},
"standard": {
"ignore": [
"demo/*",
"dev/*",
"monaco/*",
"src/monaco/*",
"**/monaco/*",
"index.js"
]
}
Expand Down
28 changes: 14 additions & 14 deletions src/wc-monaco-editor.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/* eslint no-undef: 0 */
import '../monaco/editor.main.js'
import './monaco/editor.main.js'

const monacoDir = new URL('monaco/', import.meta.url)
const workersDir = new URL('monaco/workers/', import.meta.url)

// eslint-disable-next-line
self.MonacoEnvironment = {
getWorkerUrl: function (moduleId, label) {
if (label === 'json') {
return `${monacoDir}json.worker.js`
switch (label) {
case 'json':
return `${workersDir}json.worker.js`
case 'css':
return `${workersDir}css.worker.js`
case 'html':
return `${workersDir}html.worker.js`
case 'typescript':
case 'javascript':
return `${workersDir}ts.worker.js`
default:
return `${workersDir}editor.worker.js`
}
if (label === 'css') {
return `${monacoDir}css.worker.js`
}
if (label === 'html') {
return `${monacoDir}html.worker.js`
}
if (label === 'typescript' || label === 'javascript') {
return `${monacoDir}ts.worker.js`
}
return `${monacoDir}editor.worker.js`
}
}

Expand Down

0 comments on commit 9d7eb10

Please sign in to comment.