Browse Source

Rename `getWebpackOptions` to `getWebpackConfig`.

v6-dev
Jarid Margolin 8 years ago
parent
commit
09d78db914
  1. 6
      docs/api/README.md
  2. 10
      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'));
```
### `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)`

10
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.

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

@ -44,7 +44,7 @@ module.exports = (neutrino) => {
{
singleRun: !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('..'));
const errors = validate(api.getWebpackOptions());
const errors = validate(api.getWebpackConfig());
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('..'));
const errors = validate(api.getWebpackOptions());
const errors = validate(api.getWebpackConfig());
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('..'));
const errors = validate(api.getWebpackOptions());
const errors = validate(api.getWebpackConfig());
t.is(errors.length, 0);
});

2
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);
}

2
packages/neutrino/src/neutrino.js

@ -58,7 +58,7 @@ class Neutrino extends EventEmitter {
return false;
}
getWebpackOptions() {
getWebpackConfig() {
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');
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: [
{

Loading…
Cancel
Save