mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
fix: 更改发布脚本
This commit is contained in:
parent
f10e9bcc77
commit
61bf2dacd3
@ -13,12 +13,15 @@ import buildConfig from '../build.config.js';
|
|||||||
const { prompt } = enquirer;
|
const { prompt } = enquirer;
|
||||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
const { preid: preId, dry: isDryRun, tag: releaseTag } = minimist(process.argv.slice(2));
|
const { preid, dry: isDryRun, tag: releaseTag } = minimist(process.argv.slice(2));
|
||||||
const packages = buildConfig.pkgs;
|
const packages = buildConfig.pkgs;
|
||||||
|
|
||||||
const versionIncrements = ['patch', 'minor', 'major', ...(preId ? ['prepatch', 'preminor', 'premajor', 'prerelease'] : [])];
|
const versionIncrements = ['patch', 'minor', 'major', 'prepatch', 'preminor', 'premajor', 'prerelease'];
|
||||||
|
|
||||||
const incVersion = (version, i) => semver.inc(version, i, preId);
|
const incVersion = (version, i) => {
|
||||||
|
const preId = preid || semver.prerelease(version)[0] || 'alpha';
|
||||||
|
return semver.inc(version, i, preId);
|
||||||
|
};
|
||||||
const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts });
|
const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts });
|
||||||
const dryRun = (bin, args, opts = {}) => console.log(chalk.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts);
|
const dryRun = (bin, args, opts = {}) => console.log(chalk.blue(`[dryrun] ${bin} ${args.join(' ')}`), opts);
|
||||||
const runIfNotDry = isDryRun ? dryRun : run;
|
const runIfNotDry = isDryRun ? dryRun : run;
|
||||||
@ -27,16 +30,7 @@ const step = (msg) => console.log(chalk.cyan(msg));
|
|||||||
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
async function publishPackage(pkg, runIfNotDry) {
|
async function publishPackage(pkg, runIfNotDry) {
|
||||||
let _releaseTag;
|
const _releaseTag = releaseTag || 'next';
|
||||||
if (releaseTag) {
|
|
||||||
_releaseTag = releaseTag;
|
|
||||||
} else if (pkg.newVersion.includes('alpha')) {
|
|
||||||
_releaseTag = 'alpha';
|
|
||||||
} else if (pkg.newVersion.includes('beta')) {
|
|
||||||
_releaseTag = 'beta';
|
|
||||||
} else if (pkg.newVersion.includes('rc')) {
|
|
||||||
_releaseTag = 'rc';
|
|
||||||
}
|
|
||||||
|
|
||||||
step(`Publishing ${pkg.name}...`);
|
step(`Publishing ${pkg.name}...`);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user