Skip to content

Commit

Permalink
🐛 fix(lib): Check whether the tag exists, not accurate enough
Browse files Browse the repository at this point in the history
  • Loading branch information
kwooshung committed Dec 13, 2023
1 parent 584523a commit 28aa489
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .ks-cvlarrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ module.exports = {
},
error: {
exists: '当前版本号 {0} 已存在,请重新输入',
format: '版本号格式不符合Semver语义化标准,请重新输入'
format: '版本号格式不符合 Semver语义化标准,请重新输入'
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kwooshung/cvlar",
"version": "0.0.1-alpha",
"version": "0.0.0",
"title": "cvlar",
"description": "`Cvlar` is an open-source tool combining commit conventions, version control, auto-changelogs, and release automation for streamlined Git workflows.",
"private": false,
Expand Down
10 changes: 7 additions & 3 deletions src/core/run/questions/gitControl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ class gitControl {
const { stdout, stderr } = await command.execute('git tag -l');

if (!stderr && stdout) {
return stdout.includes(version);
const tags = stdout.split('\n');
return tags.includes(version);
}

return false;
Expand All @@ -668,7 +669,8 @@ class gitControl {
* @returns {Promise<string>} 指定版本号
*/
private async versionSpecifyInput(): Promise<string> {
return await command.prompt.input({
const errorMessage = this.CONF.i18n.git.version.error.format;
const result = await command.prompt.input({
message: this.CONF.i18n.git.version.specify.input.message,
transformer(val: string) {
return V.normalize(val, true);
Expand All @@ -677,9 +679,11 @@ class gitControl {
if (semver.valid(val)) {
return true;
}
return this.CONF.i18n.git.version.error.format;
return errorMessage;
}
});

return result;
}

/**
Expand Down

0 comments on commit 28aa489

Please sign in to comment.