From 7522e5de332fe181489bd2a64dcb373e7c0e304e Mon Sep 17 00:00:00 2001 From: d98762625 Date: Wed, 23 Jan 2019 09:54:52 +0000 Subject: [PATCH] remove unnecessary operationConfig manipulation --- Gruntfile.js | 9 +-------- src/core/config/scripts/generateOpsIndex.mjs | 2 +- src/node/api.mjs | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3161b646..0f80b86e 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -462,15 +462,8 @@ module.exports = function (grunt) { generateNodeIndex: { command: [ "echo '\n--- Regenerating node index ---'", - // Why copy and wipe OperationConfig? - // OperationConfig.json needs to be empty for build to avoid circular dependency on DetectFileType. - // We copy it to node dir so that we can use it as a search corpus in chef.help. - "echo 'Copying OperationConfig.json and wiping original'", - "cp src/core/config/OperationConfig.json src/node/config/OperationConfig.json", + // Avoid cyclic dependency "echo 'export default {};\n' > src/core/config/modules/OpModules.mjs", - "echo '[]\n' > src/core/config/OperationConfig.json", - "echo '\n OperationConfig.json copied to src/node/config. Modules wiped.'", - "node --experimental-modules src/node/config/scripts/generateNodeIndex.mjs", "echo '--- Node index generated. ---\n'" ].join(";"), diff --git a/src/core/config/scripts/generateOpsIndex.mjs b/src/core/config/scripts/generateOpsIndex.mjs index 49cd635c..6038656f 100644 --- a/src/core/config/scripts/generateOpsIndex.mjs +++ b/src/core/config/scripts/generateOpsIndex.mjs @@ -24,7 +24,7 @@ if (!fs.existsSync(dir)) { // Find all operation files const opObjs = []; fs.readdirSync(path.join(dir, "../operations")).forEach(file => { - if (!file.endsWith(".mjs") || file === "index.mjs") return; + if (!file.endsWith(".mjs") || file === "index.mjs" || file === "DetectFileType.mjs" || file === "Fork.mjs" || file === "GenerateQRCode.mjs" || file === "Magic.mjs" || file === "ParseQRCode.mjs" || file === "PlayMedia.mjs" || file === "RenderImage.mjs" || file === "ScanForEmbeddedFiles.mjs" || file === "SplitColourChannels.mjs") return; opObjs.push(file.split(".mjs")[0]); }); diff --git a/src/node/api.mjs b/src/node/api.mjs index ac0ac205..b0cd8658 100644 --- a/src/node/api.mjs +++ b/src/node/api.mjs @@ -10,7 +10,7 @@ import SyncDish from "./SyncDish"; import NodeRecipe from "./NodeRecipe"; -import OperationConfig from "./config/OperationConfig.json"; +import OperationConfig from "../core/config/OperationConfig.json"; import { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils"; import ExludedOperationError from "../core/errors/ExcludedOperationError";