mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: async exec
This commit is contained in:
1 parent
f777dafefc
commit
f85b4b36bd
1 file changed
+6
-4
+6
-4
@@ -2,10 +2,12 @@ import { exec } from 'child_process';
|
|||||||
import { build } from 'esbuild';
|
import { build } from 'esbuild';
|
||||||
import { cp, readdir } from 'fs/promises';
|
import { cp, readdir } from 'fs/promises';
|
||||||
import { argv } from 'process';
|
import { argv } from 'process';
|
||||||
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
const execPromise = promisify(exec);
|
||||||
const isProduction = argv.includes('--production');
|
const isProduction = argv.includes('--production');
|
||||||
|
|
||||||
readdir('src/workers').then((workers) => {
|
await readdir('src/workers').then((workers) => {
|
||||||
const files = [
|
const files = [
|
||||||
'bot',
|
'bot',
|
||||||
'index',
|
'index',
|
||||||
@@ -41,8 +43,8 @@ readdir('src/workers').then((workers) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// copy schema.prisma
|
// copy schema.prisma
|
||||||
cp('prisma/schema.prisma', 'dist/bot/schema.prisma');
|
await cp('prisma/schema.prisma', 'dist/bot/schema.prisma');
|
||||||
readdir('node_modules/prisma').then((files) =>
|
await readdir('node_modules/prisma').then((files) =>
|
||||||
files
|
files
|
||||||
.filter((file) => file.endsWith('.node'))
|
.filter((file) => file.endsWith('.node'))
|
||||||
.map((file) => cp(`node_modules/prisma/${file}`, `dist/bot/${file}`)),
|
.map((file) => cp(`node_modules/prisma/${file}`, `dist/bot/${file}`)),
|
||||||
@@ -51,7 +53,7 @@ readdir('node_modules/prisma').then((files) =>
|
|||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
// install fixed sharp
|
// install fixed sharp
|
||||||
console.log('Installing fixed sharp...');
|
console.log('Installing fixed sharp...');
|
||||||
exec('yarn init -y && yarn add [email protected] --ignore-engines', {
|
await execPromise('yarn init -y && yarn add [email protected] --ignore-engines', {
|
||||||
cwd: 'dist/bot',
|
cwd: 'dist/bot',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user