Replace piping with nodemon for hot-reloading (#11432)

* Replace piping with nodemon for hot-reloading

* Fix nodemon version prefixing

Co-authored-by: Mathieu Pillard <mpillard@mozilla.com>
This commit is contained in:
Andrew Williamson 2022-04-28 16:38:13 +01:00 коммит произвёл GitHub
Родитель 6ddd8613c4
Коммит c0f2340e79
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 380 добавлений и 299 удалений

Просмотреть файл

@ -1,22 +1,10 @@
#!/usr/bin/env node
/* eslint-disable global-require, no-console */
const path = require('path');
const chokidar = require('chokidar');
require('@babel/register')({
plugins: ['dynamic-import-node'],
});
const config = require('config');
const touch = require('touch');
if (process.env.NODE_ENV === 'development') {
if (!require('piping')({
hook: true,
ignore: /(\/\.|~$|\.json|\.scss$)/i,
})) {
return;
}
if (process.env.USE_HTTPS_FOR_DEV) {
// Skip SSL check to avoid the 'self signed certificate in certificate
// chain' error.
@ -24,18 +12,4 @@ if (process.env.NODE_ENV === 'development') {
}
}
require('amo/server/base').runServer().then(() => {
if (config.get('isDevelopment')) {
const basePath = config.get('basePath');
const watcher = chokidar.watch(path.join(basePath, 'src'));
watcher.on('ready', () => {
console.log('👀 The file watcher for server hot reload is ready.');
watcher.on('all', () => {
// Touching this file triggers a server reload.
touch.sync(__filename);
});
});
}
});
require('amo/server/base').runServer();

Просмотреть файл

@ -101,18 +101,16 @@
}
},
"start-dev": {
"command": "npm run clean && concurrently 'npm run webpack-dev-server' 'node bin/server.js | pino-devtools --mode buffer --tee | pino-pretty'",
"command": "npm run clean && concurrently 'npm run webpack-dev-server' 'nodemon bin/server.js | pino-devtools --mode buffer --tee | pino-pretty'",
"env": {
"ENABLE_PIPING": "true",
"NODE_ENV": "development",
"NODE_ICU_DATA": "./node_modules/full-icu",
"NODE_PATH": "./:./src"
}
},
"start-dev-proxy": {
"command": "npm run clean && concurrently -c 'dim' 'npm run webpack-dev-server' 'node bin/server.js | pino-devtools --mode buffer --tee | pino-pretty' 'node bin/proxy.js | pino-pretty'",
"command": "npm run clean && concurrently -c 'dim' 'npm run webpack-dev-server' 'nodemon bin/server.js | pino-devtools --mode buffer --tee | pino-pretty' 'node bin/proxy.js | pino-pretty'",
"env": {
"ENABLE_PIPING": "true",
"NODE_ENV": "development",
"NODE_ICU_DATA": "./node_modules/full-icu",
"NODE_PATH": "./:./src"
@ -305,10 +303,10 @@
"mock-express-response": "^0.3.0",
"node-fetch": "^3.1.1",
"node-sass": "^7.0.0",
"nodemon": "^2.0.15",
"object.values": "^1.0.4",
"pino-devtools": "^2.1.0",
"pino-pretty": "^7.0.0",
"piping": "^1.0.0-rc.4",
"po2json": "mikeedwards/po2json#51e2310485bbe35e9e57f2eee238185459ca0eab",
"postcss": "^8.2.10",
"postcss-loader": "^6.0.0",

643
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу