react/scripts/release/publish-commands/check-build-status.js
Andrew Clark 1fd205ad2d
Additional release script options for publishing canary versions (#12219)
* Additional release script options for publishing canary versions

- `branch` specifies a branch other than master
- `local` skips pulling from the remote branch and checking CircleCI
- `tag` specifies an npm dist tag other than `latest` or `next`

We may add a higher-level `canary` option in the future.

* Address Brian's feedback:

- Updated description of `local` option
- Throws if the `latest` tag is specified for a prerelease version
2018-02-13 11:44:27 -08:00

36 lines
682 B
JavaScript

#!/usr/bin/env node
'use strict';
const chalk = require('chalk');
const {existsSync} = require('fs');
const {readJson} = require('fs-extra');
const {join} = require('path');
module.exports = async ({cwd, version, local}) => {
if (local) {
return;
}
const packagePath = join(
cwd,
'build',
'node_modules',
'react',
'package.json'
);
if (!existsSync(packagePath)) {
throw Error('No build found');
}
const packageJson = await readJson(packagePath);
if (packageJson.version !== version) {
throw Error(
chalk`Expected version {bold.white ${version}} but found {bold.white ${
packageJson.version
}}`
);
}
};