react/scripts/release/build-commands/update-git.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

27 lines
571 B
JavaScript

#!/usr/bin/env node
'use strict';
const chalk = require('chalk');
const {exec} = require('child-process-promise');
const {logPromise} = require('../utils');
const update = async ({cwd, branch, local}) => {
if (!local) {
await exec('git fetch', {cwd});
}
await exec(`git checkout ${branch}`, {cwd});
if (!local) {
await exec('git pull', {cwd});
}
};
module.exports = async params => {
return logPromise(
update(params),
`Updating checkout ${chalk.yellow.bold(
params.cwd
)} on branch ${chalk.yellow.bold(params.branch)}}`
);
};