Skip to content

Commit f4973ec

Browse files
helfi92owlishDeveloper
authored andcommitted
Migrate to neutrino v9 (taskcluster#47)
* Migrate to neutrino v9 * Remove usage of neutrino-preset-mozilla-frontend-infra * Regenerate yarn.lock
1 parent a22603e commit f4973ec

10 files changed

+2381
-6485
lines changed

services/web-server/.eslintrc.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const { Neutrino } = require('neutrino');
1+
const neutrino = require('neutrino');
22

3-
module.exports = Neutrino({ root: __dirname })
4-
.use('.neutrinorc')
5-
.call('eslintrc');
3+
module.exports = neutrino().eslintrc();

services/web-server/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
.env
66
.idea
77
user-config.yml
8+
.eslintcache

services/web-server/.neutrinorc.js

+44-23
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
11
module.exports = {
22
use: [
3-
['neutrino-preset-mozilla-frontend-infra/node', {
4-
hot: false,
5-
babel: {
6-
plugins: [
7-
require.resolve('babel-plugin-transform-object-rest-spread'),
8-
],
9-
},
3+
['@neutrinojs/airbnb-base', {
104
eslint: {
5+
baseConfig: {
6+
extends: ['eslint-config-prettier'],
7+
},
8+
plugins: ['eslint-plugin-prettier'],
119
rules: {
12-
'no-nested-ternary': 'off',
10+
'no-nested-ternary': 0,
11+
// Specify the maximum length of a line in your program
12+
'max-len': [
13+
'error',
14+
80,
15+
2,
16+
{
17+
ignoreUrls: true,
18+
ignoreComments: false,
19+
ignoreStrings: true,
20+
ignoreTemplateLiterals: true,
21+
},
22+
],
23+
// Allow console during development, otherwise throw an error
24+
'no-console': process.env.NODE_ENV === 'development' ? 'off' : 'error',
25+
// Our frontend strives to adopt functional programming practices,
26+
// so we prefer const over let
27+
'prefer-const': 'error',
28+
'prettier/prettier': [
29+
'error',
30+
{
31+
singleQuote: true,
32+
trailingComma: 'es5',
33+
bracketSpacing: true,
34+
jsxBracketSameLine: true,
35+
},
36+
],
37+
'class-methods-use-this': 'off',
38+
'no-shadow': 'off',
39+
'babel/new-cap': 'off',
1340
},
1441
},
1542
}],
16-
// replace start-server with restart-server
17-
(neutrino) => {
18-
neutrino.config.when(neutrino.options.command === 'start', config => {
19-
config.plugins.delete('start-server');
20-
neutrino.use(['neutrino-middleware-restart-server', {
21-
name: 'index.js',
22-
}]);
23-
});
24-
},
43+
['@neutrinojs/node', {
44+
hot: false,
45+
babel: {
46+
plugins: [
47+
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
48+
require.resolve('@babel/plugin-proposal-class-properties'),
49+
]
50+
},
51+
}],
2552
(neutrino) => {
2653
neutrino.config.module
2754
.rule('graphql')
2855
.test(/\.graphql$/)
2956
.use('raw')
3057
.loader(require.resolve('raw-loader'));
3158
},
32-
// work around https://bugzilla.mozilla.org/show_bug.cgi?id=1489273
33-
(neutrino) => {
34-
neutrino.config.when(neutrino.options.command === 'build', config => {
35-
config.plugins.delete('named-chunks');
36-
});
37-
},
3859
'@neutrinojs/mocha'
3960
],
4061
};

services/web-server/mocha.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
2+
3+
require('neutrino')().mocha();

services/web-server/package.json

+18-10
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@
66
"author": "Eli Perelman <[email protected]>",
77
"license": "MPL-2.0",
88
"scripts": {
9-
"build": "neutrino build",
10-
"start": "neutrino start",
11-
"lint": "neutrino lint",
12-
"precommit": "neutrino stage",
13-
"test": "neutrino test"
9+
"build": "webpack --mode production",
10+
"start": "webpack --watch --mode development",
11+
"lint": "eslint --cache --format codeframe --ext mjs,js src test",
12+
"test": "mocha --require mocha.config.js --recursive"
1413
},
1514
"devDependencies": {
16-
"@neutrinojs/mocha": "^8.3.0",
17-
"neutrino": "^8.2.1",
18-
"neutrino-preset-mozilla-frontend-infra": "^4.1.0",
19-
"raw-loader": "^0.5.1"
15+
"@babel/plugin-proposal-class-properties": "^7.1.0",
16+
"@babel/plugin-proposal-decorators": "^7.1.2",
17+
"@neutrinojs/airbnb-base": "^9.0.0-beta.0",
18+
"@neutrinojs/mocha": "^9.0.0-beta.0",
19+
"eslint": "^5.6.1",
20+
"eslint-config-prettier": "^3.1.0",
21+
"eslint-plugin-prettier": "^3.0.0",
22+
"mocha": "^5.2.0",
23+
"neutrino": "^9.0.0-beta.0",
24+
"prettier": "^1.14.3",
25+
"raw-loader": "^0.5.1",
26+
"webpack": "^4.20.2",
27+
"webpack-cli": "^3.1.2"
2028
},
2129
"dependencies": {
30+
"@neutrinojs/node": "^9.0.0-beta.0",
2231
"amqp-match": "^0.0.0",
2332
"apollo-server-express": "^1.3.4",
2433
"async-decorators": "^0.1.5",
@@ -39,7 +48,6 @@
3948
"graphql-validation-complexity": "^0.2.3",
4049
"immutable": "^3.8.2",
4150
"iterall": "^1.2.2",
42-
"neutrino-middleware-restart-server": "^1.0.1",
4351
"passport": "^0.4.0",
4452
"passport-github": "^1.1.0",
4553
"ramda": "^0.25.0",

services/web-server/src/createContext.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export default ({ pulseEngine, rootUrl }) => ({ request, connection }) => {
1717
clients: currentClients,
1818
loaders: currentLoaders,
1919
};
20-
} else if (connection) {
20+
}
21+
22+
if (connection) {
2123
// if connection is set, this is for a subscription
2224
return {
2325
pulseEngine,

services/web-server/src/resolvers/Hooks.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export default {
33
__resolveType(obj) {
44
if (obj.taskId) {
55
return 'HookSuccessfulFire';
6-
} else if (obj.error) {
6+
}
7+
8+
if (obj.error) {
79
return 'HookFailedFire';
810
}
911

services/web-server/test/simple_test.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ describe('simple', () => {
55
assert.equal(true, !false);
66
});
77
});
8-

services/web-server/webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const neutrino = require('neutrino');
2+
3+
module.exports = neutrino().webpack();

0 commit comments

Comments
 (0)