Merge pull request #928 from embark-framework/bug_fix/next-steps-too-soon

display "Next steps" after npm install has finished
This commit is contained in:
Iuri Matias 2018-09-27 18:48:51 -04:00 committed by GitHub
commit 62f2a2c421
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 12 deletions

View File

@ -33,7 +33,7 @@ class TemplateGenerator {
fs.mkdirpSync(utils.dirname(tmpFilePath));
utils.downloadFile(url, tmpFilePath, (err) => {
if (err) {
console.error(err.red);
console.error(utils.errorMessage(err).red);
console.error('Does the template really exist?'.red);
console.error(`Embark's supported templates: https://embark.status.im/templates/`.green);
process.exit(1);
@ -61,19 +61,20 @@ class TemplateGenerator {
this.installTemplate(
fspath,
name,
(this.templateName === 'boilerplate' || this.templateName === 'demo')
(this.templateName === 'boilerplate' || this.templateName === 'demo'),
() => {
if (name === 'embark_demo') {
console.log('-------------------'.yellow);
console.log(__('Next steps:').green);
console.log(('-> ' + ('cd ' + fspath).bold.cyan).green);
console.log('-> '.green + 'embark run'.bold.cyan);
console.log(__('For more info go to http://embark.status.im').green);
}
}
);
if (name === 'embark_demo') {
console.log('-------------------'.yellow);
console.log(__('Next steps:').green);
console.log(('-> ' + ('cd ' + fspath).bold.cyan).green);
console.log('-> '.green + 'embark run'.bold.cyan);
console.log(__('For more info go to http://embark.status.im').green);
}
}
installTemplate(templatePath, name, installPackages) {
installTemplate(templatePath, name, installPackages, cb) {
utils.cd(templatePath);
utils.sed('package.json', '%APP_NAME%', name);
if (fs.existsSync('dot.gitignore')) {
@ -88,10 +89,12 @@ class TemplateGenerator {
console.log(__('Installing packages...').green);
utils.runCmd('npm install', null, (err) => {
if (err) {
return console.error(err.red);
console.error(utils.errorMessage(err).red);
process.exit(1);
}
console.log(__('Init complete').green);
console.log('\n' + __('App ready at ').green + templatePath);
if (cb) cb();
});
}
}