Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make excludes more flexible #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajbeaven
Copy link

@ajbeaven ajbeaven commented Dec 4, 2019

Apply excludes on the root node modules folder rather than every individual package which allows for more flexibility.

This will potentially break existing installs, so suggest you bump the major version.

@dshemendiuk
Copy link
Owner

Hi, @ajbeaven
Can you provide an example of a gulp task that works?

It does not work for default tasks from the readme.

@ajbeaven
Copy link
Author

ajbeaven commented Dec 9, 2019

Hrm... what's not working?

With a package.json like so:

{
  "name": "thing",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^4.0.2",
    "gulp-npm-dist": "^1.0.3"
  },
  "dependencies": {
    "moment": "^2.24.0"
  }
}

And a gulpfile.js like so:

var gulp = require('gulp');
var npmDist = require('gulp-npm-dist');

gulp.task('copy:libs', function () {
    return gulp.src(npmDist({
            copyUnminified: true,
            excludes: ['/**/*.js']
        }), {
            base: './node_modules/'
        })
        .pipe(gulp.dest('./dist/libs'));
});

Here's a zip file of the above test project.

When you run up the project above using the code below, it seems to correctly exclude all js files (leaving nothing but empty folders in the moment package referenced above):

> npm install
> gulp copy:libs

Using excludes: ['/**/ender.js'] also correctly excludes just that one file.

@dshemendiuk
Copy link
Owner

Using excludes: ['/**/ender.js'] also correctly excludes just that one file.

But it crashes without excludes option

@ajbeaven
Copy link
Author

ajbeaven commented Dec 9, 2019

Works fine on my machine... can you give more details? What error message do you get?

@dshemendiuk
Copy link
Owner

Looks like I have found where the problem was.
Fixed on the latest master.

In truth, I don't like the idea to set up an excludes always with extra asterisks.
But I understand the problem.

@ajbeaven
Copy link
Author

I think it makes a lot more sense. It is unexpected to have the excludes be applied on a per-package basis IMO.

I see the most common use case being that you want to exclude a particular file or set of files in a particular package. With the current iteration, that's not made easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants