mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Merge branch 'BjoernAkAManf-master'
This commit is contained in:
commit
e9e162319f
1 changed files with 36 additions and 17 deletions
53
Gruntfile.js
53
Gruntfile.js
|
@ -14,7 +14,6 @@ const path = require("path");
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
grunt.file.defaultEncoding = "utf8";
|
grunt.file.defaultEncoding = "utf8";
|
||||||
grunt.file.preserveBOM = false;
|
grunt.file.preserveBOM = false;
|
||||||
|
@ -102,6 +101,26 @@ module.exports = function (grunt) {
|
||||||
return entryModules;
|
return entryModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects the correct delimiter to use to chain shell commands together
|
||||||
|
* based on the current OS.
|
||||||
|
*
|
||||||
|
* @param {string[]} cmds
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function chainCommands(cmds) {
|
||||||
|
const win = process.platform === "win32";
|
||||||
|
if (!win) {
|
||||||
|
return cmds.join(";");
|
||||||
|
}
|
||||||
|
return cmds
|
||||||
|
// && means that subsequent commands will not be executed if the
|
||||||
|
// previous one fails. & would coninue on a fail
|
||||||
|
.join("&&")
|
||||||
|
// Windows does not support \n properly
|
||||||
|
.replace("\n", "\\n");
|
||||||
|
}
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
clean: {
|
clean: {
|
||||||
dev: ["build/dev/*"],
|
dev: ["build/dev/*"],
|
||||||
|
@ -316,10 +335,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 +348,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 +373,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 consumers ---'",
|
"echo '\n--- Testing node consumers ---'",
|
||||||
"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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue