2.30.0 - Updated boilerplate, added selection handling - per #637

This commit is contained in:
Francisco Hodge
2020-09-02 23:55:52 -04:00
parent e0ca526419
commit 07743c9ff8
34 changed files with 5080 additions and 9031 deletions
+23 -5
View File
@@ -1,4 +1,4 @@
'use strict';
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
@@ -81,7 +81,13 @@ checkBrowsers(paths.appPath, isInteractive)
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const appName = require(paths.appPackageJson).name;
const useTypeScript = fs.existsSync(paths.appTsConfig);
const urls = prepareUrls(protocol, HOST, port);
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
const urls = prepareUrls(
protocol,
HOST,
port,
paths.publicUrlOrPath.slice(0, -1)
);
const devSocket = {
warnings: warnings =>
devServer.sockWrite(devServer.sockets, 'warnings', warnings),
@@ -96,11 +102,15 @@ checkBrowsers(paths.appPath, isInteractive)
urls,
useYarn,
useTypeScript,
tscCompileOnError,
webpack,
});
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
const proxyConfig = prepareProxy(
proxySetting,
paths.appPublic
);
// Serve webpack assets generated by the compiler over a web server.
const serverConfig = createDevServerConfig(
proxyConfig,
@@ -141,11 +151,10 @@ checkBrowsers(paths.appPath, isInteractive)
if (stats.errors && stats.errors.length > 0) {
devServer.close();
process.exit(1);
return;
}
console.warn("App started in test mode. Closing in 5 seconds.");
let closeTimeout = setTimeout(() => {
const closeTimeout = setTimeout(() => {
clearTimeout(closeTimeout);
devServer.close();
process.exit();
@@ -160,6 +169,15 @@ checkBrowsers(paths.appPath, isInteractive)
process.exit();
});
});
if (isInteractive || process.env.CI !== 'true') {
// Gracefully exit when stdin ends
process.stdin.on('end', function() {
devServer.close();
process.exit();
});
process.stdin.resume();
}
})
.catch(err => {
if (err && err.message) {