feat: include sharp in build

This commit is contained in:
TrèsAbhi committed 2024-03-17 21:45:55 -05:00
1 parent 379a33375d
commit ee7ffe7bc8
3 files changed
+10 -7

No files matched your search

-6
View File
@@ -23,12 +23,6 @@ jobs:
with:
node-version: 18
- name: Install Yarn
run: npm install --location=global yarn
- name: Add fixed sharp
run: yarn add [email protected] --ignore-engines
- name: Download release assets
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/tresabhi/blitzkrieg/releases/latest \
+1 -1
View File
@@ -12,7 +12,7 @@
"build:assets": "vite-node --max_old_space_size=16384 --script scripts/buildAssets/index",
"build:test": "vite-node --script scripts/buildTest",
"build:ratingsplot": "vite-node --script scripts/buildRatingsPlot",
"dev:bot": "yarn build:bot && yarn start:bot",
"dev:bot": "yarn build:bot --dev && yarn start:bot",
"dev:docs": "vitepress dev docs",
"dev:website": "next dev",
"start:bot": "node --enable-source-maps dist/bot/index.cjs",
+9
View File
@@ -1,5 +1,8 @@
import { build } from 'esbuild';
import { cp, readdir } from 'fs/promises';
import { argv } from 'process';
const isDev = argv.includes('--dev');
readdir('src/workers').then((workers) => {
const files = [
@@ -25,6 +28,7 @@ readdir('src/workers').then((workers) => {
'.js': '.cjs',
},
external: ['sharp'],
bundle: true,
sourcemap: true,
minifyIdentifiers: false, // causes goofy errors
@@ -42,3 +46,8 @@ readdir('node_modules/prisma').then((files) =>
.filter((file) => file.endsWith('.node'))
.map((file) => cp(`node_modules/prisma/${file}`, `dist/bot/${file}`)),
);
// copy sharp as is
if (!isDev) {
cp('node_modules/sharp', 'dist/bot/node_modules/sharp', { recursive: true });
}