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

+10
View File
@@ -5,3 +5,13 @@ One of the biggest updates ever! This changelog's size does not truly represent
## Changes
- Disabled the `/clan-event` command
## Technical Changes
- Removed all server assets
- Simplified build script to only compile the bot
- Upgraded the build script to TypeScript
- Moved docs build to `dist/docs`
- Split `tsconfig.json` for Next.js and esbuild
- Removed Gitpod config
- Use
+2 -5
View File
@@ -1,21 +1,18 @@
{
"name": "blitzkrieg",
"version": "1.12.9",
"version": "1.30.0",
"description": "🎉 All-in-one Discord bot for everything World of Tanks Blitz",
"main": "src/server.ts",
"type": "module",
"scripts": {
"build:bot": "node scripts/build --build=bot",
"build:server": "node scripts/build --build=server",
"build:bot": "vite-node --script scripts/build",
"build:website": "next build",
"build:docs": "vitepress build docs",
"build:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard",
"dev:bot": "yarn build:bot && yarn start:bot",
"dev:server": "yarn build:server && yarn start:server",
"dev:docs": "vitepress dev docs",
"dev:website": "next dev",
"start:bot": "node --enable-source-maps --trace-warnings dist/bot/index.cjs",
"start:server": "node --enable-source-maps --trace-warnings dist/server/index.cjs",
"start:website": "next start",
"host:docs": "vitepress preview docs",
"publish:ratingsleaderboard": "vite-node --script scripts/buildRatingsLeaderboard --publish",
-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');