Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow to specify files to be excluded in config file #292

Closed
augustl opened this Issue · 17 comments

7 participants

August Lilleaas Brian Cavalier Ben Hale Gili Tzabari Magnus Rundberget Garrick Cheung Daniel Wittner
August Lilleaas
Owner

Example: glob for src/**/*.js but you want to exclude src/debug/**/*.js. This is currently not possible.

August Lilleaas
Owner

One example implementation of this would be to consider strings unnormalized values, that we normalize to an object.

"src/**/*.js"
// gets normalized to...
{includes: "src/**/*.js"}

In other words, the actual list of glob patterns is normalized to a list of objects. This object can support more stuff, like multiple properties includes and excludes.

src: [
   "src/**/*.js", // is normalized to {includes: "src/**/*.js"}
   {excludes: "src/debug/*.js"}
]
August Lilleaas
Owner

Another suggestion:

src: ["src/**/*.js"]

Normalizes to:

src: {includes: ["src/**/*.js"]}

Example with excludes:

src: {includes: ["src/**/*.js"]
      excludes: ["src/wtf.js"]}

That way, includes and excludes are completely separate, and glob patterns are just strings. Also you don't get patterns like {includes: "foo", excludes: "bar"}. Technically speaking it's easy to handle it, but being able to specify it that way makes little sense imo.

Brian Cavalier

:+1: I def have use cases for this. I like the most recent snippet with includes/excludes both as props under a src object (and allowing the normalization to happen automatically for the simple case).

Ben Hale

Another options is to use the syntax that Grunt is using in it's 4.x line:

src: ['src/**/*.js', '!src/debug/*.js']

I'd agree that there's a definite need for this as I suspect many people are currently adding an extra directory level to their test directory simple to exclude buster.js.

Brian Cavalier

I like @nebhale's suggestion of the Grunt-like "!", very compact. In the end, either the explicit includes/excludes props, or the "!" would be cool with me.

August Lilleaas
Owner
Brian Cavalier

@augustl Now I'm wondering if there's potential for confusion, though, if people are tempted to mix "!" and explicit includes/excludes. For example, what would something like the following mean?

src: { includes: '...', excludes: '!**/*-test.js' }

Error? Or to include '*/-test.js'?? Might be kinda head-exploding :)

Ben Hale

Indeed, whether you pick my suggestion or not, I'm of the opinion that there should only be a single way to describe this idea. Requiring your user to make a decision between different syntaxes for the same behavior is likely to lead to confusion.

August Lilleaas
Owner
Ben Hale

@augustl I think you might be confusing behavior with implementation details. My concern is not how it's implemented, it's what options users are presented with.

For example, if you allow a user to do both:

src: {
    includes: ['src/**/*.js'],
    excludes: ['src/wtf.js']
}

and

src: ['src/**/*.js', '!src/wtf.js']

then it is only a matter of time before someone tries:

src: {
    includes: ['!src/**/*.js'],
    excludes: ['src/wtf.js']
}

and who knows what a user should expect that to do.

In the end, my concern isn't how any particular syntax is translated to Buster internals, it's about making sure that users aren't given so many options that they confuse themselves.

August Lilleaas
Owner
August Lilleaas
Owner
Gili Tzabari

I suggest adding:

sources:
{
  includes: [],
  excludes: []
}

and make the current syntax

sources:
[]

an alias for:

sources:
{
  includes: []
}

In other words, don't any "!" magic. If users want to exclude they must use the more verbose syntax.

Magnus Rundberget

:+1: for excludes.

Garrick Cheung

++ for excludes.

Daniel Wittner dwittner was assigned
Daniel Wittner
Owner

Realized by 49079dc and d4bbf10ff5.

You can now do something like that: src: ['src/**/*.js', '!src/debug/*.js']

Daniel Wittner dwittner closed this
Magnus Rundberget

Passed me by that this was implemented. Great stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.