Browse Source

Rename `getWebpackOptions` to `getWebpackConfig`.

v6-dev
Jarid Margolin 8 years ago
parent
commit
09d78db914
  1. 6
      docs/api/README.md
  2. 2
      docs/upgrading-neutrino.md
  3. 2
      packages/neutrino-preset-karma/index.js
  4. 2
      packages/neutrino-preset-node/test/web_test.js
  5. 2
      packages/neutrino-preset-react/test/web_test.js
  6. 2
      packages/neutrino-preset-web/test/web_test.js
  7. 2
      packages/neutrino/bin/neutrino
  8. 2
      packages/neutrino/src/neutrino.js
  9. 4
      packages/neutrino/test/api_test.js

6
docs/api/README.md

@ -289,14 +289,14 @@ api
.then(() => console.log('all passed')); .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 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. an configuration object readable directly by Webpack.
```js ```js
api.getWebpackOptions(); // -> { ... } api.getWebpackConfig(); // -> { ... }
``` ```
### `emitForAll(eventName, payload)` ### `emitForAll(eventName, payload)`

2
docs/upgrading-neutrino.md

@ -207,7 +207,7 @@ api.use(require('neutrino-preset-node'));
api.use(require('neutrino.preset-mocha')); 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 - 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 commands like `neutrino start && node build` is obsolete. `neutrino build && node build` would work to start a Node
instance for production-built bundles. instance for production-built bundles.

2
packages/neutrino-preset-karma/index.js

@ -44,7 +44,7 @@ module.exports = (neutrino) => {
{ {
singleRun: !watch, singleRun: !watch,
autoWatch: watch, autoWatch: watch,
webpack: neutrino.getWebpackOptions() webpack: neutrino.getWebpackConfig()
} }
]); ]);

2
packages/neutrino-preset-node/test/web_test.js

@ -17,7 +17,7 @@ test('valid preset', t => {
api.use(require('..')); api.use(require('..'));
const errors = validate(api.getWebpackOptions()); const errors = validate(api.getWebpackConfig());
t.is(errors.length, 0); t.is(errors.length, 0);
}); });

2
packages/neutrino-preset-react/test/web_test.js

@ -17,7 +17,7 @@ test('valid preset', t => {
api.use(require('..')); api.use(require('..'));
const errors = validate(api.getWebpackOptions()); const errors = validate(api.getWebpackConfig());
t.is(errors.length, 0); t.is(errors.length, 0);
}); });

2
packages/neutrino-preset-web/test/web_test.js

@ -17,7 +17,7 @@ test('valid preset', t => {
api.use(require('..')); api.use(require('..'));
const errors = validate(api.getWebpackOptions()); const errors = validate(api.getWebpackConfig());
t.is(errors.length, 0); t.is(errors.length, 0);
}); });

2
packages/neutrino/bin/neutrino

@ -68,7 +68,7 @@ function run(command, args) {
api.use(() => api.config.merge(config)); api.use(() => api.config.merge(config));
return args.inspect ? return args.inspect ?
inspect(api.getWebpackOptions()) : inspect(api.getWebpackConfig()) :
api[command](args); api[command](args);
} }

2
packages/neutrino/src/neutrino.js

@ -58,7 +58,7 @@ class Neutrino extends EventEmitter {
return false; return false;
} }
getWebpackOptions() { getWebpackConfig() {
return this.config.toConfig(); return this.config.toConfig();
} }

4
packages/neutrino/test/api_test.js

@ -91,7 +91,7 @@ test('import middleware for use', t => {
api.import('fixtures/middleware'); api.import('fixtures/middleware');
t.notDeepEqual(api.getWebpackOptions(), {}); t.notDeepEqual(api.getWebpackConfig(), {});
}); });
test('command sets correct NODE_ENV', t => { test('command sets correct NODE_ENV', t => {
@ -136,7 +136,7 @@ test('creates a Webpack config', t => {
.options({ alpha: 'a', beta: 'b' }); .options({ alpha: 'a', beta: 'b' });
}); });
t.deepEqual(api.getWebpackOptions(), { t.deepEqual(api.getWebpackConfig(), {
module: { module: {
rules: [ rules: [
{ {

Loading…
Cancel
Save