From b40361caf0ad9e07c45e5e1b53909a69c458b7db Mon Sep 17 00:00:00 2001 From: Holly Date: Mon, 16 Oct 2023 10:52:36 +0100 Subject: [PATCH] Replace fileSmasher with ncc. --- package-lock.json | 10 ++++++++++ package.json | 4 ++-- tooling/mangle.ts | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 446b14b..a98346a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "devDependencies": { "@types/node": "^20.6.0", "@types/node-fetch": "^2.6.4", + "@vercel/ncc": "^0.38.0", "check-outdated": "^2.12.0", "nodemon": "^3.0.1", "npm-run-all": "^4.1.5", @@ -228,6 +229,15 @@ "form-data": "^3.0.0" } }, + "node_modules/@vercel/ncc": { + "version": "0.38.0", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.0.tgz", + "integrity": "sha512-B4YKZMm/EqMptKSFyAq4q2SlgJe+VCmEH6Y8gf/E1pTlWbsUJpuH1ymik2Ex3aYO5mCWwV1kaSYHSQOT8+4vHA==", + "dev": true, + "bin": { + "ncc": "dist/ncc/cli.js" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", diff --git a/package.json b/package.json index b527a95..ee27f73 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "dev:updateCheck": "check-outdated", "dev:run": "nodemon --watch './**/*.ts' Binato.ts", "build": "npm-run-all build:*", - "build:smash": "ts-node ./tooling/fileSmasher.ts", - "build:build": "tsc --build", + "build:build": "ncc build Binato.ts -o build", "build:mangle": "ts-node ./tooling/mangle.ts", "build:cleanup": "ts-node ./tooling/cleanup.ts", "_clean": "tsc --build --clean" @@ -28,6 +27,7 @@ "devDependencies": { "@types/node": "^20.6.0", "@types/node-fetch": "^2.6.4", + "@vercel/ncc": "^0.38.0", "check-outdated": "^2.12.0", "nodemon": "^3.0.1", "npm-run-all": "^4.1.5", diff --git a/tooling/mangle.ts b/tooling/mangle.ts index 14f8580..be6c475 100644 --- a/tooling/mangle.ts +++ b/tooling/mangle.ts @@ -5,11 +5,11 @@ const DISABLE = false; writeFileSync("./build/.MANGLED", `${DISABLE}`); if (DISABLE) { - writeFileSync("./build/Binato.js", readFileSync("./build/combined.js")); + writeFileSync("./build/Binato.js", readFileSync("./build/index.js")); console.warn("[WARNING] mangle.ts is disabled!"); } else { (async () => { - const mangled = await minify(readFileSync("./build/combined.js").toString(), { + const mangled = await minify(readFileSync("./build/index.js").toString(), { mangle: true, toplevel: true, });