File tree Expand file tree Collapse file tree
packages/generator-feathers/generators/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -389,12 +389,24 @@ module.exports = generators.Base.extend({
389389 'request'
390390 ] ;
391391
392- this . npmInstall ( this . dependencies , { save : true } ) ;
393-
394392 if ( this . props . babel ) {
395393 devDependencies . push ( 'babel-cli' , 'babel-core' , 'babel-preset-es2015' ) ;
396394 }
395+
396+ this . dependencies . concat ( devDependencies ) . forEach ( function ( dependency ) {
397+ var separatorIndex = dependency . indexOf ( '@' ) ;
398+ var end = separatorIndex !== - 1 ? separatorIndex : dependency . length ;
399+ var dependencyName = dependency . substring ( 0 , end ) ;
400+
401+ // Throw an error if the project name is the same as one of the dependencies
402+ if ( dependencyName === this . props . name ) {
403+ this . log . error ( 'Your project can not be named ' + this . props . name + ' because the ' +
404+ dependency + ' package will be installed as dependency.' ) ;
405+ process . exit ( 1 ) ;
406+ }
407+ } . bind ( this ) ) ;
397408
409+ this . npmInstall ( this . dependencies , { save : true } ) ;
398410 this . npmInstall ( devDependencies , { saveDev : true } ) ;
399411 }
400412 } ,
You can’t perform that action at this time.
0 commit comments