-
Notifications
You must be signed in to change notification settings - Fork 213
Morph Neutrino API and CLI into middleware injectors for external CLI tools #852
Changes from all commits
fc38592
ae11719
0532607
78eca7d
f82fddd
05591d1
1ab5f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
const { Neutrino } = require('./packages/neutrino'); | ||
const neutrino = require('./packages/neutrino'); | ||
|
||
module.exports = Neutrino({ root: __dirname }) | ||
.use('.neutrinorc.js') | ||
.call('eslintrc'); | ||
module.exports = neutrino(require('./.neutrinorc')).eslintrc(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
const { Neutrino } = require('../neutrino'); | ||
const neutrino = require('../neutrino'); | ||
|
||
module.exports = Neutrino({ cwd: __dirname }) | ||
.use(require('.')) // eslint-disable-line global-require | ||
.call('eslintrc'); | ||
module.exports = neutrino(require('.')).eslintrc(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
const { Neutrino } = require('../neutrino'); | ||
const neutrino = require('../neutrino'); | ||
|
||
module.exports = Neutrino({ cwd: __dirname }) | ||
.use(require('.')) // eslint-disable-line global-require | ||
.call('eslintrc'); | ||
module.exports = neutrino(require('.')).eslintrc(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
const babelMerge = require('babel-merge'); | ||
|
||
module.exports = (neutrino, options = {}) => neutrino.config.module | ||
.rule(options.ruleId || 'compile') | ||
module.exports = (neutrino, options = {}) => { | ||
neutrino.config.module | ||
.rule(options.ruleId || 'compile') | ||
.test(options.test || neutrino.regexFromExtensions()) | ||
.when(options.include, rule => rule.include.merge(options.include)) | ||
.when(options.exclude, rule => rule.exclude.merge(options.exclude)) | ||
.use(options.useId || 'babel') | ||
.loader(require.resolve('babel-loader')) | ||
.options({ | ||
cacheDirectory: true, | ||
babelrc: false, | ||
...(options.babel || {}) | ||
}); | ||
.loader(require.resolve('babel-loader')) | ||
.options({ | ||
cacheDirectory: true, | ||
babelrc: false, | ||
...(options.babel || {}) | ||
}); | ||
|
||
neutrino.register('babel', (neutrino, override) => override( | ||
neutrino.config.module | ||
.rule('compile') | ||
.use('babel') | ||
.get('options') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to filter out |
||
)); | ||
}; | ||
|
||
module.exports.merge = babelMerge; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,10 @@ | |
"dependencies": { | ||
"@babel/core": "^7.0.0-beta.46", | ||
"babel-loader": "^8.0.0-beta.2", | ||
"babel-merge": "^1.1.1", | ||
"webpack": "^4.7.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move this to peerDependencies rather than removing it? Perhaps it might just be easier to add the webpack peer dep to every single Neutrino package to save having to think about it? (And to make it 200% clear to people using Neutrino what version of webpack we support.) All presets have to be used with Neutrino, which already has a peer dep on webpack, so won't really affect whether people see warnings or not. (Though the jest preset doesn't technically require it I suppose..) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some people have voiced their want to use Neutrino middleware to test or lint things without actually building, so I would want to only provide it where necessary, if possible. I think the reason clean keeps it is because the webpack plugin also peerDeps on webpack. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case |
||
"babel-merge": "^1.1.1" | ||
}, | ||
"peerDependencies": { | ||
"neutrino": "^8.0.0" | ||
"neutrino": "^8.0.0", | ||
"webpack": "^4.0.0" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate PR? :-)