forked from taskcluster/taskcluster-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.neutrinorc.js
More file actions
184 lines (171 loc) · 5.5 KB
/
.neutrinorc.js
File metadata and controls
184 lines (171 loc) · 5.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
const merge = require('deepmerge');
const { ProvidePlugin } = require('webpack');
const { basename, extname } = require('path');
// Increment the version whenever you need a full invalidation
// but hashes could remain the same
const CACHE_VERSION = 'v1';
const envs = {
AUTH0_DOMAIN: 'auth.mozilla.auth0.com',
AUTH0_CLIENT_ID: 'TBD',
AUTH0_AUDIENCE: 'login.taskcluster.net',
SIGN_IN_METHODS: process.env.NODE_ENV === 'development' ? 'development' : 'auth0 manual'
};
// Set environment variables to their default values if not defined
Object
.keys(envs)
.forEach(env => !(env in process.env) && (process.env[env] = envs[env]));
module.exports = {
use: [
['neutrino-preset-mozilla-rpweb', {
eslint: {
baseConfig: {
extends: [
'eslint-config-prettier'
]
},
plugins: ['eslint-plugin-prettier'],
rules: {
'prettier/prettier': ['error', {
singleQuote: true,
trailingComma: 'none',
bracketSpacing: true,
jsxBracketSameLine: true
}],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'never', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
{ blankLine: 'always', prev: '*', next: ['if', 'do', 'for', 'switch', 'try', 'while'] },
{ blankLine: 'always', prev: '*', next: 'return' }
],
'consistent-return': 'off',
'no-unused-expressions': 'off',
'no-shadow': 'off',
'no-return-assign': 'off',
'babel/new-cap': 'off',
'no-mixed-operators': 'off',
'react/jsx-closing-bracket-location': 'off',
'react/jsx-indent': 'off'
}
},
react: {
hot: false,
devServer: {
port: 9000,
historyApiFallback: { disableDotRule: true }
},
html: {
title: 'Taskcluster Tools',
mobile: true,
meta: [
{
name: 'description',
content: `A collection of tools for Taskcluster components and elements in the Taskcluster ecosystem. Here
you'll find tools to manage Taskcluster as well as run, debug, inspect, and view tasks, task groups, and
other Taskcluster related entities.`
},
{
name: 'author',
content: 'Mozilla Taskcluster Team'
}
]
}
}
}],
['neutrino-middleware-env', Object.keys(envs)],
(neutrino) => {
// Fix issue with nested routes e.g /index/garbage
neutrino.config.output.publicPath('/');
neutrino.config.node.set('Buffer', true);
neutrino.config.module
.rule('plain-style')
.test(/\.css$/)
.include
.add(neutrino.options.node_modules).end()
.use('style')
.loader(require.resolve('style-loader'))
.end()
.use('css')
.loader(require.resolve('css-loader'));
neutrino.config.module
.rule('style')
.exclude
.add(neutrino.options.node_modules).end()
.use('css')
.options({ modules: true });
// The JSONStream module's main file has a Node.js shebang
// which Webpack doesn't like loading as JS
neutrino.config.module
.rule('shebang')
.test(/JSONStream/)
.use('shebang')
.loader('shebang-loader');
neutrino.config
.externals(merge(neutrino.config.get('externals'), {
bindings: 'bindings'
}));
// Make variables `$` and `jQuery` available
neutrino.config
.plugin('jquery')
.use(ProvidePlugin, [{
$: 'jquery',
jQuery: 'jquery'
}]);
neutrino.config
.entry('vendor')
.merge([
'babel-polyfill',
'deepmerge',
'lodash.chunk',
'lodash.clonedeep',
'prop-types',
'ramda',
'markdown-it',
'highlight.js',
'moment',
'qs',
'react',
'react-tooltip',
'react-bootstrap',
'react-loadable',
'react-fontawesome',
'react-router-bootstrap',
'slugid',
'react-dom',
'react-helmet',
'react-router-dom',
'taskcluster-client-web'
]);
neutrino.config.when(neutrino.options.command === 'build', (config) => {
config
.output
.filename(`[name].[chunkhash].${CACHE_VERSION}.js`)
.chunkFilename(`[name].[chunkhash].${CACHE_VERSION}.js`)
.end()
.plugin('named-chunks')
.tap(([fn]) => [
chunk => {
if (chunk.name) {
return chunk.name;
}
const filename = fn(chunk);
const ext = extname(filename);
return `${basename(filename, ext)}.${CACHE_VERSION}${ext}`;
}
]);
});
}
],
env: {
NODE_ENV: {
development: ({ config }) => config.devtool('eval-source-map'),
production: ({ config }) => {
config.when(process.env.CI === 'true' && process.env.TRAVIS_BRANCH !== 'master',
(config) => config.devtool(false),
(config) => config.devtool('source-map')
);
}
}
}
};