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

srcBase isn't working #12

Open
tandrewnichols opened this issue Sep 30, 2014 · 0 comments
Open

srcBase isn't working #12

tandrewnichols opened this issue Sep 30, 2014 · 0 comments

Comments

@tandrewnichols
Copy link

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?

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

No branches or pull requests

1 participant