mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
38 lines
807 B
JavaScript
Executable File
38 lines
807 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
const esbuild = require('esbuild')
|
|
const alias = require('esbuild-plugin-alias')
|
|
|
|
let common = {
|
|
entryPoints: ['index.ts'],
|
|
bundle: true,
|
|
plugins: [
|
|
alias({
|
|
stream: require.resolve('readable-stream')
|
|
})
|
|
],
|
|
sourcemap: 'external'
|
|
}
|
|
|
|
esbuild
|
|
.build({...common, outdir: 'esm/', format: 'esm', packages: 'external'})
|
|
.then(() => console.log('esm build success.'))
|
|
|
|
esbuild
|
|
.build({...common, outdir: 'cjs/', format: 'cjs', packages: 'external'})
|
|
.then(() => console.log('cjs build success.'))
|
|
|
|
esbuild
|
|
.build({
|
|
...common,
|
|
outdir: 'standalone/',
|
|
format: 'iife',
|
|
globalName: 'NostrTools',
|
|
define: {
|
|
window: 'self',
|
|
global: 'self',
|
|
process: '{"env": {}}'
|
|
}
|
|
})
|
|
.then(() => console.log('standalone build success.'))
|