Skip to content

Commit

Permalink
fix: Fix Node.js v8 support (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzong committed Aug 19, 2020
1 parent 26dfa17 commit 517a105
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cli/commands-cn/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ const initTemplateFromCli = async (targetPath, packageName, registryPackage, cli
cli.sessionStatus('Unpacking your new app', packageName);
const zip = new AdmZip(tmpFilename);
zip.extractAllTo(targetPath);
await fs.promises.unlink(tmpFilename);
// Need to polyfill this promise feature for support of nodejs>=8
if (fs.promises) {
await fs.promises.unlink(tmpFilename);
} else {
const unlink = promisify(fs.unlink);
await unlink(tmpFilename);
}

cli.sessionStatus('Setting up your new app');
await unpack(cli, targetPath);
Expand Down

0 comments on commit 517a105

Please sign in to comment.