Skip to content

srcBase isn't working #12

Description

@tandrewnichols

Maybe I'm misunderstanding the readme, but when I do:

globule.match(["*.js"], ["/foo/bar/baz.js"], { srcBase: "/foo/bar" });

I'm expecting to get back ["/foo/bar/baz.js"], but I get []. If I add matchBase: true, I get that, but then nested directories also get included, which I don't want.

My real use case is this:

var match = function(dir, patterns, files) {
  return globule.match(patterns, files, { srcBase: dir, matchBase: true }); 
};

where files is:

[ '/Users/AndrewNichols/code/anichols/manta/file-manifest/test/fixtures/bar.js',
     '/Users/AndrewNichols/code/anichols/manta/file-manifest/test/fixtures/foo.js',
     '/Users/AndrewNichols/code/anichols/manta/file-manifest/test/fixtures/baz/quux.js' ]

and patterns is:

[ '*.js' ]

and dir is: '/Users/AndrewNichols/code/anichols/manta/file-manifest/test/fixtures'.

With matchBase, I get all 3 files back (expected), but if I take it off, I get none. How do I actually get all files matching *.js but not **/*.js in the srcBase?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions