mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Release script follow-up (#11482)
* Add a timeout before querying npm right after publish * Conditionally log some post publish steps * Print ready-to-paste 'yarn add' instructions for CRA prerelease testing
This commit is contained in:
@@ -3,39 +3,76 @@
|
||||
'use strict';
|
||||
|
||||
const chalk = require('chalk');
|
||||
const semver = require('semver');
|
||||
const {getUnexecutedCommands} = require('../utils');
|
||||
|
||||
module.exports = ({version}) => {
|
||||
const printSteps = steps => {
|
||||
return steps
|
||||
.filter(Boolean) // Remove no-op steps
|
||||
.map((step, index) => `${index + 1}. ${step}`)
|
||||
.join('\n');
|
||||
};
|
||||
|
||||
const printSections = sections => {
|
||||
return sections
|
||||
.map((section, index) => {
|
||||
const [title, ...steps] = section;
|
||||
|
||||
return chalk`
|
||||
{bold.underline Step ${index + 1}: ${title}}
|
||||
|
||||
${printSteps(steps)}
|
||||
`.replace(/\n +/g, '\n');
|
||||
})
|
||||
.join('');
|
||||
};
|
||||
|
||||
module.exports = ({dry, version}) => {
|
||||
const isPrerelease = semver.prerelease(version);
|
||||
|
||||
const sections = [];
|
||||
|
||||
// Certain follow-up steps are for stable releases only.
|
||||
if (!isPrerelease) {
|
||||
sections.push([
|
||||
'Create GitHub release',
|
||||
chalk`Open new release page: {blue.bold https://github.com/facebook/react/releases/new}`,
|
||||
chalk`Choose {bold ${version}} from the dropdown menu`,
|
||||
chalk`Paste the new release notes from {yellow.bold CHANGELOG.md}`,
|
||||
chalk`Attach all files in {yellow.bold build/dist/*.js} except {yellow.bold react-art.*} to the release.`,
|
||||
chalk`Press {bold "Publish release"}!`,
|
||||
]);
|
||||
|
||||
sections.push([
|
||||
'Update the version on reactjs.org',
|
||||
chalk`Git clone (or update) {blue.bold https://github.com/reactjs/reactjs.org}`,
|
||||
chalk`Open the {bold.yellow src/site-constants.js} file`,
|
||||
chalk`Update the {bold version} value to {bold ${version}}`,
|
||||
chalk`Open a Pull Request to {bold master}`,
|
||||
]);
|
||||
}
|
||||
|
||||
sections.push([
|
||||
'Test the new release',
|
||||
chalk`Install CRA: {bold npm i -g create-react-app}`,
|
||||
chalk`Create a test application: {bold create-react-app myapp && cd myapp}`,
|
||||
isPrerelease
|
||||
? chalk`Install the pre-release versions: {bold yarn add react@next react-dom@next}`
|
||||
: null,
|
||||
chalk`Run the app: {bold yarn start}`,
|
||||
]);
|
||||
|
||||
sections.push([
|
||||
'Notify the DOM team',
|
||||
chalk`Notify DOM team members: {bold @nhunzaker @jquense @aweary}`,
|
||||
]);
|
||||
|
||||
console.log(
|
||||
chalk`
|
||||
{green.bold Publish successful!}
|
||||
${getUnexecutedCommands()}
|
||||
Next there are a couple of manual steps:
|
||||
|
||||
{bold.underline Step 1: Create GitHub release}
|
||||
|
||||
1. Open new release page: {blue.bold https://github.com/facebook/react/releases/new}
|
||||
2. Choose {bold ${version}} from the dropdown menu
|
||||
3. Paste the new release notes from {yellow.bold CHANGELOG.md}
|
||||
4. Attach all files in {yellow.bold build/dist/*.js} except {yellow.bold react-art.*} to the release.
|
||||
5. Press {bold "Publish release"}!
|
||||
|
||||
{bold.underline Step 2: Update the version on reactjs.org}
|
||||
|
||||
1. Git clone (or update) {blue.bold https://github.com/reactjs/reactjs.org}
|
||||
2. Open the {bold.yellow src/site-constants.js} file
|
||||
3. Update the {bold version} value to {bold ${version}}
|
||||
4. Open a Pull Request to {bold master}
|
||||
|
||||
{bold.underline Step 3: Test the new release}
|
||||
|
||||
1. Install CRA: {bold npm i -g create-react-app}
|
||||
2. Create a test application: {bold create-react-app myapp}
|
||||
3. Run it: {bold cd myapp && npm start}
|
||||
|
||||
{bold.underline Step 4: Notify the DOM team}
|
||||
|
||||
1. Notify DOM team members: {bold @nhunzaker @jquense @aweary}
|
||||
${printSections(sections)}
|
||||
`.replace(/\n +/g, '\n')
|
||||
);
|
||||
};
|
||||
|
||||
@@ -30,6 +30,10 @@ const push = async ({cwd, dry, version}) => {
|
||||
const packageVersion = packageJSON.version;
|
||||
|
||||
if (!dry) {
|
||||
// Wait a couple of seconds before querying NPM for status;
|
||||
// Anecdotally, querying too soon can result in a false negative.
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
|
||||
const status = JSON.parse(
|
||||
await execRead(`npm info ${project} dist-tags --json`)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user