feat: simplified build script

This commit is contained in:
TrèsAbhi committed 2023-10-01 16:56:59 -05:00
1 parent 38f912dc0a
commit 876fb0fc5e
4 files changed
+39 -40

No files matched your search

-35
View File
@@ -1,35 +0,0 @@
import { build } from 'esbuild';
import { argv } from 'process';
const targetFile = argv
.find((arg) => arg.startsWith('--build='))
?.split('=')[1];
const files = targetFile ? [targetFile] : ['bot', 'server'];
files.forEach(async (file) => {
console.log(`Building ${file}...`);
await build({
entryPoints: [`src/${file}.ts`],
outfile: `dist/${file}/index.cjs`,
platform: 'node',
tsconfig: 'tsconfig.esbuild.json',
loader: {
'.node': 'copy',
'.ttf': 'file',
},
format: 'cjs',
jsx: 'transform',
bundle: true,
sourcemap: true,
minifyIdentifiers: false, // cause goofy errors
minifySyntax: true,
minifyWhitespace: true,
logLevel: 'info',
});
console.log(`Built ${file}`);
});
+27
View File
@@ -0,0 +1,27 @@
import { build } from 'esbuild';
console.log('Building bot...');
await build({
entryPoints: ['src/bot.ts'],
outfile: 'dist/bot/index.cjs',
platform: 'node',
tsconfig: 'tsconfig.esbuild.json',
loader: {
'.node': 'copy',
'.ttf': 'file',
},
format: 'cjs',
jsx: 'transform',
bundle: true,
sourcemap: true,
minifyIdentifiers: false, // cause goofy errors
minifySyntax: true,
minifyWhitespace: true,
logLevel: 'info',
});
console.log('Built bot');