Skip to content

Commit

Permalink
fix(generators/demo): avoid re-installing dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
cueedee committed Oct 11, 2017
1 parent 312f2de commit c862fba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ class AppGenerator extends Generator
'\n'
+ 'Running a number of "'
+ chalk.yellow( 'npm install ' + chalk.cyan( '<package>' ) + ' --save' + chalk.cyan( '[' ) + '-dev' + chalk.cyan( ']' ))
+ '"s for you to install required dependencies.'
+ '"s for you to install required dependencies...\n'
));

this.npmInstall( devDeps, { saveDev: true } );
Expand Down
17 changes: 15 additions & 2 deletions generators/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,22 @@ class DemoGenerator extends Generator

if ( !( data.i18n )) { return; }

var deps = [ 'madlib-locale' ];
var pkgPath = this.destinationPath( 'package.json' )
, fs = this.fs
, npm = fs.readJSON( pkgPath )
, dep = 'madlib-locale'
;

if ( npm.dependencies[ dep ] ) { return; }

this.log( chalk.bold(
'\n'
+ 'Running "'
+ chalk.yellow( 'npm install ' + chalk.cyan( dep ) + ' --save' )
+ '" for you to install required dependencies...\n'
));

this.npmInstall( deps, { save: true } );
this.npmInstall( [ dep ], { save: true } );
}
)();

Expand Down

0 comments on commit c862fba

Please sign in to comment.