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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"build": "npm run version-check && node scripts/rollup/build.js",
"linc": "node ./scripts/tasks/linc.js",
"lint": "node ./scripts/tasks/eslint.js",
"lint-build": "node ./scripts/rollup/validate/index.js",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
"test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js",
"test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js",
Expand Down
2 changes: 1 addition & 1 deletion scripts/circleci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn build --extract-errors
# See https://github.com/facebook/react/pull/11655.

# Do a sanity check on bundles
node ./scripts/rollup/validate/index
yarn lint-build

# Check that the standalone reconciler isn't borked
cd fixtures/reconciler
Expand Down
30 changes: 30 additions & 0 deletions scripts/release/build-commands/run-automated-bundle-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env node

'use strict';

const {logPromise, runYarnTask} = require('../utils');

module.exports = async ({cwd}) => {
await logPromise(
runYarnTask(cwd, 'lint-build', 'Lint bundle failed'),
'Running ESLint on bundle'
);
await logPromise(
runYarnTask(
cwd,
'test-build',
'Jest tests on the bundle failed in development'
),
'Running Jest tests on the bundle in the development environment',
true
);
await logPromise(
runYarnTask(
cwd,
'test-build-prod',
'Jest tests on the bundle failed in production'
),
'Running Jest tests on the bundle in the production environment',
true
);
};
27 changes: 8 additions & 19 deletions scripts/release/build-commands/run-automated-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,7 @@

'use strict';

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

const runYarnTask = async (cwd, task, errorMessage) => {
try {
await exec(`yarn ${task}`, {cwd});
} catch (error) {
throw Error(
chalk`
${errorMessage}

{white ${error.stdout}}
`
);
}
};
const {logPromise, runYarnTask} = require('../utils');

module.exports = async ({cwd}) => {
await logPromise(runYarnTask(cwd, 'lint', 'Lint failed'), 'Running ESLint');
Expand All @@ -27,8 +11,13 @@ module.exports = async ({cwd}) => {
'Running Flow checks'
);
await logPromise(
runYarnTask(cwd, 'test', 'Jest failed'),
'Running Jest tests',
runYarnTask(cwd, 'test', 'Jest tests failed in development'),
'Running Jest tests in the development environment',
true
);
await logPromise(
runYarnTask(cwd, 'test-prod', 'Jest tests failed in production'),
'Running Jest tests in the production environment',
true
);
};
2 changes: 2 additions & 0 deletions scripts/release/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const run = async () => {
const parseBuildParameters = require('./build-commands/parse-build-parameters');
const printPostBuildSummary = require('./build-commands/print-post-build-summary');
const runAutomatedTests = require('./build-commands/run-automated-tests');
const runAutomatedBundleTests = require('./build-commands/run-automated-bundle-tests');
const updateGit = require('./build-commands/update-git');
const updatePackageVersions = require('./build-commands/update-package-versions');
const updateYarnDependencies = require('./build-commands/update-yarn-dependencies');
Expand All @@ -42,6 +43,7 @@ const run = async () => {
await runAutomatedTests(params);
await updatePackageVersions(params);
await buildArtifacts(params);
await runAutomatedBundleTests(params);
await addGitTag(params);
await printPostBuildSummary(params);
} catch (error) {
Expand Down
15 changes: 15 additions & 0 deletions scripts/release/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,25 @@ const logPromise = async (promise, text, isLongRunningTask = false) => {
}
};

const runYarnTask = async (cwd, task, errorMessage) => {
try {
await exec(`yarn ${task}`, {cwd});
} catch (error) {
throw Error(
chalk`
${errorMessage}

{white ${error.stdout}}
`
);
}
};

module.exports = {
execRead,
execUnlessDry,
getPublicPackages,
getUnexecutedCommands,
logPromise,
runYarnTask,
};