Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore files in Yeoman with fs.copyTpl

how can i ignore files? i want to exclude all file starting with _ in any subdirectory. i have no success with these two approaches:

this.fs.copyTpl(
   this.templatePath('basicFiles/'),
   this.destinationPath(''),
   answers,
   {ignore:"_*.*"}
);

this.fs.copyTpl(
  [!*.*,this.templatePath('basicFiles/')],
  this.destinationPath(''),
  answers
);

More general, would like to merge(deep copy) every basic/_exmaple.json into additionalConfig/example.json to desitnationPaht/exmaple.json (merged).

Every idea is welcome :).

like image 342
Benedikt Kromer Avatar asked Apr 25 '17 23:04

Benedikt Kromer


1 Answers

For fs.copyTpl your {ignore:"_*.*"} needs to be in the 5th argument object (as the syntax says) and inside globOptions key:

this.fs.copyTpl(
  this.templatePath('**/*'), // from
  this.destinationRoot(),    // to
  {},  // context            // not here
  {},  // templateOptions    // not here
  { globOptions: {ignore:"_*.*"} } // < but here
)

Same for {dot: true} and other such options.

like image 169
laggingreflex Avatar answered Nov 15 '22 05:11

laggingreflex