mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
update script (#16204)
This commit is contained in:
parent
73188ac497
commit
2b0723f7cb
@ -14,21 +14,23 @@ function exitProcess(code = 1) {
|
||||
process.exit(code);
|
||||
}
|
||||
|
||||
async function checkCommit() {
|
||||
const { current, files } = await git.status();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
async function checkBranch({ current }) {
|
||||
if (current !== 'master') {
|
||||
console.log(chalk.yellow('🤔 You are not in the master branch!'));
|
||||
exitProcess();
|
||||
}
|
||||
}
|
||||
|
||||
async function checkCommit({ files }) {
|
||||
if (files.length) {
|
||||
console.log(chalk.yellow('🙄 You forgot something to commit.'));
|
||||
files.forEach(({ path: filePath, working_dir: mark }) => {
|
||||
@ -36,7 +38,9 @@ async function checkCommit() {
|
||||
});
|
||||
exitProcess();
|
||||
}
|
||||
}
|
||||
|
||||
async function checkRemote() {
|
||||
const { remote } = await git.fetch('origin', 'master');
|
||||
if (remote.indexOf('ant-design/ant-design') === -1 || true) {
|
||||
console.log(chalk.yellow('😓 Your remote origin is not ant-design. Do you fork it?'));
|
||||
@ -44,4 +48,16 @@ async function checkCommit() {
|
||||
}
|
||||
}
|
||||
|
||||
checkCommit();
|
||||
async function checkAll() {
|
||||
const status = await git.status();
|
||||
|
||||
await checkVersion();
|
||||
|
||||
await checkBranch(status);
|
||||
|
||||
await checkCommit(status);
|
||||
|
||||
await checkRemote();
|
||||
}
|
||||
|
||||
checkAll();
|
||||
|
Loading…
Reference in New Issue
Block a user