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