diff --git a/package.json b/package.json index 8a38ecf343..3df35687d4 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "build:js": "tsc --module es6 --incremental", "bundle:js": "rollup -c -m dev", "bundle:xml": "node tools/bundle_xml/main.js", - "build": "npm-run-all build:js bundle:js 'bundle:xml -- --outDir build'", + "build": "npm-run-all build:js bundle:js \"bundle:xml -- --outDir build\"", "doc": "typedoc", "precommit": "npm run prettier && npm run doc", "test": "jest", diff --git a/tools/bundle_xml/main.js b/tools/bundle_xml/main.js index 7fa3087a0b..88a2a18fa8 100644 --- a/tools/bundle_xml/main.js +++ b/tools/bundle_xml/main.js @@ -1,6 +1,8 @@ const bundle = require("./bundle_xml_templates"); -const outDirAgIndex = process.argv.findIndex((arg) => arg === "--outDir") + 1; -const outDir = process.argv[outDirAgIndex] || "dist"; +const DEFAULT_DIR = "dist"; -bundle.writeOwlTemplateBundleToFile(outDir); +const outDirFlagIndex = process.argv.findIndex((arg) => arg === "--outDir"); +const outDir = outDirFlagIndex !== -1 ? process.argv[outDirFlagIndex + 1] : DEFAULT_DIR; + +bundle.writeOwlTemplateBundleToFile(outDir || DEFAULT_DIR);