mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
bugfix for UTF16 vs UTF8 problems
This commit is contained in:
parent
9787ab04cd
commit
abafd09a8b
2 changed files with 51 additions and 9 deletions
11
Gruntfile.js
11
Gruntfile.js
|
@ -389,15 +389,8 @@ module.exports = function (grunt) {
|
||||||
command: "node build/prod/sitemap.js > build/prod/sitemap.xml"
|
command: "node build/prod/sitemap.js > build/prod/sitemap.xml"
|
||||||
},
|
},
|
||||||
generateConfig: {
|
generateConfig: {
|
||||||
command: [
|
command: "node --experimental-modules --no-warnings --no-deprecation src/core/config/scripts/generateDefaults.mjs",
|
||||||
"echo '\n--- Regenerating config files. ---'",
|
stdout: true
|
||||||
"mkdir -p src/core/config/modules",
|
|
||||||
"echo 'export default {};\n' > src/core/config/modules/OpModules.mjs",
|
|
||||||
"echo '[]\n' > 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/generateConfig.mjs",
|
|
||||||
"echo '--- Config scripts finished. ---\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"
|
||||||
|
|
49
src/core/config/scripts/generateDefaults.mjs
Normal file
49
src/core/config/scripts/generateDefaults.mjs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* This script automatically generates OperationConfig.json, containing metadata
|
||||||
|
* for each operation in the src/core/operations directory.
|
||||||
|
* It also generates modules in the src/core/config/modules directory to separate
|
||||||
|
* out operations into logical collections.
|
||||||
|
*
|
||||||
|
* @author David B Heise [david@heiseink.com]
|
||||||
|
* @copyright Crown Copyright 2018
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*eslint no-console: ["off"] */
|
||||||
|
|
||||||
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
|
import process from "process";
|
||||||
|
import childProcess from "child_process"
|
||||||
|
|
||||||
|
|
||||||
|
const mkdirSync = function (dirPath) {
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(dirPath)
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code !== 'EEXIST') throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mkdirpSync = function (dirPath) {
|
||||||
|
const parts = dirPath.split(path.sep)
|
||||||
|
for (let i = 1; i <= parts.length; i++) {
|
||||||
|
mkdirSync(path.join.apply(null, parts.slice(0, i)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const dir = process.cwd();
|
||||||
|
|
||||||
|
//Create the Destination Folder
|
||||||
|
mkdirpSync(path.join(dir, "src/core/config/modules"))
|
||||||
|
|
||||||
|
//Create the default files
|
||||||
|
fs.writeFileSync(path.join(dir, "src/core/config/modules/OpModules.mjs"), "export default{};\n")
|
||||||
|
fs.writeFileSync(path.join(dir, "src/core/config/OperationConfig.json"), "[]\n")
|
||||||
|
|
||||||
|
//Run the generateOpsIndex.mjs file
|
||||||
|
childProcess.fork(path.join(dir, "src/core/config/scripts/generateOpsIndex.mjs"), { execArgv: ["--experimental-modules","--no-warnings","--no-deprecation"]})
|
||||||
|
|
||||||
|
//Run the generateConfig.mjs file
|
||||||
|
childProcess.fork(path.join(dir, "src/core/config/scripts/generateConfig.mjs"), { execArgv: ["--experimental-modules","--no-warnings","--no-deprecation"]})
|
Loading…
Add table
Add a link
Reference in a new issue