mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Update release script to support canary versions
This commit is contained in:
@@ -81,5 +81,7 @@ module.exports = {
|
||||
spyOnDev: true,
|
||||
spyOnDevAndProd: true,
|
||||
spyOnProd: true,
|
||||
// TODO: Remove dependency on Promise.race
|
||||
Promise: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -43,5 +43,8 @@ const check = async ({cwd}) => {
|
||||
};
|
||||
|
||||
module.exports = async params => {
|
||||
if (params.local) {
|
||||
return;
|
||||
}
|
||||
return logPromise(check(params), 'Checking CircleCI status');
|
||||
};
|
||||
|
||||
@@ -6,15 +6,21 @@ const chalk = require('chalk');
|
||||
const {exec} = require('child-process-promise');
|
||||
const {logPromise} = require('../utils');
|
||||
|
||||
const update = async ({cwd}) => {
|
||||
await exec('git fetch', {cwd});
|
||||
await exec('git checkout master', {cwd});
|
||||
await exec('git pull', {cwd});
|
||||
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 ({cwd}) => {
|
||||
module.exports = async params => {
|
||||
return logPromise(
|
||||
update({cwd}),
|
||||
`Updating checkout ${chalk.yellow.bold(cwd)}`
|
||||
update(params),
|
||||
`Updating checkout ${chalk.yellow.bold(
|
||||
params.cwd
|
||||
)} on branch ${chalk.yellow.bold(params.branch)}}`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -23,6 +23,25 @@ const paramDefinitions = [
|
||||
alias: 'v',
|
||||
description: 'Semantic version number',
|
||||
},
|
||||
{
|
||||
name: 'branch',
|
||||
type: String,
|
||||
alias: 'b',
|
||||
description: 'Branch to build from; defaults to [bold]{master}',
|
||||
defaultValue: 'master',
|
||||
},
|
||||
{
|
||||
name: 'local',
|
||||
type: Boolean,
|
||||
description: "Don't pull changes from the remote branch. Also skips CI.",
|
||||
},
|
||||
{
|
||||
name: 'tag',
|
||||
type: String,
|
||||
description:
|
||||
'The npm dist tag; defaults to [bold]{latest} for a stable' +
|
||||
'release, [bold]{next} for unstable',
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -7,7 +7,10 @@ const {existsSync} = require('fs');
|
||||
const {readJson} = require('fs-extra');
|
||||
const {join} = require('path');
|
||||
|
||||
module.exports = async ({cwd, version}) => {
|
||||
module.exports = async ({cwd, version, local}) => {
|
||||
if (local) {
|
||||
return;
|
||||
}
|
||||
const packagePath = join(
|
||||
cwd,
|
||||
'build',
|
||||
|
||||
@@ -8,10 +8,21 @@ const {join} = require('path');
|
||||
const semver = require('semver');
|
||||
const {execRead, execUnlessDry, logPromise} = require('../utils');
|
||||
|
||||
const push = async ({cwd, dry, packages, version}) => {
|
||||
const push = async ({cwd, dry, packages, version, tag}) => {
|
||||
const errors = [];
|
||||
const isPrerelease = semver.prerelease(version);
|
||||
const tag = isPrerelease ? 'next' : 'latest';
|
||||
let isPrerelease;
|
||||
if (tag === undefined) {
|
||||
// No tag was provided. Check the version.
|
||||
isPrerelease = semver.prerelease(version);
|
||||
if (isPrerelease) {
|
||||
tag = 'next';
|
||||
} else {
|
||||
tag = 'latest';
|
||||
}
|
||||
} else {
|
||||
// Any tag besides `latest` is a prerelease
|
||||
isPrerelease = tag === 'latest';
|
||||
}
|
||||
|
||||
const publishProject = async project => {
|
||||
try {
|
||||
@@ -76,5 +87,6 @@ const push = async ({cwd, dry, packages, version}) => {
|
||||
};
|
||||
|
||||
module.exports = async params => {
|
||||
console.log(params);
|
||||
return logPromise(push(params), 'Publishing packages to NPM');
|
||||
};
|
||||
|
||||
@@ -10,5 +10,8 @@ const push = async ({cwd, dry}) => {
|
||||
};
|
||||
|
||||
module.exports = async params => {
|
||||
if (params.local) {
|
||||
return;
|
||||
}
|
||||
return logPromise(push(params), 'Pushing to git remote');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user