зеркало из https://github.com/mozilla/treeherder.git
migration changes
This commit is contained in:
Родитель
0a7e145bf5
Коммит
71dd55a873
140
.neutrinorc.js
140
.neutrinorc.js
|
@ -1,9 +1,11 @@
|
|||
const eslint = require('@neutrinojs/eslint');
|
||||
const react = require('@neutrinojs/react');
|
||||
const copy = require('@neutrinojs/copy');
|
||||
const jest = require('@neutrinojs/jest');
|
||||
|
||||
// This is the configuration file for Neutrino, which configures webpack and Jest:
|
||||
// https://neutrinojs.org
|
||||
|
||||
// `use strict` is still necessary here since this file is not treated as a module.
|
||||
'use strict'; // eslint-disable-line strict, lines-around-directive
|
||||
|
||||
const BACKEND = process.env.BACKEND || 'https://treeherder.mozilla.org';
|
||||
|
||||
module.exports = {
|
||||
|
@ -51,85 +53,76 @@ module.exports = {
|
|||
tests: 'tests/ui/',
|
||||
},
|
||||
use: [
|
||||
process.env.NODE_ENV === 'development' && [
|
||||
'@neutrinojs/eslint',
|
||||
{
|
||||
process.env.NODE_ENV === 'development' &&
|
||||
eslint({
|
||||
eslint: {
|
||||
// We manage our lint config in .eslintrc.js instead of here.
|
||||
useEslintrc: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'@neutrinojs/react',
|
||||
{
|
||||
devServer: {
|
||||
historyApiFallback: false,
|
||||
open: !process.env.MOZ_HEADLESS,
|
||||
proxy: {
|
||||
// Proxy any paths not recognised by webpack to the specified backend.
|
||||
'*': {
|
||||
changeOrigin: true,
|
||||
headers: {
|
||||
// Prevent Django CSRF errors, whilst still making it clear
|
||||
// that the requests were from local development.
|
||||
referer: `${BACKEND}/webpack-dev-server`,
|
||||
},
|
||||
target: BACKEND,
|
||||
onProxyRes: proxyRes => {
|
||||
// Strip the cookie `secure` attribute, otherwise production's cookies
|
||||
// will be rejected by the browser when using non-HTTPS localhost:
|
||||
// https://github.com/nodejitsu/node-http-proxy/pull/1166
|
||||
const removeSecure = str => str.replace(/; secure/i, '');
|
||||
const cookieHeader = proxyRes.headers['set-cookie'];
|
||||
if (cookieHeader) {
|
||||
proxyRes.headers['set-cookie'] = Array.isArray(cookieHeader)
|
||||
? cookieHeader.map(removeSecure)
|
||||
: removeSecure(cookieHeader);
|
||||
}
|
||||
},
|
||||
}),
|
||||
react({
|
||||
devServer: {
|
||||
historyApiFallback: false,
|
||||
open: !process.env.MOZ_HEADLESS,
|
||||
proxy: {
|
||||
// Proxy any paths not recognised by webpack to the specified backend.
|
||||
'*': {
|
||||
changeOrigin: true,
|
||||
headers: {
|
||||
// Prevent Django CSRF errors, whilst still making it clear
|
||||
// that the requests were from local development.
|
||||
referer: `${BACKEND}/webpack-dev-server`,
|
||||
},
|
||||
target: BACKEND,
|
||||
onProxyRes: proxyRes => {
|
||||
// Strip the cookie `secure` attribute, otherwise production's cookies
|
||||
// will be rejected by the browser when using non-HTTPS localhost:
|
||||
// https://github.com/nodejitsu/node-http-proxy/pull/1166
|
||||
const removeSecure = str => str.replace(/; secure/i, '');
|
||||
const cookieHeader = proxyRes.headers['set-cookie'];
|
||||
if (cookieHeader) {
|
||||
proxyRes.headers['set-cookie'] = Array.isArray(cookieHeader)
|
||||
? cookieHeader.map(removeSecure)
|
||||
: removeSecure(cookieHeader);
|
||||
}
|
||||
},
|
||||
},
|
||||
// Inside Vagrant filesystem watching has to be performed using polling mode,
|
||||
// since inotify doesn't work with Virtualbox shared folders.
|
||||
watchOptions: process.env.USE_WATCH_POLLING && {
|
||||
// Poll only once a second and ignore the node_modules folder to keep CPU usage down.
|
||||
poll: 1000,
|
||||
ignored: /node_modules/,
|
||||
},
|
||||
},
|
||||
devtool: {
|
||||
// Enable source maps for `yarn build` too (but not on CI, since it doubles build times).
|
||||
production: process.env.CI ? false : 'source-map',
|
||||
},
|
||||
html: {
|
||||
// Disable the default viewport meta tag, since Treeherder doesn't work well at
|
||||
// small viewport sizes, so shouldn't use `width=device-width` (see bug 1505417).
|
||||
meta: false,
|
||||
},
|
||||
style: {
|
||||
// Disable Neutrino's CSS modules support, since we don't use it.
|
||||
modules: false,
|
||||
},
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 1 Chrome versions',
|
||||
'last 1 Edge versions',
|
||||
'last 1 Firefox versions',
|
||||
'last 1 Safari versions',
|
||||
],
|
||||
// Inside Vagrant filesystem watching has to be performed using polling mode,
|
||||
// since inotify doesn't work with Virtualbox shared folders.
|
||||
watchOptions: process.env.USE_WATCH_POLLING && {
|
||||
// Poll only once a second and ignore the node_modules folder to keep CPU usage down.
|
||||
poll: 1000,
|
||||
ignored: /node_modules/,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'@neutrinojs/copy',
|
||||
{
|
||||
patterns: ['ui/contribute.json', 'ui/revision.txt', 'ui/robots.txt'],
|
||||
devtool: {
|
||||
// Enable source maps for `yarn build` too (but not on CI, since it doubles build times).
|
||||
production: process.env.CI ? false : 'source-map',
|
||||
},
|
||||
],
|
||||
process.env.NODE_ENV === 'test' && [
|
||||
'@neutrinojs/jest',
|
||||
{
|
||||
html: {
|
||||
// Disable the default viewport meta tag, since Treeherder doesn't work well at
|
||||
// small viewport sizes, so shouldn't use `width=device-width` (see bug 1505417).
|
||||
meta: false,
|
||||
},
|
||||
style: {
|
||||
// Disable Neutrino's CSS modules support, since we don't use it.
|
||||
modules: false,
|
||||
},
|
||||
targets: {
|
||||
browsers: [
|
||||
'last 1 Chrome versions',
|
||||
'last 1 Edge versions',
|
||||
'last 1 Firefox versions',
|
||||
'last 1 Safari versions',
|
||||
],
|
||||
},
|
||||
}),
|
||||
copy({
|
||||
patterns: ['ui/contribute.json', 'ui/revision.txt', 'ui/robots.txt'],
|
||||
}),
|
||||
process.env.NODE_ENV === 'test' &&
|
||||
jest({
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/ui/unit/test-setup.js'],
|
||||
// For more info, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1523376#c3
|
||||
moduleNameMapper: {
|
||||
|
@ -139,8 +132,7 @@ module.exports = {
|
|||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1523376#c6
|
||||
'^hawk$': 'hawk/dist/browser.js',
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
neutrino => {
|
||||
neutrino.config
|
||||
.plugin('provide')
|
||||
|
|
|
@ -73,11 +73,11 @@
|
|||
"taskcluster-client-web": "8.1.1",
|
||||
"taskcluster-lib-scopes": "10.0.2",
|
||||
"webpack": "4.30.0",
|
||||
"webpack-cli": "3.3.2"
|
||||
"webpack-cli": "3.3.2",
|
||||
"@neutrinojs/eslint": "9.0.0-rc.1",
|
||||
"@neutrinojs/jest": "9.0.0-rc.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@neutrinojs/eslint": "9.0.0-rc.1",
|
||||
"@neutrinojs/jest": "9.0.0-rc.1",
|
||||
"enzyme": "3.9.0",
|
||||
"enzyme-adapter-react-16": "1.12.1",
|
||||
"eslint": "5.16.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче