diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-25 00:44:13 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-25 00:44:13 +1000 |
commit | 314a4787ce55a091cb89ef4281d7ba09e8323fa4 (patch) | |
tree | d77142c009e9c6d45390a8fe01c9aee966d7a4cc /scripts/build_new.js | |
parent | Merge remote-tracking branch 'upstream/staging' into feat/captchaVerify (diff) | |
parent | case insensitive header for rate limits, fix rate limit default settings (diff) | |
download | server-314a4787ce55a091cb89ef4281d7ba09e8323fa4.tar.xz |
Merge remote-tracking branch 'upstream/staging' into feat/captchaVerify
Diffstat (limited to 'scripts/build_new.js')
-rw-r--r-- | scripts/build_new.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/build_new.js b/scripts/build_new.js new file mode 100644 index 00000000..6a56e7f7 --- /dev/null +++ b/scripts/build_new.js @@ -0,0 +1,31 @@ +const { execSync } = require("child_process"); +const path = require("path"); +const fs = require("fs"); +const { argv, stdout, exit } = require("process"); +const { execIn, parts, getDirs, walk, sanitizeVarName } = require("./utils"); + +//file paths +const rootDir = path.join(__dirname, ".."); +const srcDir = path.join(rootDir, "src"); +const distDir = path.join(rootDir, "dist"); +const scriptsDir = path.join(rootDir, "scripts"); +const configPath = path.join(rootDir, "build.json"); +const buildLog = path.join(rootDir, "build.log"); +const buildLogAnsi = path.join(rootDir, "build.log.ansi"); +const pluginDir = path.join(srcDir, "plugins"); + +//more, dont export +const buildStepDir = path.join(scriptsDir, "build"); + +if (!fs.existsSync(configPath)) { + if (!fs.existsSync(path.join(configPath + ".default"))) { + console.log("build.json.default not found! Exiting!"); + exit(1); + } + fs.copyFileSync(configPath + ".default", configPath); +} +let config = { rootDir, srcDir, distDir, configPath, buildLog, buildLogAnsi, pluginDir, ...require(configPath) }; + +config.steps.pre.forEach((step) => require(path.join(buildStepDir, step))(config)); +require(path.join(buildStepDir, "compile_" + config.compiler))(config); +config.steps.post.forEach((step) => require(path.join(buildStepDir, step))(config)); |