also expose internal shared functionality for external usage

This commit is contained in:
2024-03-03 01:22:39 +01:00
parent a37a0932e0
commit 1a2728d21f
11 changed files with 670 additions and 453 deletions

View File

@@ -4,14 +4,28 @@ import { build, context } from 'esbuild'
import pkg from '../package.json' assert { type: 'json' }
const options = {
entryPoints: ['./src/index.ts'],
entryPoints: ['./src/cli.ts'],
bundle: true,
minify: true,
platform: 'node',
outfile: './dist/index.cjs',
outfile: './dist/cli.cjs',
define: { VERSION: `"${pkg.version}"` },
}
const watch = process.argv.slice(2)[0] === '--watch'
if (watch) (await context(options)).watch()
else await build(options)
if (watch) {
;(await context(options)).watch()
} else {
await build(options)
// Also build internals to expose
await build({
entryPoints: ['./src/index.ts'],
bundle: true,
minify: true,
platform: 'node',
format: 'esm',
outfile: './dist/index.js',
define: { VERSION: `"${pkg.version}"` },
})
}

View File

@@ -13,5 +13,5 @@ const targets = [
for (const target of targets) {
console.log(`🚀 Building ${target}`)
await exec(['./dist/index.cjs', '--target', target, '--output', `./bin/${target.replace('node18', 'cryptgeon')}`])
await exec(['./dist/cli.cjs', '--target', target, '--output', `./bin/${target.replace('node18', 'cryptgeon')}`])
}