mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Remove error code step from publish script (#18350)
Error codes don't need to be pulled from CI anymore because the ones in source are already expected to match the build output. I noticed this when running the 16.13.1 release. Patch releases are cut with the commit used to build the previous release as a base. So the publish script accidentally reverted the changes that had landed to the error codes file since then.
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const {exec} = require('child-process-promise');
|
||||
const {readJsonSync} = require('fs-extra');
|
||||
const {join} = require('path');
|
||||
const {getArtifactsList, logPromise} = require('../utils');
|
||||
const theme = require('../theme');
|
||||
|
||||
const run = async ({cwd, packages, tags}) => {
|
||||
if (!tags.includes('latest')) {
|
||||
// Don't update error-codes for alphas.
|
||||
return;
|
||||
}
|
||||
|
||||
// All packages are built from a single source revision,
|
||||
// so it is safe to read build info from any one of them.
|
||||
const arbitraryPackageName = packages[0];
|
||||
const {buildNumber, environment} = readJsonSync(
|
||||
join(cwd, 'build', 'node_modules', arbitraryPackageName, 'build-info.json')
|
||||
);
|
||||
|
||||
// If this release was created on Circle CI, grab the updated error codes from there.
|
||||
// Else the user will have to manually regenerate them.
|
||||
if (environment === 'ci') {
|
||||
const artifacts = await getArtifactsList(buildNumber);
|
||||
|
||||
// Each container stores an "error-codes" artifact, unfortunately.
|
||||
// We want to use the one that also ran `yarn build` since it may have modifications.
|
||||
const {node_index} = artifacts.find(entry =>
|
||||
entry.path.endsWith('node_modules.tgz')
|
||||
);
|
||||
const {url} = artifacts.find(
|
||||
entry =>
|
||||
entry.node_index === node_index && entry.path.endsWith('codes.json')
|
||||
);
|
||||
|
||||
// Download and stage changers
|
||||
await exec(`curl ${url} --output ./scripts/error-codes/codes.json`, {cwd});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = async params => {
|
||||
return logPromise(run(params), theme`Retrieving error codes`);
|
||||
};
|
||||
@@ -13,7 +13,7 @@ const run = async ({cwd, packages, tags}) => {
|
||||
// All packages are built from a single source revision,
|
||||
// so it is safe to read build info from any one of them.
|
||||
const arbitraryPackageName = packages[0];
|
||||
const {commit, environment} = readJsonSync(
|
||||
const {commit} = readJsonSync(
|
||||
join(cwd, 'build', 'node_modules', arbitraryPackageName, 'build-info.json')
|
||||
);
|
||||
|
||||
@@ -22,10 +22,6 @@ const run = async ({cwd, packages, tags}) => {
|
||||
`${cwd}/build/node_modules/react/package.json`
|
||||
);
|
||||
|
||||
const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
|
||||
cwd,
|
||||
});
|
||||
|
||||
clear();
|
||||
|
||||
if (tags.length === 1 && tags[0] === 'next') {
|
||||
@@ -58,20 +54,6 @@ const run = async ({cwd, packages, tags}) => {
|
||||
if (status) {
|
||||
console.log(theme.path`• packages/shared/ReactVersion.js`);
|
||||
}
|
||||
|
||||
console.log();
|
||||
if (environment === 'ci') {
|
||||
console.log('Auto-generated error codes have been updated as well:');
|
||||
console.log(theme.path`• scripts/error-codes/codes.json`);
|
||||
} else {
|
||||
console.log(
|
||||
theme`{caution The release that was just published was created locally.} ` +
|
||||
theme`Because of this, you will need to update the generated ` +
|
||||
theme`{path scripts/error-codes/codes.json} file manually:`
|
||||
);
|
||||
console.log(theme` {command git checkout} {version ${commit}}`);
|
||||
console.log(theme` {command yarn build -- --extract-errors}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log();
|
||||
@@ -79,16 +61,6 @@ const run = async ({cwd, packages, tags}) => {
|
||||
theme`{header Don't forget to also update and commit the }{path CHANGELOG}`
|
||||
);
|
||||
|
||||
if (branch !== 'master') {
|
||||
console.log();
|
||||
console.log(
|
||||
theme`{header Don't forget to cherry-pick any updated error codes into the} {path master} {header branch}.`
|
||||
);
|
||||
console.log(
|
||||
theme`Else they will not be properly decoded on {link reactjs.org}.`
|
||||
);
|
||||
}
|
||||
|
||||
// Prompt the release engineer to tag the commit and update the CHANGELOG.
|
||||
// (The script could automatically do this, but this seems safer.)
|
||||
console.log();
|
||||
@@ -127,9 +99,7 @@ const run = async ({cwd, packages, tags}) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Updating reactjs.org accomplishes two things:
|
||||
// (1) It ensures our Gatsby error codes plugin runs with the latest error codes.
|
||||
// (2) It keeps the React version shown in the header up to date.
|
||||
// Update reactjs.org so the React version shown in the header is up to date.
|
||||
console.log();
|
||||
console.log(
|
||||
theme.header`Once you've pushed changes, update the docs site.`
|
||||
|
||||
@@ -9,7 +9,6 @@ const theme = require('./theme');
|
||||
const checkNPMPermissions = require('./publish-commands/check-npm-permissions');
|
||||
const confirmSkippedPackages = require('./publish-commands/confirm-skipped-packages');
|
||||
const confirmVersionAndTags = require('./publish-commands/confirm-version-and-tags');
|
||||
const downloadErrorCodesFromCI = require('./publish-commands/download-error-codes-from-ci');
|
||||
const parseParams = require('./publish-commands/parse-params');
|
||||
const printFollowUpInstructions = require('./publish-commands/print-follow-up-instructions');
|
||||
const promptForOTP = require('./publish-commands/prompt-for-otp');
|
||||
@@ -45,7 +44,6 @@ const run = async () => {
|
||||
await checkNPMPermissions(params);
|
||||
const otp = await promptForOTP(params);
|
||||
await publishToNPM(params, otp);
|
||||
await downloadErrorCodesFromCI(params);
|
||||
await updateStableVersionNumbers(params);
|
||||
await printFollowUpInstructions(params);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user