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
--copy-ignored flag added to CLI #10887
Conversation
rajasekarm
commented
Dec 18, 2019
Q | A |
---|---|
Fixed Issues? | Fixes #6226 |
Patch: Bug Fix? | |
Major: Breaking Change? | |
Minor: New Feature? | Yes |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
Reviews at #10831 |
packages/babel-cli/src/babel/dir.js
Outdated
if ( | ||
!written && | ||
((!isCompilableExtension && cliOptions.copyFiles) || | ||
cliOptions.includeIgnored) |
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.
I think we should throw in parseArgv
when copyFiles: false, includeIgnored: true
, otherwise we will have another flag that could copy non compilable files.
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.
🚲🏠 warning:
Should we call it --copy-ignored
? 😝
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.
Changed to --copy-ignored
@@ -0,0 +1,12 @@ | |||
{ | |||
"args": [ |
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.
Can you add a test for --only
?
babel src --out-dir lib --copy-files --only src/main/* --include-ignored
and a test when --include-ignored
is not enabled (default of v7.8), so that we can make sure the old behaviour preserves.
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.
Is this still needed?
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.
Good to have.😀
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.
I'm throwing error if |
@@ -1 +0,0 @@ | |||
a; |
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.
🤔Why is .foo.js
not copied?
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.
we've --include-dotfile to Include dotfiles when compiling and copying non-compilable files.
https://github.com/rajasekarm/babel/blob/master/packages/babel-cli/src/babel/options.js#L148
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.
Yeah, it was copied before this PR. But now .foo.js has been removed from the out files, which means it is not copied.
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.
I got it, I'll check.
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.
I've that file in my branch, https://github.com/rajasekarm/babel/blob/master/packages/babel-cli/test/fixtures/babel/--copy-files%20--include-dotfiles%20with%20ignore/out-files/lib/foo/.foo.js
I dono why github shows this as removed.
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.
The linked one is your master branch, not the PR branch 😛
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.
Yeah, I'm check this.
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.
Found the root cause of this bug, I'm fixing it.
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.
.foo.js is inside src/foo and it is in ignored list. So it is not copied.
I've exposed pathToPattern function from @babel/core for the ignore file check. |
I have bad news for you 😛 |
Sure, I'll make the change. |
@nicolo-ribaudo Done 👍 |
(I need to review this PR again)
I was looking at the
If we make the |
@nicolo-ribaudo I made the requested change. Can you please check? |
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.
The code now looks way cleaner!