chore: sync script with next

This commit is contained in:
二货机器人 2022-11-17 16:48:50 +08:00
parent 14884fe585
commit 6d9cf9e132

View File

@ -15,18 +15,27 @@ function exitProcess(code = 1) {
}
async function checkVersion() {
const { versions } = await fetch('http://registry.npmjs.org/antd').then(res => res.json());
if (version in versions) {
console.log(chalk.yellow('😈 Current version already exists. Forget update package.json?'));
console.log(chalk.cyan(' => Current:'), version);
exitProcess();
try {
const { versions } = await fetch('http://registry.npmjs.org/antd').then((res) => res.json());
if (version in versions) {
console.log(chalk.yellow('😈 Current version already exists. Forget update package.json?'));
console.log(chalk.cyan(' => Current:'), version);
exitProcess();
}
} catch (error) {
console.log(chalk.red('🚨 Check version failed. Skip...'));
}
}
async function checkBranch({ current }) {
if (version.includes('-alpha.')) {
if (
version.includes('-alpha.') ||
version.includes('-beta.') ||
version.includes('-rc.') ||
version.includes('-experimental.')
) {
console.log(chalk.cyan('😃 Alpha version. Skip branch check.'));
} else if (current !== 'master' && current !== '4.0-prepare') {
} else if (current !== 'master' && current !== '4.0-prepare' && current !== '4.x-stable') {
console.log(chalk.yellow('🤔 You are not in the master branch!'));
exitProcess();
}
@ -43,12 +52,16 @@ async function checkCommit({ files }) {
}
async function checkRemote() {
const { remote } = await git.fetch('origin', 'master');
if (remote?.indexOf('ant-design/ant-design') === -1) {
console.log(
chalk.yellow('😓 Your remote origin is not ant-design/ant-design, did you fork it?'),
);
exitProcess();
try {
const { remote } = await git.fetch('origin', 'master');
if (remote?.indexOf('ant-design/ant-design') === -1) {
console.log(
chalk.yellow('😓 Your remote origin is not ant-design/ant-design, did you fork it?'),
);
exitProcess();
}
} catch (error) {
console.log(chalk.red('🚨 Check remote failed. Skip...'));
}
}