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.
Andrew Clark committed
Mar 19, 2020 at 14:45 UTC
31e6756b8c6b91630e6f32dff78e8e85039befb0
3 files changed
+2
-80
scripts/release/publish-commands/download-error-codes-from-ci.js
deleted
-46
@@ -1,46 +0,0 @@
1
-#!/usr/bin/env node
2
-
3
-'use strict';
4
-
5
-const {exec} = require('child-process-promise');
6
-const {readJsonSync} = require('fs-extra');
7
-const {join} = require('path');
8
-const {getArtifactsList, logPromise} = require('../utils');
9
-const theme = require('../theme');
10
-
11
-const run = async ({cwd, packages, tags}) => {
12
- if (!tags.includes('latest')) {
13
- // Don't update error-codes for alphas.
14
- return;
15
- }
16
-
17
- // All packages are built from a single source revision,
18
- // so it is safe to read build info from any one of them.
19
- const arbitraryPackageName = packages[0];
20
- const {buildNumber, environment} = readJsonSync(
21
- join(cwd, 'build', 'node_modules', arbitraryPackageName, 'build-info.json')
22
- );
23
-
24
- // If this release was created on Circle CI, grab the updated error codes from there.
25
- // Else the user will have to manually regenerate them.
26
- if (environment === 'ci') {
27
- const artifacts = await getArtifactsList(buildNumber);
28
-
29
- // Each container stores an "error-codes" artifact, unfortunately.
30
- // We want to use the one that also ran `yarn build` since it may have modifications.
31
- const {node_index} = artifacts.find(entry =>
32
- entry.path.endsWith('node_modules.tgz')
33
- );
34
- const {url} = artifacts.find(
35
- entry =>
36
- entry.node_index === node_index && entry.path.endsWith('codes.json')
37
- );
38
-
39
- // Download and stage changers
40
- await exec(`curl ${url} --output ./scripts/error-codes/codes.json`, {cwd});
41
- }
42
-};
43
-
44
-module.exports = async params => {
45
- return logPromise(run(params), theme`Retrieving error codes`);
46
-};
scripts/release/publish-commands/print-follow-up-instructions.js
+2
-32
@@ -13,7 +13,7 @@ const run = async ({cwd, packages, tags}) => {
13
// All packages are built from a single source revision,
14
// so it is safe to read build info from any one of them.
15
const arbitraryPackageName = packages[0];
16
- const {commit, environment} = readJsonSync(
16
+ const {commit} = readJsonSync(
17
join(cwd, 'build', 'node_modules', arbitraryPackageName, 'build-info.json')
18
);
19
@@ -22,10 +22,6 @@ const run = async ({cwd, packages, tags}) => {
22
`${cwd}/build/node_modules/react/package.json`
23
);
24
25
- const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
26
- cwd,
27
- });
28
-
25
clear();
26
27
if (tags.length === 1 && tags[0] === 'next') {
@@ -58,20 +54,6 @@ const run = async ({cwd, packages, tags}) => {
54
if (status) {
55
console.log(theme.path`• packages/shared/ReactVersion.js`);
56
}
61
-
62
- console.log();
63
- if (environment === 'ci') {
64
- console.log('Auto-generated error codes have been updated as well:');
65
- console.log(theme.path`• scripts/error-codes/codes.json`);
66
- } else {
67
- console.log(
68
- theme`{caution The release that was just published was created locally.} ` +
69
- theme`Because of this, you will need to update the generated ` +
70
- theme`{path scripts/error-codes/codes.json} file manually:`
71
- );
72
- console.log(theme` {command git checkout} {version ${commit}}`);
73
- console.log(theme` {command yarn build -- --extract-errors}`);
74
- }
57
}
58
59
console.log();
@@ -79,16 +61,6 @@ const run = async ({cwd, packages, tags}) => {
61
theme`{header Don't forget to also update and commit the }{path CHANGELOG}`
62
);
63
82
- if (branch !== 'master') {
83
- console.log();
84
- console.log(
85
- theme`{header Don't forget to cherry-pick any updated error codes into the} {path master} {header branch}.`
86
- );
87
- console.log(
88
- theme`Else they will not be properly decoded on {link reactjs.org}.`
89
- );
90
- }
91
-
64
// Prompt the release engineer to tag the commit and update the CHANGELOG.
65
// (The script could automatically do this, but this seems safer.)
66
console.log();
@@ -127,9 +99,7 @@ const run = async ({cwd, packages, tags}) => {
99
}
100
}
101
130
- // Updating reactjs.org accomplishes two things:
131
- // (1) It ensures our Gatsby error codes plugin runs with the latest error codes.
132
- // (2) It keeps the React version shown in the header up to date.
102
+ // Update reactjs.org so the React version shown in the header is up to date.
103
console.log();
104
console.log(
105
theme.header`Once you've pushed changes, update the docs site.`
scripts/release/publish.js
-2
@@ -9,7 +9,6 @@ const theme = require('./theme');
9
const checkNPMPermissions = require('./publish-commands/check-npm-permissions');
10
const confirmSkippedPackages = require('./publish-commands/confirm-skipped-packages');
11
const confirmVersionAndTags = require('./publish-commands/confirm-version-and-tags');
12
-const downloadErrorCodesFromCI = require('./publish-commands/download-error-codes-from-ci');
12
const parseParams = require('./publish-commands/parse-params');
13
const printFollowUpInstructions = require('./publish-commands/print-follow-up-instructions');
14
const promptForOTP = require('./publish-commands/prompt-for-otp');
@@ -45,7 +44,6 @@ const run = async () => {
44
await checkNPMPermissions(params);
45
const otp = await promptForOTP(params);
46
await publishToNPM(params, otp);
48
- await downloadErrorCodesFromCI(params);
47
await updateStableVersionNumbers(params);
48
await printFollowUpInstructions(params);
49
} catch (error) {