Skip to content

Commit

Permalink
cli(add): support for webpack config file (#501)
Browse files Browse the repository at this point in the history
* 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
dhruvdutt authored and evenstensberg committed Jun 12, 2018
1 parent 945be4b commit 295d1e2
Show file tree
Hide file tree
Showing 17 changed files with 945 additions and 521 deletions.
724 changes: 523 additions & 201 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions packages/add/index.js
@@ -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);
};
12 changes: 6 additions & 6 deletions packages/generate-loader/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/generate-plugin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 39 additions & 32 deletions packages/generators/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/info/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/init/index.js
Expand Up @@ -2,7 +2,7 @@

const npmPackagesExists = require("@webpack-cli/utils/npm-packages-exists");
const defaultGenerator = require("@webpack-cli/generators/init-generator");
const modifyHelper = require("@webpack-cli/utils/modify-config-helper");
const modifyConfigHelper = require("@webpack-cli/utils/modify-config-helper");

/**
*
Expand All @@ -19,7 +19,7 @@ module.exports = function initializeInquirer(...args) {
const packages = args.slice(3);

if (packages.length === 0) {
return modifyHelper("init", defaultGenerator);
return modifyConfigHelper("init", defaultGenerator);
}
return npmPackagesExists(packages);
};
36 changes: 18 additions & 18 deletions packages/init/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 295d1e2

Please sign in to comment.