Skip to content

Commit a0cc528

Browse files
fix: remove dependency cycle in vercel util
1 parent fd3fa7c commit a0cc528

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

lib/utils/vercel/vercel.utils.js

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { rmSync, existsSync, mkdirSync, writeFileSync } from 'fs';
2-
import { exec } from '#utils';
2+
import { spawn } from 'child_process';
33
import { join } from 'path';
44

55
/**
@@ -39,7 +39,35 @@ function createVercelProjectConfig() {
3939
*/
4040
async function runVercelBuild() {
4141
// https://vercel.com/docs/build-output-api/v3
42-
await exec('npx --yes vercel@32.2.1 build --prod', '', true, true);
42+
await new Promise((resolve, reject) => {
43+
const args = ['npx', '--yes', 'vercel@32.2.1', 'build', '--prod'];
44+
const cmd = args.shift();
45+
46+
const execProcess = spawn(cmd, args, {
47+
shell: true,
48+
stdio: 'inherit',
49+
});
50+
51+
execProcess.on('close', (code) => {
52+
if (code === 0) {
53+
resolve();
54+
} else {
55+
reject(
56+
new Error(`Command '${args.join(' ')}' failed with code ${code}`),
57+
);
58+
}
59+
});
60+
61+
execProcess.on('exit', (code) => {
62+
if (code === 0) {
63+
resolve();
64+
} else {
65+
reject(
66+
new Error(`Command '${args.join(' ')}' failed with code ${code}`),
67+
);
68+
}
69+
});
70+
});
4371
}
4472

4573
export default {

0 commit comments

Comments
 (0)