Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli(add): support for webpack config file (#501)
* cli(add): add support for webpack config * cli(utils): update signature for config helper * chore(deps): add log-symbols * cli: update modify-config-helper usage
- Loading branch information
1 parent
945be4b
commit 295d1e2
Showing
17 changed files
with
945 additions
and
521 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
"use strict"; | ||
|
||
const defaultGenerator = require("@webpack-cli/generators/add-generator"); | ||
const modifyHelper = require("@webpack-cli/utils/modify-config-helper"); | ||
const modifyConfigHelper = require("@webpack-cli/utils/modify-config-helper"); | ||
|
||
/** | ||
* Is called and returns a scaffolding instance, adding properties | ||
* | ||
* @returns {Function} modifyHelper - A helper function that uses the action | ||
* @returns {Function} modifyConfigHelper - A helper function that uses the action | ||
* we're given on a generator | ||
* | ||
*/ | ||
|
||
module.exports = function add() { | ||
return modifyHelper("add", defaultGenerator); | ||
module.exports = function add(...args) { | ||
const DEFAULT_WEBPACK_CONFIG_FILENAME = "webpack.config.js"; | ||
|
||
const filePaths = args.slice(3); | ||
let configFile = DEFAULT_WEBPACK_CONFIG_FILENAME; | ||
if (filePaths.length) { | ||
configFile = filePaths[0]; | ||
} | ||
return modifyConfigHelper("add", defaultGenerator, configFile); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.