Skip to content

Commit 8f6e199

Browse files
author
Brian Vaughn
committed
Added publish command and slightly refactored some other command messaging
1 parent 75f0f8e commit 8f6e199

23 files changed

+457
-121
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
9494
},
9595
"scripts": {
96-
"build": "npm run version-check && node ./scripts/rollup/build.js",
96+
"build": "node ./scripts/rollup/build.js",
9797
"linc": "node ./scripts/tasks/linc.js",
9898
"lint": "node ./scripts/tasks/eslint.js",
9999
"lint-build": "node ./scripts/rollup/validate/index.js",

scripts/release/ci-add-build-info-json.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const run = async () => {
1616

1717
const cwd = join(__dirname, '..', '..');
1818

19-
const {checksum, commit, branch} = await getBuildInfo();
19+
const {branch, checksum, commit, reactVersion} = await getBuildInfo();
2020

2121
const packages = getPackages(join(cwd, 'packages'));
2222
const packagesDir = join(cwd, 'packages');
@@ -26,6 +26,7 @@ const run = async () => {
2626
checksum,
2727
commit,
2828
environment: 'ci',
29+
reactVersion,
2930
};
3031

3132
for (let i = 0; i < packages.length; i++) {

scripts/release/ci-update-package-versions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const run = async () => {
1414

1515
const cwd = join(__dirname, '..', '..');
1616

17-
const {version} = await getBuildInfo();
17+
const {reactVersion, version} = await getBuildInfo();
1818

19-
await updateVersionsForCanary(cwd, version);
19+
await updateVersionsForCanary(cwd, reactVersion, version);
2020
};
2121

2222
// Install (or update) release script dependencies before proceeding.

scripts/release/create-canary-commands/add-build-info-json.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {writeJson} = require('fs-extra');
77
const {join} = require('path');
88
const {getPackages, logPromise} = require('../utils');
99

10-
const run = async ({branch, checksum, commit, tempDirectory}) => {
10+
const run = async ({branch, checksum, commit, reactVersion, tempDirectory}) => {
1111
const packages = getPackages(join(tempDirectory, 'packages'));
1212
const packagesDir = join(tempDirectory, 'packages');
1313

@@ -16,6 +16,7 @@ const run = async ({branch, checksum, commit, tempDirectory}) => {
1616
checksum,
1717
commit,
1818
environment: 'local',
19+
reactVersion,
1920
};
2021

2122
for (let i = 0; i < packages.length; i++) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
const chalk = require('chalk');
6+
const clear = require('clear');
7+
const {confirm} = require('../utils');
8+
9+
const run = async () => {
10+
clear();
11+
12+
console.log(
13+
chalk.red(
14+
'This script does not run any automated tests.' +
15+
'You should run them manually before creating a canary release.'
16+
)
17+
);
18+
19+
await confirm('Do you want to proceed?');
20+
21+
clear();
22+
};
23+
24+
module.exports = run;

scripts/release/create-canary-commands/npm-pack-and-unpack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const run = async ({cwd, dry, tempDirectory}) => {
2727
`cp -r ${tempDirectory}/build/node_modules/*.tgz ${cwd}/build/node_modules/`
2828
);
2929

30-
// Unpack packages and parepare to publish.
30+
// Unpack packages and prepare to publish.
3131
const compressedPackages = readdirSync('build/node_modules/');
3232
for (let i = 0; i < compressedPackages.length; i++) {
3333
await exec(

scripts/release/create-canary-commands/update-version-numbers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
const chalk = require('chalk');
66
const {logPromise, updateVersionsForCanary} = require('../utils');
77

8-
module.exports = async ({tempDirectory, version}) => {
8+
module.exports = async ({reactVersion, tempDirectory, version}) => {
99
return logPromise(
10-
updateVersionsForCanary(tempDirectory, version),
10+
updateVersionsForCanary(tempDirectory, reactVersion, version),
1111
`Updating version numbers (${chalk.yellow.bold(version)})`
1212
);
1313
};

scripts/release/create-canary.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ const {getBuildInfo, handleError} = require('./utils');
88

99
// This script is an escape hatch!
1010
// It exists for special case manual builds.
11-
// The typical suggesgted release process is to create a canary from a CI artifact.
11+
// The typical suggested release process is to create a canary from a CI artifact.
1212
// This build script is optimized for speed and simplicity.
1313
// It doesn't run all of the tests that the CI environment runs.
1414
// You're expected to run those manually before publishing a release.
1515

1616
const addBuildInfoJSON = require('./create-canary-commands/add-build-info-json');
1717
const buildArtifacts = require('./create-canary-commands/build-artifacts');
18+
const confirmAutomatedTesting = require('./create-canary-commands/confirm-automated-testing');
1819
const copyRepoToTempDirectory = require('./create-canary-commands/copy-repo-to-temp-directory');
1920
const npmPackAndUnpack = require('./create-canary-commands/npm-pack-and-unpack');
2021
const printPrereleaseSummary = require('./shared-commands/print-prerelease-summary');
@@ -23,10 +24,25 @@ const updateVersionNumbers = require('./create-canary-commands/update-version-nu
2324
const run = async () => {
2425
try {
2526
const cwd = join(__dirname, '..', '..');
26-
const {branch, checksum, commit, version} = await getBuildInfo();
27+
const {
28+
branch,
29+
checksum,
30+
commit,
31+
reactVersion,
32+
version,
33+
} = await getBuildInfo();
2734
const tempDirectory = join(tmpdir(), `react-${commit}`);
28-
const params = {branch, checksum, commit, cwd, tempDirectory, version};
35+
const params = {
36+
branch,
37+
checksum,
38+
commit,
39+
cwd,
40+
reactVersion,
41+
tempDirectory,
42+
version,
43+
};
2944

45+
await confirmAutomatedTesting(params);
3046
await copyRepoToTempDirectory(params);
3147
await updateVersionNumbers(params);
3248
await addBuildInfoJSON(params);

scripts/release/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
"dependencies": {
88
"chalk": "^2.1.0",
99
"child-process-promise": "^2.2.1",
10+
"clear": "^0.1.0",
1011
"cli-spinners": "^1.1.0",
1112
"command-line-args": "^4.0.7",
1213
"command-line-usage": "^4.0.1",
14+
"diff": "^3.5.0",
1315
"figlet": "^1.2.0",
1416
"folder-hash": "^2.1.2",
1517
"fs-extra": "^4.0.2",
1618
"log-update": "^2.1.0",
17-
"print-diff": "^0.1.1",
1819
"prompt-promise": "^1.0.3",
1920
"request-promise-json": "^1.0.4",
2021
"semver": "^5.4.1"

scripts/release/prepare-canary-commands/download-build-artifacts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const run = async ({build, cwd}) => {
2727
`tar zxvf ${cwd}/build/node_modules.tgz -C ${cwd}/build/node_modules/`
2828
);
2929

30-
// Unpack packages and parepare to publish
30+
// Unpack packages and prepare to publish
3131
const compressedPackages = readdirSync('build/node_modules/');
3232
for (let i = 0; i < compressedPackages.length; i++) {
3333
await exec(

0 commit comments

Comments
 (0)