call path.join once and store in fspath var

This commit is contained in:
Todd Baur 2017-03-22 21:46:59 +09:00
parent e7286d6f3c
commit 20baf5ee9f
1 changed files with 5 additions and 4 deletions

View File

@ -9,20 +9,21 @@ var TemplateGenerator = function(templateName) {
TemplateGenerator.prototype.generate = function(destinationFolder, name) {
var templatePath = fs.embarkPath(this.templateName);
console.log('Initializing Embark Template....'.green);
var fspath = path.join(destinationFolder, name);
fs.copySync(templatePath, path.join(destinationFolder, name));
utils.cd(path.join(destinationFolder, name));
fs.copySync(templatePath, fspath);
utils.cd(fspath);
utils.sed('package.json', '%APP_NAME%', name);
console.log('Installing packages.. this can take a few seconds'.green);
utils.runCmd('npm install');
console.log('Init complete'.green);
console.log('\nApp ready at '.green + path.join(destinationFolder, name));
console.log('\nApp ready at '.green + fspath);
if (name === 'embark_demo') {
console.log('-------------------'.yellow);
console.log('Next steps:'.green);
console.log(('-> ' + ('cd ' + path.join(destinationFolder, name)).bold.cyan).green);
console.log(('-> ' + ('cd ' + fspath).bold.cyan).green);
console.log('-> '.green + 'embark blockchain'.bold.cyan + ' or '.green + 'embark simulator'.bold.cyan);
console.log('open another console in the same directory and run'.green);
console.log('-> '.green + 'embark run'.bold.cyan);