Swap smasher out for @vercel/ncc

This commit is contained in:
Holly Stubbs 2023-11-02 10:40:46 +00:00
parent f1c4dcda75
commit 0c0d8f7711
3 changed files with 24 additions and 14 deletions

26
package-lock.json generated
View file

@ -13,11 +13,12 @@
"hsconsole": "^1.0.2" "hsconsole": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.8.9", "@types/node": "^20.8.10",
"@vercel/ncc": "^0.38.1",
"check-outdated": "^2.12.0", "check-outdated": "^2.12.0",
"nodemon": "^3.0.1", "nodemon": "^3.0.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"terser": "^5.22.0", "terser": "^5.24.0",
"ts-loader": "^9.5.0", "ts-loader": "^9.5.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2" "typescript": "^5.2.2"
@ -170,14 +171,23 @@
"peer": true "peer": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.8.9", "version": "20.8.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz",
"integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"undici-types": "~5.26.4" "undici-types": "~5.26.4"
} }
}, },
"node_modules/@vercel/ncc": {
"version": "0.38.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
"dev": true,
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/@webassemblyjs/ast": { "node_modules/@webassemblyjs/ast": {
"version": "1.11.6", "version": "1.11.6",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz",
@ -2328,9 +2338,9 @@
} }
}, },
"node_modules/terser": { "node_modules/terser": {
"version": "5.22.0", "version": "5.24.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.22.0.tgz", "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz",
"integrity": "sha512-hHZVLgRA2z4NWcN6aS5rQDc+7Dcy58HOf2zbYwmFcQ+ua3h6eEFf5lIDKTzbWwlazPyOZsFQO8V80/IjVNExEw==", "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@jridgewell/source-map": "^0.3.3", "@jridgewell/source-map": "^0.3.3",

View file

@ -7,8 +7,7 @@
"dev:updateCheck": "check-outdated", "dev:updateCheck": "check-outdated",
"dev:run": "nodemon --watch './**/*.ts' index.ts", "dev:run": "nodemon --watch './**/*.ts' index.ts",
"build": "npm-run-all build:*", "build": "npm-run-all build:*",
"build:smash": "ts-node ./tooling/fileSmasher.ts", "build:build": "ncc build index.ts -o build",
"build:build": "tsc --build",
"build:mangle": "ts-node ./tooling/mangle.ts", "build:mangle": "ts-node ./tooling/mangle.ts",
"build:cleanup": "ts-node ./tooling/cleanup.ts", "build:cleanup": "ts-node ./tooling/cleanup.ts",
"_clean": "tsc --build --clean" "_clean": "tsc --build --clean"
@ -29,11 +28,12 @@
"hsconsole": "^1.0.2" "hsconsole": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.8.9", "@types/node": "^20.8.10",
"@vercel/ncc": "^0.38.1",
"check-outdated": "^2.12.0", "check-outdated": "^2.12.0",
"nodemon": "^3.0.1", "nodemon": "^3.0.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"terser": "^5.22.0", "terser": "^5.24.0",
"ts-loader": "^9.5.0", "ts-loader": "^9.5.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2" "typescript": "^5.2.2"

View file

@ -2,9 +2,9 @@ import { readFileSync, writeFileSync } from "fs";
import { minify } from "terser"; import { minify } from "terser";
(async () => { (async () => {
const mangled = await minify(readFileSync("./build/combined.js").toString(), { const mangled = await minify(readFileSync("./build/index.js").toString(), {
mangle: true, mangle: true,
toplevel: true, toplevel: true,
}); });
writeFileSync("./build/index.min.js", `${mangled.code}`); writeFileSync("./build/index.min.js", `${mangled.code?.replaceAll("new Array", "[]")}`);
})(); })();