chore: adjust script not force require npm version check

This commit is contained in:
二货机器人 2022-11-14 11:37:30 +08:00
parent d71c7116f4
commit f3386666c7

View File

@ -15,11 +15,15 @@ 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...'));
}
}