Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Rename getWebpackOptions to getWebpackConfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaridmargolin committed Mar 19, 2017
1 parent 66fc708 commit 09d78db
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down
10 changes: 5 additions & 5 deletions docs/upgrading-neutrino.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -24,7 +24,7 @@ neutrino.config
neutrino.config
.plugin(name)
.inject((Plugin, args) => new Plugin(...newArgs))

// Modifying plugins in v5
neutrino.config
.plugin(name)
Expand All @@ -42,7 +42,7 @@ neutrino.config.module
plugins: ['object-rest-spread']
}
});

// Creating loaders in v5
neutrino.config
.rule('compile')
Expand All @@ -63,7 +63,7 @@ neutrino.config.module
plugins: ['object-rest-spread']
}
}));

// Modifying loaders in v5
neutrino.config.module
.rule('compile')
Expand Down Expand Up @@ -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 changes: 1 addition & 1 deletion packages/neutrino-preset-karma/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = (neutrino) => {
{
singleRun: !watch,
autoWatch: watch,
webpack: neutrino.getWebpackOptions()
webpack: neutrino.getWebpackConfig()
}
]);

Expand Down
2 changes: 1 addition & 1 deletion packages/neutrino-preset-node/test/web_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion packages/neutrino-preset-react/test/web_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion packages/neutrino-preset-web/test/web_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 1 addition & 1 deletion packages/neutrino/bin/neutrino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/neutrino/src/neutrino.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Neutrino extends EventEmitter {
return false;
}

getWebpackOptions() {
getWebpackConfig() {
return this.config.toConfig();
}

Expand Down
4 changes: 2 additions & 2 deletions packages/neutrino/test/api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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: [
{
Expand Down

0 comments on commit 09d78db

Please sign in to comment.