-
-
Notifications
You must be signed in to change notification settings - Fork 622
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(generator): using configFile in configPath to get the config file name #883
fix(generator): using configFile in configPath to get the config file name #883
Conversation
Passing {configFile:configFile} to the env.run(generator) as second argument in packages/utils/modify-config.ts and using this property in generator class to get the configPath in generator class constructor in remove-generator.ts
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
const webpackConfigExists = fs.existsSync(configPath); | ||
|
||
if (!webpackConfigExists) { |
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 checking is not required now. what do you think @ematipico ?
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.
@misterdev what about this one ? should I remove this if statement?
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 you are right! We can remove 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.
Hi, seems ok to me, I've left some comments about formatting
Thank you! :)
@@ -32,13 +32,15 @@ export default class RemoveGenerator extends Generator { | |||
webpackOptions: {} | |||
} | |||
}; | |||
|
|||
let configPath = path.resolve(process.cwd(), "webpack.config.js"); | |||
const {configFile} = opts |
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.
Add spaces and ;
const { configFile } = opts;
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.
done 👍
@@ -58,13 +58,14 @@ export default function modifyHelperUtil( | |||
chalk.cyan(configFile + "\n") + | |||
"\n" | |||
); | |||
|
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 this empty line? :)
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.
removed it 👍
@@ -89,8 +90,9 @@ export default function modifyHelperUtil( | |||
} | |||
env.registerStub(generator, generatorName); | |||
|
|||
env.run(generatorName) | |||
.then( | |||
env.run(generatorName,{ |
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.
Add space
env.run(generatorName, {
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.
done 👍
added semicolon in line 35
removed the blank line and added space in env.run method 's second argument.
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.
Some feedback
@@ -32,13 +32,15 @@ export default class RemoveGenerator extends Generator { | |||
webpackOptions: {} | |||
} | |||
}; | |||
|
|||
let configPath = path.resolve(process.cwd(), "webpack.config.js"); | |||
const {configFile} = opts; |
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.
const {configFile} = opts; | |
const { configFile } = opts; |
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.
done 👍
const webpackConfigExists = fs.existsSync(configPath); | ||
|
||
if (!webpackConfigExists) { |
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 you are right! We can remove it
env.run(generatorName) | ||
.then( | ||
env.run(generatorName, { | ||
configFile |
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.
What's this change for?
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.
To pass the config file name to the generator.
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 change is probably ok and needed as we need this to be dynamic. Just gotta check that it works. Change is that the generator will have output of the config file supplied vs webpack.config.js
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.
yes, I used this in my machine and its working fine. This can use workable with the other generators too like the update
one and in add
too
removed the if-statement and added space
@ematipico Please review it again, I made those clean ups |
Changed the init-generator code to fix the entry point issue when the entry point was answered
…ethsaha/webpack-cli into bugfix/init-entry-point-fix
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.
LGTM :)
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.
Neat ✨
Please rebase, we removed node 6 from the CI |
Changed the init-generator code to fix the entry point issue when the entry point was answered
…ethsaha/webpack-cli into bugfix/init-entry-point-fix
…b.com/anikethsaha/webpack-cli into bugfix/configPath-in-remove-generator
@anikethsaha Thanks for your update. I labeled the Pull Request so reviewers will review it again. @anshumanv Please review the new changes. |
PTAL @ematipico |
Passing {configFile:configFile} to the env.run(generator) as second
argument in packages/utils/modify-config-helper.ts and using this property in generator class to get the
configPath in generator class constructor in remove-generator.ts
What kind of change does this PR introduce?
bugfix
Did you add tests for your changes?
No
If relevant, did you update the documentation?
Not required
Summary
Issue link : #882
In order to avoid the
typeError
error while running the remove command when passing the config file name other thanwebpack.config.js
Added a
configFile
property while running the generator frommodify-config-helper.ts
:In order to pass the user's config file name to the generator class and replace the hardcoded
webpack.config.js
to thisDoes this PR introduce a breaking change?
No
Other information
No need of this statement I think
Cause the below statement in
modify-config-helper.ts
will take care of that