mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
Updated version incrementing suggestion in release script based on team discussion (#14389)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
const http = require('request-promise-json');
|
||||
const {exec} = require('child-process-promise');
|
||||
const {readdirSync} = require('fs');
|
||||
const {existsSync, readdirSync} = require('fs');
|
||||
const {readJsonSync} = require('fs-extra');
|
||||
const {join} = require('path');
|
||||
const {logPromise} = require('../utils');
|
||||
@@ -20,6 +20,10 @@ const run = async ({build, cwd}) => {
|
||||
entry => entry.path === 'home/circleci/project/node_modules.tgz'
|
||||
).url;
|
||||
|
||||
if (!existsSync(join(cwd, 'build'))) {
|
||||
await exec(`mkdir ./build`, {cwd});
|
||||
}
|
||||
|
||||
// Download and extract artifact
|
||||
await exec(`rm -rf ./build/node_modules*`, {cwd});
|
||||
await exec(`curl ${nodeModulesURL} --output ./build/node_modules.tgz`, {cwd});
|
||||
|
||||
@@ -18,6 +18,10 @@ const run = async ({cwd, local, packages, version}) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!existsSync(join(cwd, 'build'))) {
|
||||
await exec(`mkdir ./build`, {cwd});
|
||||
}
|
||||
|
||||
// Cleanup from previous builds
|
||||
await exec(`rm -rf ./build/node_modules*`, {cwd});
|
||||
await exec(`mkdir ./build/node_modules`, {cwd});
|
||||
|
||||
@@ -6,6 +6,10 @@ const semver = require('semver');
|
||||
const {execRead, logPromise} = require('../utils');
|
||||
|
||||
const run = async ({cwd, packages}, versionsMap) => {
|
||||
const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
|
||||
cwd,
|
||||
});
|
||||
|
||||
for (let i = 0; i < packages.length; i++) {
|
||||
const packageName = packages[i];
|
||||
|
||||
@@ -17,7 +21,13 @@ const run = async ({cwd, packages}, versionsMap) => {
|
||||
|
||||
// Guess the next version by incrementing patch.
|
||||
// The script will confirm this later.
|
||||
versionsMap.set(packageName, `${major}.${minor}.${patch + 1}`);
|
||||
// By default, new releases from masters should increment the minor version number,
|
||||
// and patch releases should be done from branches.
|
||||
if (branch === 'master') {
|
||||
versionsMap.set(packageName, `${major}.${minor + 1}.0`);
|
||||
} else {
|
||||
versionsMap.set(packageName, `${major}.${minor}.${patch + 1}`);
|
||||
}
|
||||
} catch (error) {
|
||||
// If the package has not yet been published,
|
||||
// we'll require a version number to be entered later.
|
||||
|
||||
Reference in New Issue
Block a user