Skip to content

Commit

Permalink
tags
Browse files Browse the repository at this point in the history
  • Loading branch information
biqing.hu committed May 10, 2024
1 parent 21ff434 commit e968224
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "publishx-cli",
"version": "1.6.60",
"version": "1.6.61",
"description": "publishx-cli 方便提交git库的命令 多功能合一命令,辅助多项目开发",
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
35 changes: 25 additions & 10 deletions src/commands/clear-tags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { _, packageHelper, exit, confirm, exec, getCurrentBranchName, consoleColor, cwd, io } from '../lib'
import * as Listr from 'listr'

/**
* 删除 node_modules
Expand All @@ -17,18 +18,27 @@ export default {
const yes = await confirm('是否要删除掉所有tags?')
if (yes) {
let count = 0
let tasks = []
for (let tag of tags) {
try {
count++
const cmdDeleteTagStr = `git tag --delete ${tag} && git push origin :${tag}`
consoleColor.start(cmdDeleteTagStr)
await exec(cmdDeleteTagStr)
} catch (e) {
consoleColor.error(e)
} finally {
consoleColor.green(`剩余${tags.length - count}项`)
}
tasks.push({
title: `[count]: delete tag ${tag}`,
task: async () => {
try {
count++
const cmdDeleteTagStr = `git tag --delete ${tag} && git push origin :${tag}`
consoleColor.start(cmdDeleteTagStr)
await exec(cmdDeleteTagStr)
} catch (e) {
consoleColor.error(e)
} finally {
consoleColor.green(`剩余${tags.length - count}项`)
}
}
})

}
const taskManager = new Listr(tasks, { concurrent: data.concurrent || 20 })
await taskManager.run()

}
} catch (error) {
Expand All @@ -54,6 +64,11 @@ export default {
command: [
'<tagNames>', '多个tag以,分割 git tag --delete [tagName] && git push origin :refs/tags/[tagName]',
{
concurrent: {
alias: ['c'],
number: true,
describe: '并发数'
},
}
]
}

0 comments on commit e968224

Please sign in to comment.