Prompt to include UMD build artifact links in GitHub release (#14864)
Brian Vaughn committed
Feb 15, 2019 at 10:48 UTC
0e67969cb1ad8c27a72294662e68fa5d7c2c9783
1 file changed
+22
-4
scripts/release/publish-commands/print-follow-up-instructions.js
+22
-4
@@ -3,7 +3,9 @@
3
'use strict';
4
5
const clear = require('clear');
6
+const {existsSync} = require('fs');
7
const {readJsonSync} = require('fs-extra');
8
+const {join} = require('path');
9
const theme = require('../theme');
10
11
const run = async ({cwd, packages, tags}) => {
@@ -25,6 +27,8 @@ const run = async ({cwd, packages, tags}) => {
27
theme`{header A canary release} {version ${version}} {header has been published!}`
28
);
29
} else {
30
+ const nodeModulesPath = join(cwd, 'build/node_modules');
31
+
32
console.log(
33
theme.caution`The release has been published but you're not done yet!`
34
);
@@ -78,14 +82,28 @@ const run = async ({cwd, packages, tags}) => {
82
console.log(theme.command` git push origin --tags`);
83
84
console.log();
81
- console.log(
82
- theme.header`Lastly, please fill in the release on GitHub. ` +
83
- theme`Don't forget to attach build artifacts from {path build/node_modules/}`
84
- );
85
+ console.log(theme.header`Lastly, please fill in the release on GitHub.`);
86
console.log(
87
theme.link`https://github.com/facebook/react/releases/tag/v%s`,
88
version
89
);
90
+ console.log(
91
+ theme`\nThe GitHub release should also include links to the following artifacts:`
92
+ );
93
+ for (let i = 0; i < packages.length; i++) {
94
+ const packageName = packages[i];
95
+ if (existsSync(join(nodeModulesPath, packageName, 'umd'))) {
96
+ const {version: packageVersion} = readJsonSync(
97
+ join(nodeModulesPath, packageName, 'package.json')
98
+ );
99
+ console.log(
100
+ theme`{path • %s:} {link https://unpkg.com/%s@%s/umd/}`,
101
+ packageName,
102
+ packageName,
103
+ packageVersion
104
+ );
105
+ }
106
+ }
107
console.log();
108
}
109
};