-
-
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
Changes from 1 commit
2ca57a2
0b65ba8
e007c45
c395c16
118ac1d
0e762d7
04e7b17
7dc7a74
f8ddc41
737934b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,15 @@ export default class RemoveGenerator extends Generator { | |
webpackOptions: {} | ||
} | ||
}; | ||
|
||
let configPath = path.resolve(process.cwd(), "webpack.config.js"); | ||
const {configFile} = opts | ||
let configPath = path.resolve(process.cwd(), configFile); | ||
const webpackConfigExists = fs.existsSync(configPath); | ||
|
||
if (!webpackConfigExists) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Yeah you are right! We can remove it |
||
configPath = null; | ||
// end the generator stating webpack config not found or to specify the config | ||
} | ||
|
||
this.webpackOptions = require(configPath); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. removed it 👍 |
||
} else { | ||
process.stdout.write( | ||
"\n" + | ||
logSymbols.error + | ||
chalk.red(" ERROR ") + | ||
chalk.cyan(configFile) + | ||
" not found. Please specify a valid path to your webpack config like " + | ||
" not found. Please specify a valid path to your webpack config like \n " + | ||
chalk.white("$ ") + | ||
chalk.cyan(`webpack-cli ${action} webpack.dev.js`) + | ||
"\n" | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Add space
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done 👍 |
||
configFile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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 |
||
}).then( | ||
(): void => { | ||
let configModule: object; | ||
try { | ||
|
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 👍