-
Notifications
You must be signed in to change notification settings - Fork 47k
/
print-follow-up-instructions.js
129 lines (114 loc) · 4.03 KB
/
print-follow-up-instructions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env node
'use strict';
const clear = require('clear');
const {existsSync} = require('fs');
const {readJsonSync} = require('fs-extra');
const {join} = require('path');
const theme = require('../theme');
const {execRead} = require('../utils');
const run = async ({cwd, packages, tags}) => {
// Tags are named after the react version.
const {version} = readJsonSync(
`${cwd}/build/node_modules/react/package.json`
);
clear();
if (tags.length === 1 && tags[0] === 'next') {
console.log(
theme`{header A "next" release} {version ${version}} {header has been published!}`
);
} else if (tags.length === 1 && tags[0] === 'experimental') {
console.log(
theme`{header An "experimental" release} {version ${version}} {header has been published!}`
);
} else {
const nodeModulesPath = join(cwd, 'build/node_modules');
console.log(
theme.caution`The release has been published but you're not done yet!`
);
if (tags.includes('latest')) {
// 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];
// FIXME: New build script does not output build-info.json. It's only used
// by this post-publish print job, and only for "latest" releases, so I've
// disabled it as a workaround so the publish script doesn't crash for
// "next" and "experimental" pre-releases.
const {commit} = readJsonSync(
join(
cwd,
'build',
'node_modules',
arbitraryPackageName,
'build-info.json'
)
);
console.log();
console.log(
theme.header`Please review and commit all local, staged changes.`
);
console.log();
console.log('Version numbers have been updated in the following files:');
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
console.log(theme.path`• packages/%s/package.json`, packageName);
}
const status = await execRead(
'git diff packages/shared/ReactVersion.js',
{cwd}
);
if (status) {
console.log(theme.path`• packages/shared/ReactVersion.js`);
}
console.log();
console.log(
theme`{header Don't forget to also update and commit the }{path CHANGELOG}`
);
// Prompt the release engineer to tag the commit and update the CHANGELOG.
// (The script could automatically do this, but this seems safer.)
console.log();
console.log(
theme.header`Tag the source for this release in Git with the following command:`
);
console.log(
theme` {command git tag -a v}{version %s} {command -m "v%s"} {version %s}`,
version,
version,
commit
);
console.log(theme.command` git push origin --tags`);
console.log();
console.log(theme.header`Lastly, please fill in the release on GitHub.`);
console.log(
theme.link`https://github.com/facebook/react/releases/tag/v%s`,
version
);
console.log(
theme`\nThe GitHub release should also include links to the following artifacts:`
);
for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
if (existsSync(join(nodeModulesPath, packageName, 'umd'))) {
const {version: packageVersion} = readJsonSync(
join(nodeModulesPath, packageName, 'package.json')
);
console.log(
theme`{path • %s:} {link https://unpkg.com/%s@%s/umd/}`,
packageName,
packageName,
packageVersion
);
}
}
// 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.`
);
console.log(
'This will ensure that any newly-added error codes can be decoded.'
);
console.log();
}
}
};
module.exports = run;