AvianFlu / ncp

Asynchronous recursive file copying with Node.js.
MIT License
680 stars 103 forks source link

Filter not working as expected #119

Open Arwid opened 7 years ago

Arwid commented 7 years ago

Thank you for this useful tool! Here's one issue I came across:

Problem I expected this to work:

ncp 'public/', '.tmp',
    filter: new RegExp "/assets/(css|js)($|\/)"

But the filter seems to also be used to decide which directories to go into

public: # doesn't match regex, so the following tree isn't looked at:
- public/assets
- public/assets/css 
- public/assets/css/app.css # should match filter but it never gets here

Suggestion Don't prune by using filter to decide which directories to go into. Only test filenames, as mentioned in the readme. Or add a note about this limitation.

simonseyock commented 5 years ago

Hey i solved this with new RegExp("/assets(/(css|js)($|\/)|$)")