treeherder/.neutrinorc.js

163 строки
5.4 KiB
JavaScript
Исходник Обычный вид История

Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
// `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 = {
options: {
source: 'ui/',
mains: {
index: {
entry: 'job-view/index.jsx',
favicon: 'ui/img/tree_open.png',
title: 'Treeherder',
},
logviewer: {
entry: 'logviewer/index.jsx',
favicon: 'ui/img/logviewerIcon.png',
title: 'Treeherder Logviewer',
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
userguide: {
entry: 'userguide/index.jsx',
favicon: 'ui/img/tree_open.png',
title: 'Treeherder User Guide',
},
login: {
entry: 'login-callback/index.jsx',
title: 'Treeherder Login',
},
testview: {
entry: 'test-view/index.jsx',
title: 'Treeherder Test View',
},
pushhealth: {
entry: 'push-health/index.jsx',
title: 'Push Health',
},
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
perf: {
entry: 'entry-perf.js',
template: 'ui/perf.html',
},
'intermittent-failures': {
entry: 'intermittent-failures/index.jsx',
favicon: 'ui/img/tree_open.png',
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
title: 'Intermittent Failures View',
},
},
output: '.build/',
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
tests: 'tests/ui/',
},
use: [
process.env.NODE_ENV === 'development' && [
'@neutrinojs/eslint',
{
eslint: {
// We manage our lint config in .eslintrc.js instead of here.
useEslintrc: true,
},
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
],
[
'@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);
}
},
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
},
// 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/,
},
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
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',
],
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
},
],
[
'@neutrinojs/copy',
{
patterns: ['ui/contribute.json', 'ui/revision.txt', 'ui/robots.txt'],
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
},
],
process.env.NODE_ENV === 'test' && [
'@neutrinojs/jest',
{
setupFilesAfterEnv: ['<rootDir>/tests/ui/unit/test-setup.js'],
// For more info, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1523376#c3
moduleNameMapper: {
// Hawk's browser and Node APIs differ, and taskcluster-client-web uses APIs that
// exist only in the browser version. As such we must force Jest (which runs tests
// under Node, not the browser) to use the browser version of Hawk. See:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1523376#c6
'^hawk$': 'hawk/dist/browser.js',
},
},
],
neutrino => {
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
neutrino.config
.plugin('provide')
.use(require.resolve('webpack/lib/ProvidePlugin'), [
{
// Required since AngularJS and jquery.flot don't import jQuery themselves.
jQuery: 'jquery',
'window.jQuery': 'jquery',
},
]);
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
if (process.env.NODE_ENV === 'production') {
// Fail the build if these file size thresholds (in bytes) are exceeded,
// to help prevent unknowingly regressing the bundle size (bug 1384255).
neutrino.config.performance
.hints('error')
.maxAssetSize(2 * 1024 * 1024)
2019-03-07 03:46:28 +03:00
.maxEntrypointSize(2 * 1024 * 1024);
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216) Neutrino controls our frontend linting, transpilation, source-maps, testing, dev-server and optimisation of production builds. Highlights of the upgrade are: * Major version updates to the individual tools within (such as webpack, Babel and ESLint), significantly improving performance, fixing transpilation/minification correctness bugs, adding support for newer ECMAScript features, and increasing linter coverage. * Hot reloading in the dev server now works for all entry-points and not just the jobs view, shortening the feedback cycle. * Reduced bundle size due to webpack 4's tree shaking, scope hoisting, automatic shared/vendor code chunk splitting (no need for the manually maintained 'vendor' list). * CSS is now extracted out of JS, which improves performance, reduces bundle size and prevents the initial white flash of un-styled content. * Support for dynamic imports/code splitting (needed for bug 1502192). * Support for Jest via a new Jest preset (unblocks bug 1364045). * Support for public class field declarations (unblocks bug 1480166). * Improved source-maps (increases the quality of production exception trace-backs and fixes several debugger breakpoint bugs). * Reduced amount of custom configuration required for our fairly complex frontend needs, reducing maintenance burden and allowing for easier future Neutrino upgrades. In addition this PR: * Fixes the WhiteNoise `immutable_file_test()` regex, so that it now correctly enables browser caching of images, fonts and source maps. * Enables webpack-dev-server's overlay feature, which displays any compilation errors in the browser, saving having to switch back to the console (this can be enabled for warnings too if desired). * Enables webpack-dev-server's automatic browser-opening feature, which saves having to manually navigate to `localhost:5000` after running `yarn start`. * Switches Karma tests to run Firefox in headless mode, reducing the workflow disruption when running `yarn test`. * Uses the new webpack `performance` option to enable maximum asset file size thresholds, to help prevent bundle-size regressions. * Rewrites the `package.json` script commands so that they now work correctly on Windows, even when setting environment variables. Performance comparison: * Local `yarn build`: - Cached: 2m34s -> 23s - Uncached: 2m34s -> 58s * Local `yarn start`: - Cached: 34.5s -> 13.6s - Uncached: 34.5s -> 31.3s * Local `yarn test` - Cached: 61.5s -> 19.8s - Uncached: 61.5s -> 22.0s * Local `yarn lint` - Cached: 3.8s -> 1.8s - Uncached: 13.7s -> 13.4s * Travis end-to-end time: 9 minutes -> 6 minutes * Heroku deploy end-to-end time: 14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
}
},
],
};