Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(toolkits/pro) An error message is displayed when the dependency installation fails #117

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/toolkits/pro/src/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,27 @@ export const installDependencies = (answers: ProjectInfo) => {
// egg服务端 安装依赖并启动
if (serverConfirm && serverFramework === ServerFrameworks.EggJs) {
log.info('正在安装服务端 npm 依赖,安装过程需要几十秒,请耐心等待...');
spawn.sync('npm', ['install'], {
const installServiceResult = spawn.sync('npm', ['install'], {
cwd: `${name}/${serverFramework}/`,
stdio: 'inherit',
});
log.success('服务端 npm 依赖安装成功');
if(installServiceResult.status === 0) {
log.success('服务端 npm 依赖安装成功');
}else {
throw new Error(installServiceResult.error);
}
}
// npm 依赖安装
log.info('正在安装客户端 npm 依赖,安装过程需要几十秒,请耐心等待...');
spawn.sync('npm', ['install'], {
const installClientResult = spawn.sync('npm', ['install'], {
cwd: serverConfirm ? `${name}/web` : `${name}/`,
stdio: 'inherit',
});
log.success('客户端 npm 依赖安装成功');
if(installClientResult.status === 0) {
log.success('客户端 npm 依赖安装成功');
}else {
throw new Error(installClientResult.error);
}

/* prettier-ignore-start */
console.log(
Expand Down