//! 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)
--- /dev/null
+//! 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'
+}