diff --git a/docs/api/README.md b/docs/api/README.md index ac8d724..730b18e 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -289,14 +289,14 @@ api .then(() => console.log('all passed')); ``` -### `getWebpackOptions()` +### `getWebpackConfig()` While tools like webpack-chain provide a convenient API for creating Webpack configurations, this is not a format that -is understandable by Webpack. With `getWebpackOptions()`, the webpack-chain instance at `.config` will be converted to +is understandable by Webpack. With `getWebpackConfig()`, the webpack-chain instance at `.config` will be converted to an configuration object readable directly by Webpack. ```js -api.getWebpackOptions(); // -> { ... } +api.getWebpackConfig(); // -> { ... } ``` ### `emitForAll(eventName, payload)` diff --git a/docs/upgrading-neutrino.md b/docs/upgrading-neutrino.md index 8041ed1..aeefd12 100644 --- a/docs/upgrading-neutrino.md +++ b/docs/upgrading-neutrino.md @@ -10,7 +10,7 @@ to v5, be sure to check this list for tasks you may need to perform to use this neutrino.config .plugin(name) .use(WebpackPlugin, ...args) - + // Creating plugins in v5 neutrino.config .plugin(name) @@ -24,7 +24,7 @@ neutrino.config neutrino.config .plugin(name) .inject((Plugin, args) => new Plugin(...newArgs)) - + // Modifying plugins in v5 neutrino.config .plugin(name) @@ -42,7 +42,7 @@ neutrino.config.module plugins: ['object-rest-spread'] } }); - + // Creating loaders in v5 neutrino.config .rule('compile') @@ -63,7 +63,7 @@ neutrino.config.module plugins: ['object-rest-spread'] } })); - + // Modifying loaders in v5 neutrino.config.module .rule('compile') @@ -207,7 +207,7 @@ api.use(require('neutrino-preset-node')); api.use(require('neutrino.preset-mocha')); ``` -- `neutrino.getWebpackOptions()` no longer caches the configuration after being called. +- `neutrino.getWebpackOptions()` has been renamed to `neutrino.getWebpackConfig()` and no longer caches the configuration after being called. - Using a `node` target no longer skips the watcher for a builder, it now uses the Webpack source watcher. This means commands like `neutrino start && node build` is obsolete. `neutrino build && node build` would work to start a Node instance for production-built bundles. diff --git a/packages/neutrino-preset-karma/index.js b/packages/neutrino-preset-karma/index.js index 52a0a85..a87251f 100644 --- a/packages/neutrino-preset-karma/index.js +++ b/packages/neutrino-preset-karma/index.js @@ -44,7 +44,7 @@ module.exports = (neutrino) => { { singleRun: !watch, autoWatch: watch, - webpack: neutrino.getWebpackOptions() + webpack: neutrino.getWebpackConfig() } ]); diff --git a/packages/neutrino-preset-node/test/web_test.js b/packages/neutrino-preset-node/test/web_test.js index eb5f858..0ad9b60 100644 --- a/packages/neutrino-preset-node/test/web_test.js +++ b/packages/neutrino-preset-node/test/web_test.js @@ -17,7 +17,7 @@ test('valid preset', t => { api.use(require('..')); - const errors = validate(api.getWebpackOptions()); + const errors = validate(api.getWebpackConfig()); t.is(errors.length, 0); }); diff --git a/packages/neutrino-preset-react/test/web_test.js b/packages/neutrino-preset-react/test/web_test.js index eb5f858..0ad9b60 100644 --- a/packages/neutrino-preset-react/test/web_test.js +++ b/packages/neutrino-preset-react/test/web_test.js @@ -17,7 +17,7 @@ test('valid preset', t => { api.use(require('..')); - const errors = validate(api.getWebpackOptions()); + const errors = validate(api.getWebpackConfig()); t.is(errors.length, 0); }); diff --git a/packages/neutrino-preset-web/test/web_test.js b/packages/neutrino-preset-web/test/web_test.js index 9d102f1..2b3702d 100644 --- a/packages/neutrino-preset-web/test/web_test.js +++ b/packages/neutrino-preset-web/test/web_test.js @@ -17,7 +17,7 @@ test('valid preset', t => { api.use(require('..')); - const errors = validate(api.getWebpackOptions()); + const errors = validate(api.getWebpackConfig()); t.is(errors.length, 0); }); diff --git a/packages/neutrino/bin/neutrino b/packages/neutrino/bin/neutrino index 2dacdfc..f74872c 100755 --- a/packages/neutrino/bin/neutrino +++ b/packages/neutrino/bin/neutrino @@ -68,7 +68,7 @@ function run(command, args) { api.use(() => api.config.merge(config)); return args.inspect ? - inspect(api.getWebpackOptions()) : + inspect(api.getWebpackConfig()) : api[command](args); } diff --git a/packages/neutrino/src/neutrino.js b/packages/neutrino/src/neutrino.js index 3f7302b..9f1d40e 100644 --- a/packages/neutrino/src/neutrino.js +++ b/packages/neutrino/src/neutrino.js @@ -58,7 +58,7 @@ class Neutrino extends EventEmitter { return false; } - getWebpackOptions() { + getWebpackConfig() { return this.config.toConfig(); } diff --git a/packages/neutrino/test/api_test.js b/packages/neutrino/test/api_test.js index 6a5792d..ffa5735 100644 --- a/packages/neutrino/test/api_test.js +++ b/packages/neutrino/test/api_test.js @@ -91,7 +91,7 @@ test('import middleware for use', t => { api.import('fixtures/middleware'); - t.notDeepEqual(api.getWebpackOptions(), {}); + t.notDeepEqual(api.getWebpackConfig(), {}); }); test('command sets correct NODE_ENV', t => { @@ -136,7 +136,7 @@ test('creates a Webpack config', t => { .options({ alpha: 'a', beta: 'b' }); }); - t.deepEqual(api.getWebpackOptions(), { + t.deepEqual(api.getWebpackConfig(), { module: { rules: [ {