diff --git a/.github/workflows/build-bot.yml b/.github/workflows/build-bot.yml index 24a0f7909..4847a7532 100644 --- a/.github/workflows/build-bot.yml +++ b/.github/workflows/build-bot.yml @@ -21,10 +21,10 @@ jobs: run: bun install - name: Build Prisma - run: bun prisma generate + run: bun run build:prisma - name: Build bot - run: bun build:bot + run: bun run build:bot - name: Archive build uses: actions/upload-artifact@v4 diff --git a/.github/workflows/host-bot.yml b/.github/workflows/host-bot.yml index 5af2f907e..00039dbb0 100644 --- a/.github/workflows/host-bot.yml +++ b/.github/workflows/host-bot.yml @@ -39,4 +39,5 @@ jobs: DATABASE_URL: ${{ secrets.DATABASE_URL }} DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} run: | + mv dist/bot/prisma . bun dist/bot/main.js diff --git a/bun.lockb b/bun.lockb index ead12c6b6..388393570 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index bf5f319b8..c4c559680 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@types/lodash-es": "^4.17.12", "@types/node": "^22.5.4", "prettier": "^3.3.3", - "prisma": "^5.19.1", + "prisma": "^6.0.0", "typescript": "^5.5.4" } } diff --git a/packages/scripts/src/buildBot.ts b/packages/scripts/src/buildBot.ts index 0f2231fdc..deac40170 100644 --- a/packages/scripts/src/buildBot.ts +++ b/packages/scripts/src/buildBot.ts @@ -2,9 +2,10 @@ import { build } from 'esbuild'; import { cp, readdir, rm } from 'fs/promises'; import { argv } from 'process'; -const srcRoot = '../bot'; -const distRoot = '../../dist/bot'; -const modulesRoot = '../../node_modules'; +const projectDir = '../..'; +const srcRoot = `${projectDir}/packages/bot`; +const distRoot = `${projectDir}/dist/bot`; +const modulesRoot = `${projectDir}/node_modules`; const workers = await readdir(`${srcRoot}/src/workers`); const dev = argv.includes('--dev'); @@ -29,19 +30,25 @@ build({ sourcemap: !dev, }); -await Promise.all( - (await readdir(`${modulesRoot}/@resvg`)).map(async (module) => { - const files = await readdir(`${modulesRoot}/@resvg/${module}`).then( - (files) => files.filter((file) => file.endsWith('.node')), - ); - - await Promise.all( - files.map(async (file) => { - await cp( +for (const module of await readdir(`${modulesRoot}/@resvg`)) { + readdir(`${modulesRoot}/@resvg/${module}`).then((files) => + files + .filter((file) => file.endsWith('.node')) + .map((file) => + cp( `${modulesRoot}/@resvg/${module}/${file}`, `${distRoot}/workers/${file}`, - ); - }), - ); - }), -); + ), + ), + ); +} + +if (!dev) { + await cp(`${projectDir}/prisma`, `${distRoot}/prisma`, { recursive: true }); + + for (const file of await readdir(`${modulesRoot}/prisma`).then((files) => + files.filter((file) => file.endsWith('.node')), + )) { + cp(`${modulesRoot}/prisma/${file}`, `${distRoot}/prisma/${file}`); + } +}