resolve race condition when creating rd.json

This commit is contained in:
Bastian Ike
2021-01-25 15:01:24 +01:00
parent e6830ec131
commit 872df4972c

View File

@@ -13,14 +13,9 @@ process.on('unhandledRejection', err => {
throw err;
});
// create radar
require('../bin/tasks/radarjson').radarJsonGenerator()
// Ensure environment variables are read.
require('../config/env');
const path = require('path');
const chalk = require('react-dev-utils/chalk');
const fs = require('fs-extra');
@@ -54,8 +49,9 @@ const config = configFactory('production');
// We require that you explicitly set browsers and do not fall back to
// browserslist defaults.
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
checkBrowsers(paths.appPath, isInteractive)
const {checkBrowsers} = require('react-dev-utils/browsersHelper');
require('../bin/tasks/radarjson').radarJsonGenerator()
.then(checkBrowsers(paths.appPath, isInteractive))
.then(() => {
// First, read the current file sizes in build directory.
// This lets us display how much they changed later.
@@ -71,7 +67,7 @@ checkBrowsers(paths.appPath, isInteractive)
return build(previousFileSizes);
})
.then(
({ stats, previousFileSizes, warnings }) => {
({stats, previousFileSizes, warnings}) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
@@ -134,6 +130,7 @@ checkBrowsers(paths.appPath, isInteractive)
process.exit(1);
});
// Create the production build and print the deployment instructions.
function build(previousFileSizes) {
// We used to support resolving modules according to `NODE_PATH`.
@@ -174,7 +171,7 @@ function build(previousFileSizes) {
});
} else {
messages = formatWebpackMessages(
stats.toJson({ all: false, warnings: true, errors: true })
stats.toJson({all: false, warnings: true, errors: true})
);
}
if (messages.errors.length) {
@@ -215,3 +212,4 @@ function copyPublicFolder() {
filter: file => file !== paths.appHtml,
});
}