Commit 65d09eb4 authored by Jérome Perrin's avatar Jérome Perrin

version up ( monaco 0.24.0 )

parent f59a79d1
This is the code used to build javascript & css required for `erp5_monaco_editor` This is the code used to build javascript & css required for `erp5_monaco_editor`
This code is based on https://github.com/Microsoft/monaco-editor-samples/tree/922865708b78b0307fd18296f64bf2140861c8dd/browser-esm-webpack This code is based on https://github.com/Microsoft/monaco-editor-samples/tree/a96ba973c1f0ac35e2a8f0b716aaee499172632a/browser-esm-webpack
To build, after cloning this repository: To build, after cloning this repository:
...@@ -11,7 +11,7 @@ npm run build ...@@ -11,7 +11,7 @@ npm run build
and upload the content of `dist` folder in `portal_skins/erp5_monaco_editor/monaco-editor/` and upload the content of `dist` folder in `portal_skins/erp5_monaco_editor/monaco-editor/`
Alternatively, you can use the webdav deploy script: Alternatively, you can use the webdav deploy script (be sure to set `zserver-threads` to 1):
``` ```
npm run deploy -- --url=http://10.0.0.1:2204/erp5/portal_skins/erp5_monaco_editor/monaco-editor/ --username=user --password=password npm run deploy -- --url=http://10.0.0.1:2204/erp5/portal_skins/erp5_monaco_editor/monaco-editor/ --username=user --password=password
``` ```
......
...@@ -30,25 +30,29 @@ parser.addArgument(["-w", "--watch"], { ...@@ -30,25 +30,29 @@ parser.addArgument(["-w", "--watch"], {
const args = parser.parseArgs(); const args = parser.parseArgs();
// see https://webpack.js.org/api/node/ for reference // see https://webpack.js.org/api/node/#custom-file-systems for reference
const compiler = webpack(config); const compiler = webpack(config);
compiler.outputFileSystem = require("webdav-fs")( compiler.outputFileSystem = require("webdav-fs")(
args.url, args.url,
args.username, {
args.password, username: args.username,
args.insecure password: args.password,
httpsAgent: args.insecure
? new http.Agent({ ? new http.Agent({
rejectUnauthorized: false, rejectUnauthorized: false,
checkServerIdentity: () => undefined checkServerIdentity: () => undefined
}) })
: undefined : undefined
); });
// XXX We don't need to mkdir because the webdav client URL already points to the // XXX We don't need to mkdir because the webdav client URL already points to the
// expected folder // expected folder
compiler.outputFileSystem.mkdirp = function mkdirp(path, callback) { compiler.outputFileSystem.mkdirp = function mkdirp(path, callback) {
return callback(); return callback();
}; };
compiler.outputFileSystem.mkdir = function mkdir(path, callback) {
return callback();
};
// XXX we just put everyting in current folder // XXX we just put everyting in current folder
compiler.outputFileSystem.join = function join(base, relative) { compiler.outputFileSystem.join = function join(base, relative) {
return relative; return relative;
......
...@@ -7,10 +7,10 @@ self.MonacoEnvironment = { ...@@ -7,10 +7,10 @@ self.MonacoEnvironment = {
if (label === 'json') { if (label === 'json') {
return window.monacoEditorWebPackResourceBaseUrl + './json.worker.bundle.min.js'; return window.monacoEditorWebPackResourceBaseUrl + './json.worker.bundle.min.js';
} }
if (label === 'css') { if (label === 'css' || label === 'scss' || label === 'less') {
return window.monacoEditorWebPackResourceBaseUrl + './css.worker.bundle.min.js'; return window.monacoEditorWebPackResourceBaseUrl + './css.worker.bundle.min.js';
} }
if (label === 'html') { if (label === 'html' || label === 'handlebars' || label === 'razor') {
return window.monacoEditorWebPackResourceBaseUrl + './html.worker.bundle.min.js'; return window.monacoEditorWebPackResourceBaseUrl + './html.worker.bundle.min.js';
} }
if (label === 'typescript' || label === 'javascript') { if (label === 'typescript' || label === 'javascript') {
...@@ -19,3 +19,5 @@ self.MonacoEnvironment = { ...@@ -19,3 +19,5 @@ self.MonacoEnvironment = {
return window.monacoEditorWebPackResourceBaseUrl + './editor.worker.bundle.min.js'; return window.monacoEditorWebPackResourceBaseUrl + './editor.worker.bundle.min.js';
} }
} }
self.monaco = monaco;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,16 +4,15 @@ ...@@ -4,16 +4,15 @@
"build": "webpack --config webpack.config.js", "build": "webpack --config webpack.config.js",
"deploy": "node deploy.js" "deploy": "node deploy.js"
}, },
"dependencies": {},
"devDependencies": { "devDependencies": {
"argparse": "^1.0.10", "argparse": "^1.0.10",
"css-loader": "^3.4.0", "css-loader": "^5.2.4",
"file-loader": "^5.0.2", "file-loader": "^6.2.0",
"monaco-editor": "^0.20.0", "monaco-editor": "^0.24.0",
"style-loader": "^1.1.1", "style-loader": "^2.0.0",
"uglifyjs-webpack-plugin": "^1.2.5", "terser-webpack-plugin": "^5.1.1",
"webdav-fs": "^1.12.0", "webdav-fs": "^3.0.0",
"webpack": "^4.41.4", "webpack": "^5.24.4",
"webpack-cli": "^3.3.10" "webpack-cli": "^4.5.0"
} }
} }
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const TerserPlugin = require("terser-webpack-plugin");
module.exports = { module.exports = {
mode: 'production', mode: 'production',
...@@ -25,9 +26,9 @@ module.exports = { ...@@ -25,9 +26,9 @@ module.exports = {
test: /\.ttf$/, test: /\.ttf$/,
use: ['file-loader'] use: ['file-loader']
}] }]
}, },
plugins: [ optimization: {
new UglifyJSPlugin(), minimize: true,
], minimizer: [new TerserPlugin()],
},
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment