+++ /dev/null
-//! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
-//! SPDX-License-Identifier: GPL-3.0-or-later
-
-import { build } from 'esbuild'
-import { bundleOptions, cliOptions } from './config.mjs'
-
-const prodOptions = {
- minify: true,
- sourcemap: undefined
-}
-
-if (process.env.NODE_ENV !== 'development') {
- build({
- ...bundleOptions,
- ...prodOptions
- })
- build({
- ...cliOptions,
- ...prodOptions
- })
-} else {
- build(bundleOptions)
- build(cliOptions)
-}
"url": "git+https://codecow.com/nano-pow.git"
},
"scripts": {
- "benchmark": "npm run build && ./dist/bin/nano-pow.sh --benchmark 10 --debug",
- "build": "npm run clean && npm run generate && node esbuild/build.mjs && cp -p src/bin/nano-pow.sh dist/bin",
+ "benchmark": "npm run build && dist/bin/nano-pow.sh --benchmark 10 --debug",
+ "build": "npm run clean && npm run generate && node scripts/build.mjs && cp -p src/bin/nano-pow.sh dist/bin",
"build:dev": "NODE_ENV=development npm run build",
"clean": "rm -rf dist types && tsc",
- "generate": "node ./scripts/blake2b-gen.js && asc src/lib/generate/wasm/asm/index.ts",
+ "generate": "node scripts/blake2b-gen.js && asc src/lib/generate/wasm/asm/index.ts",
"prepare": "npm run build",
- "score": "npm run build && ./dist/bin/nano-pow.sh --effort 4 --benchmark 10 --score 10",
- "start": "node --max-http-header-size=1024 --max-old-space-size=256 ./dist/bin/server.js",
- "test": "npm run build:dev && ./test/script.sh"
+ "score": "npm run build && dist/bin/nano-pow.sh --effort 4 --benchmark 10 --score 10",
+ "start": "node --max-http-header-size=1024 --max-old-space-size=256 dist/bin/server.js",
+ "test": "npm run build:dev && test/script.sh"
},
"devDependencies": {
"@types/node": "^26.1.1",
//! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
//! SPDX-License-Identifier: GPL-3.0-or-later
+import { build } from 'esbuild'
import { glsl } from 'esbuild-plugin-glsl'
/** @import { BuildOptions } from 'esbuild' */
}
/** @type BuildOptions */
-export const bundleOptions = {
+const bundleOptions = {
...sharedOptions,
bundle: true,
platform: 'browser',
}
/** @type BuildOptions */
-export const cliOptions = {
+const cliOptions = {
...sharedOptions,
bundle: false,
platform: 'node',
packages: 'external',
target: 'node22'
}
+
+/** @type BuildOptions */
+const prodOptions = {
+ drop: ['debugger'],
+ minify: true,
+ sourcemap: undefined
+}
+
+if (process.env.NODE_ENV === 'development') {
+ build(bundleOptions)
+ build(cliOptions)
+} else {
+ build({
+ ...bundleOptions,
+ ...prodOptions
+ })
+ build({
+ ...cliOptions,
+ ...prodOptions
+ })
+}