From f85b4b36bd2f1fcd5f3326472dc7d95a18d30ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:45:17 -0500 Subject: [PATCH] fix: async exec --- scripts/build.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 2771ed97a..3cbfbea53 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -2,10 +2,12 @@ import { exec } from 'child_process'; import { build } from 'esbuild'; import { cp, readdir } from 'fs/promises'; import { argv } from 'process'; +import { promisify } from 'util'; +const execPromise = promisify(exec); const isProduction = argv.includes('--production'); -readdir('src/workers').then((workers) => { +await readdir('src/workers').then((workers) => { const files = [ 'bot', 'index', @@ -41,8 +43,8 @@ readdir('src/workers').then((workers) => { }); // copy schema.prisma -cp('prisma/schema.prisma', 'dist/bot/schema.prisma'); -readdir('node_modules/prisma').then((files) => +await cp('prisma/schema.prisma', 'dist/bot/schema.prisma'); +await readdir('node_modules/prisma').then((files) => files .filter((file) => file.endsWith('.node')) .map((file) => cp(`node_modules/prisma/${file}`, `dist/bot/${file}`)), @@ -51,7 +53,7 @@ readdir('node_modules/prisma').then((files) => if (isProduction) { // install fixed sharp console.log('Installing fixed sharp...'); - exec('yarn init -y && yarn add sharp@0.33.1 --ignore-engines', { + await execPromise('yarn init -y && yarn add sharp@0.33.1 --ignore-engines', { cwd: 'dist/bot', }); }