Skip to content

Create a canary from current Git branch and revision #14244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
1 change: 1 addition & 0 deletions packages/create-subscription/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs"
],
Expand Down
1 change: 1 addition & 0 deletions packages/jest-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
]
Expand Down
1 change: 1 addition & 0 deletions packages/react-art/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/",
Expand Down
1 change: 1 addition & 0 deletions packages/react-cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-debug-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/"
],
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"profiling.js",
"server.js",
Expand Down
1 change: 1 addition & 0 deletions packages/react-is/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-noop-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"persistent.js",
"cjs/"
Expand Down
1 change: 1 addition & 0 deletions packages/react-reconciler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"persistent.js",
"reflection.js",
Expand Down
1 change: 1 addition & 0 deletions packages/react-test-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"shallow.js",
"cjs/",
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"cjs/",
"umd/"
Expand Down
1 change: 1 addition & 0 deletions packages/scheduler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"files": [
"LICENSE",
"README.md",
"build-info.json",
"index.js",
"tracing.js",
"tracing-profiling.js",
Expand Down
5 changes: 5 additions & 0 deletions scripts/circleci/add_build_info_json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

node ./scripts/release/ci-add-build-info-json.js
2 changes: 2 additions & 0 deletions scripts/circleci/test_entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
fi

if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('./scripts/circleci/add_build_info_json.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/update_package_versions.sh')
COMMANDS_TO_RUN+=('./scripts/circleci/build.sh')
COMMANDS_TO_RUN+=('yarn test-build --maxWorkers=2')
COMMANDS_TO_RUN+=('yarn test-build-prod --maxWorkers=2')
Expand Down
5 changes: 5 additions & 0 deletions scripts/circleci/update_package_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

node ./scripts/release/ci-update-package-versions.js
32 changes: 0 additions & 32 deletions scripts/release/build-commands/build-artifacts.js

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/release/build-commands/print-post-build-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ module.exports = ({cwd, dry, path, version}) => {
1. Open {yellow.bold ${standaloneFixturePath}} in the browser.
2. It should say {italic "Hello world!"}
3. Next go to {yellow.bold ${packagingFixturesPath}} and run {bold node build-all.js}
4. Install the "serve" module ({bold npm install -g serve})
5. Go to the repo root and {bold serve -s .}
6. Open {blue.bold http://localhost:5000/fixtures/packaging}
4. Install the "pushstate-server" module ({bold npm install -g pushstate-server})
5. Go to the repo root and {bold pushstate-server -s .}
6. Open {blue.bold http://localhost:9000/fixtures/packaging}
7. Verify every iframe shows {italic "Hello world!"}

After completing the above steps, resume the release process by running:
Expand Down
21 changes: 4 additions & 17 deletions scripts/release/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ const {exec} = require('child_process');

// Follows the steps outlined in github.com/facebook/react/issues/10620
const run = async () => {
const chalk = require('chalk');
const logUpdate = require('log-update');
const {getPublicPackages, getPackages} = require('./utils');
const {getPublicPackages, getPackages, handleError} = require('./utils');

const addGitTag = require('./build-commands/add-git-tag');
const buildArtifacts = require('./build-commands/build-artifacts');
const buildArtifacts = require('./create-release-commands/build-artifacts');
const checkCircleCiStatus = require('./build-commands/check-circle-ci-status');
const checkEnvironmentVariables = require('./build-commands/check-environment-variables');
const checkEnvironmentVariables = require('./shared-commands/check-environment-variables');
const checkNpmPermissions = require('./build-commands/check-npm-permissions');
const checkPackageDependencies = require('./build-commands/check-package-dependencies');
const checkUncommittedChanges = require('./build-commands/check-uncommitted-changes');
Expand Down Expand Up @@ -55,18 +53,7 @@ const run = async () => {
await addGitTag(params);
await printPostBuildSummary(params);
} catch (error) {
logUpdate.clear();

const message = error.message.trim().replace(/\n +/g, '\n');
const stack = error.stack.replace(error.message, '');

console.log(
`${chalk.bgRed.white(' ERROR ')} ${chalk.red(message)}\n\n${chalk.gray(
stack
)}`
);

process.exit(1);
handleError(error);
}
};

Expand Down
48 changes: 48 additions & 0 deletions scripts/release/ci-add-build-info-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env node

'use strict';

const {exec} = require('child_process');
const {existsSync} = require('fs');
const {join} = require('path');

const run = async () => {
const {writeJson} = require('fs-extra');
const {getBuildInfo, getPackages} = require('./utils');

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

const {checksum, commit, branch} = await getBuildInfo();

const packages = getPackages(join(cwd, 'packages'));
const packagesDir = join(cwd, 'packages');

const buildInfoJSON = {
branch,
checksum,
commit,
environment: 'ci',
};

for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
const packagePath = join(packagesDir, packageName);

// Add build info JSON to package
if (existsSync(join(packagePath, 'npm'))) {
const buildInfoJSONPath = join(packagePath, 'npm', 'build-info.json');
await writeJson(buildInfoJSONPath, buildInfoJSON, {spaces: 2});
}
}
};

// Install (or update) release script dependencies before proceeding.
// This needs to be done before we require() the first NPM module.
exec('yarn install', {cwd: __dirname}, (error, stdout, stderr) => {
if (error) {
console.error(error);
process.exit(1);
} else {
run();
}
});
27 changes: 27 additions & 0 deletions scripts/release/ci-update-package-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node

'use strict';

const {exec} = require('child_process');
const {join} = require('path');

const run = async () => {
const {getBuildInfo, updateVersionsForCanary} = require('./utils');

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

const {version} = await getBuildInfo();

await updateVersionsForCanary(cwd, version);
};

// Install (or update) release script dependencies before proceeding.
// This needs to be done before we require() the first NPM module.
exec('yarn install', {cwd: __dirname}, (error, stdout, stderr) => {
if (error) {
console.error(error);
process.exit(1);
} else {
run();
}
});
35 changes: 35 additions & 0 deletions scripts/release/create-build-commands/add-build-info-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env node

'use strict';

const {existsSync} = require('fs');
const {writeJson} = require('fs-extra');
const {join} = require('path');
const {getPackages, logPromise} = require('../utils');

const run = async ({branch, checksum, commit, tempDirectory}) => {
const packages = getPackages(join(tempDirectory, 'packages'));
const packagesDir = join(tempDirectory, 'packages');

const buildInfoJSON = {
branch,
checksum,
commit,
environment: 'local',
};

for (let i = 0; i < packages.length; i++) {
const packageName = packages[i];
const packagePath = join(packagesDir, packageName);

// Add build info JSON to package
if (existsSync(join(packagePath, 'npm'))) {
const buildInfoJSONPath = join(packagePath, 'npm', 'build-info.json');
await writeJson(buildInfoJSONPath, buildInfoJSON, {spaces: 2});
}
}
};

module.exports = async params => {
return logPromise(run(params), 'Adding build metadata to packages');
};
25 changes: 25 additions & 0 deletions scripts/release/create-build-commands/build-artifacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node

'use strict';

const {exec} = require('child-process-promise');
const {join} = require('path');
const {logPromise} = require('../utils');

const run = async ({cwd, dry, tempDirectory}) => {
const defaultOptions = {
cwd: tempDirectory,
};

await exec('yarn install', defaultOptions);
await exec('yarn build -- --extract-errors', defaultOptions);

const tempNodeModulesPath = join(tempDirectory, 'build', 'node_modules');
const buildPath = join(cwd, 'build');

await exec(`cp -r ${tempNodeModulesPath} ${buildPath}`);
};

module.exports = async params => {
return logPromise(run(params), 'Building artifacts', true);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env node

'use strict';

const chalk = require('chalk');
const {exec} = require('child-process-promise');
const {join} = require('path');
const {tmpdir} = require('os');
const {logPromise} = require('../utils');

const run = async ({commit, cwd, tempDirectory}) => {
const directory = `react-${commit}`;
const temp = tmpdir();

if (tempDirectory !== join(tmpdir(), directory)) {
throw Error(`Unexpected temporary directory "${tempDirectory}"`);
}

await exec(`rm -rf ${directory}`, {cwd: temp});
await exec(`git archive --format=tar --output=${temp}/react.tgz ${commit}`, {
cwd,
});
await exec(`mkdir ${directory}`, {cwd: temp});
await exec(`tar -xf ./react.tgz -C ./${directory}`, {cwd: temp});
};

module.exports = async params => {
return logPromise(
run(params),
`Copying React repo to temporary directory (${chalk.gray(
params.tempDirectory
)})`
);
};
Loading