-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fix recursive bugs #92
Conversation
Thanks for working on this. Would you be able to add some tests for the bugs being fixed? |
✅ |
Sure |
let collection = []; | ||
for (const pattern of patterns) { | ||
collection = [...collection, ...micromatch.braces(pattern, { | ||
expand: true, | ||
nodupes: true, | ||
})]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a good place to use Array#flatMap
.
return path.join(options.cwd, destination, path.basename(entry.pattern.originalPath), path.relative(entry.pattern.originalPath, entry.path)); | ||
} | ||
|
||
if (!entry.pattern.isDirectory && entry.path === entry.relativePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a short code comment on both of these if
's on what kind of case they handle.
Bump :) |
It seems this PR introduces a regression. Following is a snippet from the PR original content. Recreate old parents: trueExample directory structure:
Old:
New:
Output:
How should I have the same output as previous Old: cpy('.github/**/*.yml', 'dest', {parents: true}) Old Output:
New: cpy('.github/**/*.yaml', 'dest') New Output:
|
This PR fixes 5 bugs:
recursive
mode #91This issue can be closed too:
globby.generateGlobTasks
#30This PR completes my work on recursive feature
I'm also attaching a small migration guide bellow.
Can I get
hacktoberfest-accepted
label on this?Breaking changes & examples
Recursive by default
parents
option was removedflat: true
optionExample directory structure:
Command:
cpy('.github/**', 'dest')
Old output:
New output:
Recreate old
parents: true
Example directory structure:
Old:
cpy('.github/**', 'dest', {parents: true})
New:
cpy('.github', 'dest')
Output:
Recreate old
parents: false
Example directory structure:
Old:
cpy('.github/**', 'dest', {parents: false})
New:
cpy('.github', 'dest', {flat: true})
Output:
Copy all package.json and preserve folder structure
Old:
cpy('node_modules/**/package.json', 'dest', {parents: true})
Old output:
New:
cpy('node_modules/**/package.json', 'dest')
New output: