]> git.codecow.com Git - nano-pow.git/commitdiff
Revert to single esbuild script and move into scripts directory.
authorChris Duncan <chris@codecow.com>
Sun, 12 Jul 2026 07:01:32 +0000 (00:01 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 12 Jul 2026 07:01:32 +0000 (00:01 -0700)
esbuild/build.mjs [deleted file]
package.json
scripts/build.mjs [moved from esbuild/config.mjs with 70% similarity]

diff --git a/esbuild/build.mjs b/esbuild/build.mjs
deleted file mode 100644 (file)
index 55c40a3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-//! 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)
-}
index d06a1b38729b9a83fb1c4392add7ec456f71db77..bb943e1806626d1994f026a276898d064d365142 100644 (file)
                "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",
similarity index 70%
rename from esbuild/config.mjs
rename to scripts/build.mjs
index f02f40d58dc5ecc38475e93707aaff7b9f7cb330..082ce3e40b39d2dd57965832b48cadbd3e04351c 100644 (file)
@@ -1,6 +1,7 @@
 //! 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' */
 
@@ -25,7 +26,7 @@ const sharedOptions = {
 }
 
 /** @type BuildOptions */
-export const bundleOptions = {
+const bundleOptions = {
        ...sharedOptions,
        bundle: true,
        platform: 'browser',
@@ -37,7 +38,7 @@ export const bundleOptions = {
 }
 
 /** @type BuildOptions */
-export const cliOptions = {
+const cliOptions = {
        ...sharedOptions,
        bundle: false,
        platform: 'node',
@@ -48,3 +49,24 @@ export const cliOptions = {
        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
+       })
+}