|
@@ -14,6 +14,17 @@ const path = require("path");
|
|
* @license Apache-2.0
|
|
* @license Apache-2.0
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+const chainCommands = function(cmds) {
|
|
|
|
+ const win = process.platform === "win32";
|
|
|
|
+ if (!win) {
|
|
|
|
+ return cmds.join(";");
|
|
|
|
+ }
|
|
|
|
+ return cmds
|
|
|
|
+ // Chain Command is different here
|
|
|
|
+ .join("&&")
|
|
|
|
+ // Windows does not support \n properly
|
|
|
|
+ .replace("\n", "\\n");
|
|
|
|
+};
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
module.exports = function (grunt) {
|
|
grunt.file.defaultEncoding = "utf8";
|
|
grunt.file.defaultEncoding = "utf8";
|
|
@@ -316,10 +327,10 @@ module.exports = function (grunt) {
|
|
},
|
|
},
|
|
exec: {
|
|
exec: {
|
|
repoSize: {
|
|
repoSize: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
"git ls-files | wc -l | xargs printf '\n%b\ttracked files\n'",
|
|
"git ls-files | wc -l | xargs printf '\n%b\ttracked files\n'",
|
|
"du -hs | egrep -o '^[^\t]*' | xargs printf '%b\trepository size\n'"
|
|
"du -hs | egrep -o '^[^\t]*' | xargs printf '%b\trepository size\n'"
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
stderr: false
|
|
stderr: false
|
|
},
|
|
},
|
|
cleanGit: {
|
|
cleanGit: {
|
|
@@ -329,20 +340,20 @@ module.exports = function (grunt) {
|
|
command: "node --experimental-modules --no-warnings --no-deprecation src/web/static/sitemap.mjs > build/prod/sitemap.xml"
|
|
command: "node --experimental-modules --no-warnings --no-deprecation src/web/static/sitemap.mjs > build/prod/sitemap.xml"
|
|
},
|
|
},
|
|
generateConfig: {
|
|
generateConfig: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
"echo '\n--- Regenerating config files. ---'",
|
|
"echo '\n--- Regenerating config files. ---'",
|
|
"echo [] > src/core/config/OperationConfig.json",
|
|
"echo [] > src/core/config/OperationConfig.json",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateOpsIndex.mjs",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateOpsIndex.mjs",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateConfig.mjs",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateConfig.mjs",
|
|
"echo '--- Config scripts finished. ---\n'"
|
|
"echo '--- Config scripts finished. ---\n'"
|
|
- ].join(";")
|
|
|
|
|
|
+ ])
|
|
},
|
|
},
|
|
generateNodeIndex: {
|
|
generateNodeIndex: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
"echo '\n--- Regenerating node index ---'",
|
|
"echo '\n--- Regenerating node index ---'",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/node/config/scripts/generateNodeIndex.mjs",
|
|
"node --experimental-modules --no-warnings --no-deprecation src/node/config/scripts/generateNodeIndex.mjs",
|
|
"echo '--- Node index generated. ---\n'"
|
|
"echo '--- Node index generated. ---\n'"
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
},
|
|
},
|
|
opTests: {
|
|
opTests: {
|
|
command: "node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs"
|
|
command: "node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs"
|
|
@@ -354,40 +365,40 @@ module.exports = function (grunt) {
|
|
command: "node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs"
|
|
command: "node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs"
|
|
},
|
|
},
|
|
setupNodeConsumers: {
|
|
setupNodeConsumers: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
"echo '\n--- Testing node conumers ---'",
|
|
"echo '\n--- Testing node conumers ---'",
|
|
"npm link",
|
|
"npm link",
|
|
`mkdir ${nodeConsumerTestPath}`,
|
|
`mkdir ${nodeConsumerTestPath}`,
|
|
`cp tests/node/consumers/* ${nodeConsumerTestPath}`,
|
|
`cp tests/node/consumers/* ${nodeConsumerTestPath}`,
|
|
`cd ${nodeConsumerTestPath}`,
|
|
`cd ${nodeConsumerTestPath}`,
|
|
"npm link cyberchef"
|
|
"npm link cyberchef"
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
},
|
|
},
|
|
teardownNodeConsumers: {
|
|
teardownNodeConsumers: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
`rm -rf ${nodeConsumerTestPath}`,
|
|
`rm -rf ${nodeConsumerTestPath}`,
|
|
"echo '\n--- Node consumer tests complete ---'"
|
|
"echo '\n--- Node consumer tests complete ---'"
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
},
|
|
},
|
|
testCJSNodeConsumer: {
|
|
testCJSNodeConsumer: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
`cd ${nodeConsumerTestPath}`,
|
|
`cd ${nodeConsumerTestPath}`,
|
|
"node --no-warnings cjs-consumer.js",
|
|
"node --no-warnings cjs-consumer.js",
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
stdout: false,
|
|
stdout: false,
|
|
},
|
|
},
|
|
testESMNodeConsumer: {
|
|
testESMNodeConsumer: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
`cd ${nodeConsumerTestPath}`,
|
|
`cd ${nodeConsumerTestPath}`,
|
|
"node --no-warnings --experimental-modules esm-consumer.mjs",
|
|
"node --no-warnings --experimental-modules esm-consumer.mjs",
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
stdout: false,
|
|
stdout: false,
|
|
},
|
|
},
|
|
testESMDeepImportNodeConsumer: {
|
|
testESMDeepImportNodeConsumer: {
|
|
- command: [
|
|
|
|
|
|
+ command: chainCommands([
|
|
`cd ${nodeConsumerTestPath}`,
|
|
`cd ${nodeConsumerTestPath}`,
|
|
"node --no-warnings --experimental-modules esm-deep-import-consumer.mjs",
|
|
"node --no-warnings --experimental-modules esm-deep-import-consumer.mjs",
|
|
- ].join(";"),
|
|
|
|
|
|
+ ]),
|
|
stdout: false,
|
|
stdout: false,
|
|
},
|
|
},
|
|
},
|
|
},
|