Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 60 additions & 23 deletions scripts/release/publish-commands/print-post-publish-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,76 @@
'use strict';

const chalk = require('chalk');
const semver = require('semver');
const {getUnexecutedCommands} = require('../utils');

module.exports = ({version}) => {
console.log(
chalk`
{green.bold Publish successful!}
${getUnexecutedCommands()}
Next there are a couple of manual steps:
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;

{bold.underline Step 1: Create GitHub release}
return chalk`
{bold.underline Step ${index + 1}: ${title}}

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"}!
${printSteps(steps)}
`.replace(/\n +/g, '\n');
})
.join('');
};

module.exports = ({dry, version}) => {
const isPrerelease = semver.prerelease(version);

{bold.underline Step 2: Update the version on reactjs.org}
const sections = [];

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}
// 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"}!`,
]);

{bold.underline Step 3: Test the new 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}`,
]);
}

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}
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}`,
]);

{bold.underline Step 4: Notify the DOM team}
sections.push([
'Notify the DOM team',
chalk`Notify DOM team members: {bold @nhunzaker @jquense @aweary}`,
]);

1. Notify DOM team members: {bold @nhunzaker @jquense @aweary}
console.log(
chalk`
{green.bold Publish successful!}
${getUnexecutedCommands()}
Next there are a couple of manual steps:
${printSections(sections)}
`.replace(/\n +/g, '\n')
);
};
4 changes: 4 additions & 0 deletions scripts/release/publish-commands/publish-to-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to get into standard library already....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yah


const status = JSON.parse(
await execRead(`npm info ${project} dist-tags --json`)
);
Expand Down