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 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:
......@@ -11,7 +11,7 @@ npm run build
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
```
......
......@@ -30,25 +30,29 @@ parser.addArgument(["-w", "--watch"], {
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);
compiler.outputFileSystem = require("webdav-fs")(
args.url,
args.username,
args.password,
args.insecure
{
username: args.username,
password: args.password,
httpsAgent: args.insecure
? new http.Agent({
rejectUnauthorized: false,
checkServerIdentity: () => undefined
})
: undefined
);
});
// XXX We don't need to mkdir because the webdav client URL already points to the
// expected folder
compiler.outputFileSystem.mkdirp = function mkdirp(path, callback) {
return callback();
};
compiler.outputFileSystem.mkdir = function mkdir(path, callback) {
return callback();
};
// XXX we just put everyting in current folder
compiler.outputFileSystem.join = function join(base, relative) {
return relative;
......
......@@ -7,10 +7,10 @@ self.MonacoEnvironment = {
if (label === 'json') {
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';
}
if (label === 'html') {
if (label === 'html' || label === 'handlebars' || label === 'razor') {
return window.monacoEditorWebPackResourceBaseUrl + './html.worker.bundle.min.js';
}
if (label === 'typescript' || label === 'javascript') {
......@@ -19,3 +19,5 @@ self.MonacoEnvironment = {
return window.monacoEditorWebPackResourceBaseUrl + './editor.worker.bundle.min.js';
}
}
self.monaco = monaco;
This diff is collapsed.
......@@ -4,16 +4,15 @@
"build": "webpack --config webpack.config.js",
"deploy": "node deploy.js"
},
"dependencies": {},
"devDependencies": {
"argparse": "^1.0.10",
"css-loader": "^3.4.0",
"file-loader": "^5.0.2",
"monaco-editor": "^0.20.0",
"style-loader": "^1.1.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"webdav-fs": "^1.12.0",
"webpack": "^4.41.4",
"webpack-cli": "^3.3.10"
"css-loader": "^5.2.4",
"file-loader": "^6.2.0",
"monaco-editor": "^0.24.0",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.1.1",
"webdav-fs": "^3.0.0",
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0"
}
}
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: 'production',
......@@ -25,9 +26,9 @@ module.exports = {
test: /\.ttf$/,
use: ['file-loader']
}]
},
plugins: [
new UglifyJSPlugin(),
],
optimization: {
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