Commit b1ecc18f authored by Jérome Perrin's avatar Jérome Perrin

new target to deploy by webdav

parent f1a38833
......@@ -9,5 +9,10 @@ npm install
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:
```
npm run deploy -- --url=http://10.0.0.1:2204/erp5/portal_skins/erp5_monaco_editor/monaco-editor/ --username=user --password=password
```
and upload the content of `dist` folder in `portal_skins/erp5_monaco_editor/XXX`
const webpack = require("webpack");
const config = require("./webpack.config");
const http = require("https");
const ArgumentParser = require("argparse").ArgumentParser;
const parser = new ArgumentParser({
version: "0.0.1",
addHelp: true,
description: "Deploy webpack on webdav"
});
parser.addArgument(["-U", "--url"], {
help: "WebDAV Server URL.",
required: true
});
parser.addArgument(["-k", "--insecure"], {
help: "Ignore SSL certificate validation.",
action: "storeTrue"
});
parser.addArgument(["-u", "--username"], {
help: "Username to authenticate on webdav server."
});
parser.addArgument(["-p", "--password"], {
help: "Password to authenticate on webdav server."
});
parser.addArgument(["-w", "--watch"], {
help: "Watch files for changs and rebuild incrementally.",
action: "storeTrue"
});
const args = parser.parseArgs();
// see https://webpack.js.org/api/node/ for reference
const compiler = webpack(config);
compiler.outputFileSystem = require("webdav-fs")(
args.url,
args.username,
args.password,
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();
};
// XXX we just put everyting in current folder
compiler.outputFileSystem.join = function join(base, relative) {
return relative;
};
const compilerCallback = (err, stats) => {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
const info = stats.toJson();
if (stats.hasErrors()) {
console.error(info.errors);
}
if (stats.hasWarnings()) {
console.warn(info.warnings);
}
console.log(
stats.toString({
colors: true
})
);
};
if (args.watch) {
console.log("Watching files for changes");
compiler.watch({}, compilerCallback);
} else {
compiler.run(compilerCallback);
}
......@@ -257,6 +257,15 @@
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
"dev": true
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
},
"arr-diff": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
......@@ -2666,6 +2675,12 @@
"readable-stream": "^2.0.1"
}
},
"merge": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz",
"integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==",
"dev": true
},
"micromatch": {
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
......@@ -2842,6 +2857,12 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"node-fetch": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.2.1.tgz",
"integrity": "sha512-ObXBpNCD3A/vYQiQtEWl7DuqjAXjfptYFuGHLdPl5U19/6kJuZV+8uMHLrkj3wJrJoyfg4nhgyFixZdaZoAiEQ==",
"dev": true
},
"node-libs-browser": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.0.tgz",
......@@ -3093,6 +3114,12 @@
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
},
"path-posix": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/path-posix/-/path-posix-1.0.0.tgz",
"integrity": "sha1-BrJhE/Vr6rBCVFojv6iAA8ysJg8=",
"dev": true
},
"pbkdf2": {
"version": "3.0.17",
"resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
......@@ -3294,6 +3321,12 @@
"integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=",
"dev": true
},
"querystringify": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz",
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==",
"dev": true
},
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
......@@ -3379,6 +3412,12 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"resolve-cwd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
......@@ -3459,6 +3498,12 @@
"ret": "~0.1.10"
}
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true
},
"schema-utils": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz",
......@@ -3694,6 +3739,12 @@
"extend-shallow": "^3.0.0"
}
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"ssri": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz",
......@@ -4433,6 +4484,22 @@
}
}
},
"url-join": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.0.tgz",
"integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=",
"dev": true
},
"url-parse": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
"dev": true,
"requires": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
}
},
"use": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
......@@ -4480,6 +4547,29 @@
"neo-async": "^2.5.0"
}
},
"webdav": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/webdav/-/webdav-1.6.1.tgz",
"integrity": "sha512-01X5wEfFDt4P1+wYSSUBCADzAGIcBn3zG5ofjRAXbwVgosWTidwsrik9QwjY8pHJfKZWuchV35gdWf5/aEMf8Q==",
"dev": true,
"requires": {
"merge": "~1.2.0",
"node-fetch": "~2.2.0",
"path-posix": "~1.0.0",
"url-join": "~4.0.0",
"url-parse": "~1.4.3",
"xml2js": "~0.4.17"
}
},
"webdav-fs": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/webdav-fs/-/webdav-fs-1.12.0.tgz",
"integrity": "sha512-g6q2kGzakaVYJC7j/lIvPPNrPqQal1gPdQxmDM1UCNBTrEQsd8DrYxuWC44c96p4E/8MlaiiSJUEk8wZWU8CXg==",
"dev": true,
"requires": {
"webdav": "^1.6.1"
}
},
"webpack": {
"version": "4.32.2",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-4.32.2.tgz",
......@@ -4689,6 +4779,22 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"dev": true,
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=",
"dev": true
},
"xtend": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
......
{
"name": "monaco-editor-erp5",
"scripts": {
"build": "webpack --config webpack.config.js"
"build": "webpack --config webpack.config.js",
"deploy": "node deploy.js"
},
"dependencies": {},
"devDependencies": {
"argparse": "^1.0.10",
"css-loader": "^2.1.1",
"monaco-editor": "^0.17.0",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.5",
"webdav-fs": "^1.12.0",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
}
......
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