mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
* 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
36 lines
682 B
JavaScript
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
|
|
}}`
|
|
);
|
|
}
|
|
};
|