mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-14 11:14:45 +00:00
feat!: tag released
This commit is contained in:
parent
f9d3daa396
commit
0735972145
33 changed files with 216 additions and 42 deletions
|
|
@ -7,6 +7,7 @@ class DefaultTagFormatter {
|
|||
this.namespace = config.namespace;
|
||||
this.tagPrefix = config.tagPrefix;
|
||||
this.namespaceSeperator = '-'; // maybe make configurable in the future
|
||||
this.prereleaseName = config.prereleaseName;
|
||||
}
|
||||
Format(versionInfo) {
|
||||
const result = `${this.tagPrefix}${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`;
|
||||
|
|
@ -19,6 +20,9 @@ class DefaultTagFormatter {
|
|||
if (!!this.namespace) {
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]${this.namespaceSeperator}${this.namespace}`;
|
||||
}
|
||||
if (!!this.prereleaseName) {
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]-${this.prereleaseName}.*[0-9]`;
|
||||
}
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]`;
|
||||
}
|
||||
Parse(tag) {
|
||||
|
|
@ -50,6 +54,9 @@ class DefaultTagFormatter {
|
|||
if (!!this.namespace) {
|
||||
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+${namespaceSeperator}${namespace}$`).test(tag);
|
||||
}
|
||||
if (!!this.prereleaseName) {
|
||||
return new RegExp(`^${this.tagPrefix}[0-9]+\.[0-9]+\.[0-9]+-${this.prereleaseName}\.[0-9]+$`).test(tag);
|
||||
}
|
||||
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+$`).test(tag);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue