Skip to content

Commit deb91a7

Browse files
committed
fix: handle error of installation failed
1 parent edf4dbb commit deb91a7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules/
22
.DS_Store
33
package-lock.json
4-
yarn.lock
4+
yarn.lock

lib/stacks/next.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,15 @@ declare module '*.frag' {
107107
const useYarn = installCmd === 'yarn';
108108
const buildCmd = useYarn ? ['build'] : ['run', 'build'];
109109

110-
await execa(installCmd, buildCmd);
111-
output.success('Succeed to initialize for TypeScript');
110+
try {
111+
await execa(installCmd, ['install'])
112+
await execa(installCmd, buildCmd);
113+
output.success('Succeed to initialize for TypeScript');
114+
} catch (e) {
115+
output.error(e.message);
116+
await fs.remove(root);
117+
process.exit(1);
118+
}
112119
}
113120

114121
const compilePostCss = (str, root) => {

0 commit comments

Comments
 (0)