dshemendiuk / gulp-npm-dist

Copy minified (dist) files of modules listed in package.json "dependencies" field to your build path
26 stars 3 forks source link

Add an option to copy the whole package instead of just the 'dist' folder #15

Closed thomasfrobieter closed 4 years ago

thomasfrobieter commented 4 years ago

Here's my task (Gulp 4):

gulp.task('move-frontend-libraries', function() {
  return gulp.src(npmDist({
    copyUnminified: true,
    replaceDefaultExcludes: true,
    excludes: gulpNpmDistExcludes
  }), {base:'./node_modules'})
  .pipe(gulp.dest('./frontend_libraries'))
  .pipe(notify({
    message: "Frontend Libraries: Moved",
    onLast: true
  }));
});

This is my exclusion array:

const gulpNpmDistExcludes = [
  '*.map',
  'examples/**/*',
  'example/**/*',
  'demo/**/*',
  'spec/**/*',
  'docs/**/*',
  'tests/**/*',
  'test/**/*',
  'Gruntfile.js',
  'gulpfile.js',
  'package.json',
  'package-lock.json',
  'bower.json',
  'composer.json',
  'yarn.lock',
  'webpack.config.js',
  'README',
  'LICENSE',
  'CHANGELOG',
  '*.coffee',
  '*.ts',
];

The structure of the package (foundation-sites) in the node_modules folder is:

CONTRIBUTING.md  _vendor             customizer  gulp         meteor-README.md patches
  scss
LICENSE          assets              dist        gulpfile.js  package.json     rollup.config.js  test
README.md        code-of-conduct.md  docs        js           package.nuspec   script

But the only copied folder is "dist".

thomasfrobieter commented 4 years ago

I just had a look into your code and i realized the exclusions are limited to the hardcoded 'dist' folder. So i've added an option to copy the whole package instead. I wasn't sure what the "deepPackage" thing is about, so i didn't make a pull request for this change.

Also.. maybe it's a better idea to limit the whole package just by the exclusions list (what first was my understanding of this list), not just scoping the 'dist' folder.

thomasfrobieter commented 4 years ago

Ouch, i just realized the name is 'gulp-npm-dist', not 'gulp-npm-copy-deps', so my request is probably out of scope of this plugin.