]> git.codecow.com Git - nano-pow.git/commitdiff
Split build script from configuration.
authorChris Duncan <chris@codecow.com>
Sat, 11 Jul 2026 07:03:29 +0000 (00:03 -0700)
committerChris Duncan <chris@codecow.com>
Sat, 11 Jul 2026 07:03:29 +0000 (00:03 -0700)
esbuild/build.mjs
esbuild/config.mjs [new file with mode: 0644]

index 2f8a945d0b5e3c8ad1ff2ec3c1d7ef1124e06e8e..623b3c0d1b3faea9be21089103a6b4191c9ac7a7 100644 (file)
@@ -2,53 +2,7 @@
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
 import { build } from 'esbuild'
-import { glsl } from 'esbuild-plugin-glsl'
-/** @import { BuildOptions } from 'esbuild' */
-
-/** @type BuildOptions */
-const sharedOptions = {
-       bundle: true,
-       format: 'esm',
-       outdir: 'dist',
-       loader: {
-               '.d.ts': 'copy',
-               '.wasm': 'binary'
-       },
-       legalComments: 'inline',
-       dropLabels: process.env.NODE_ENV === 'development' ? [] : ['LOG'],
-       sourcemap: 'linked',
-       plugins: [
-               glsl({
-                       minify: true,
-                       preserveLegalComments: true
-               })
-       ]
-}
-
-/** @type BuildOptions */
-const bundleOptions = {
-       ...sharedOptions,
-       platform: 'browser',
-       target: 'es2022',
-       entryPoints: [
-               './src/index.ts',
-               './src/utils/index.ts'
-       ]
-}
-
-/** @type BuildOptions */
-const cliOptions = {
-       ...sharedOptions,
-       platform: 'node',
-       target: 'node22',
-       bundle: false,
-       outdir: 'dist/bin',
-       entryPoints: [
-               './src/bin/cli.ts',
-               './src/bin/server.ts'
-       ],
-       packages: 'external'
-}
+import { bundleOptions, cliOptions } from './config.mjs'
 
 await build(bundleOptions)
 await build(cliOptions)
diff --git a/esbuild/config.mjs b/esbuild/config.mjs
new file mode 100644 (file)
index 0000000..42dea25
--- /dev/null
@@ -0,0 +1,50 @@
+//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
+//! SPDX-License-Identifier: GPL-3.0-or-later
+
+import { glsl } from 'esbuild-plugin-glsl'
+/** @import { BuildOptions } from 'esbuild' */
+
+/** @type BuildOptions */
+const sharedOptions = {
+       bundle: true,
+       format: 'esm',
+       outdir: 'dist',
+       loader: {
+               '.d.ts': 'copy',
+               '.wasm': 'binary'
+       },
+       legalComments: 'inline',
+       dropLabels: process.env.NODE_ENV === 'development' ? [] : ['LOG'],
+       sourcemap: 'linked',
+       plugins: [
+               glsl({
+                       minify: true,
+                       preserveLegalComments: true
+               })
+       ]
+}
+
+/** @type BuildOptions */
+export const bundleOptions = {
+       ...sharedOptions,
+       platform: 'browser',
+       target: 'es2022',
+       entryPoints: [
+               './src/index.ts',
+               './src/utils/index.ts'
+       ]
+}
+
+/** @type BuildOptions */
+export const cliOptions = {
+       ...sharedOptions,
+       platform: 'node',
+       target: 'node22',
+       bundle: false,
+       outdir: 'dist/bin',
+       entryPoints: [
+               './src/bin/cli.ts',
+               './src/bin/server.ts'
+       ],
+       packages: 'external'
+}