MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / semverFromLatestTag

Function semverFromLatestTag

cli/scripts/build-cli.mjs:93–106  ·  view source on GitHub ↗

* Returns latest version (as x.y.z) from tags matching * `{tagPrefix}/vx.y.z`, or `0.0.0` if none.

(tagPrefix)

Source from the content-addressed store, hash-verified

91 * `{tagPrefix}/vx.y.z`, or `0.0.0` if none.
92 */
93function semverFromLatestTag(tagPrefix) {
94 const tags = git(['tag', '-l', `${tagPrefix}/v*`, '--sort=-v:refname']);
95 const tag = tags.split('\n').find(Boolean);
96 if (!tag) {
97 console.warn(`No tag found for ${tagPrefix}`);
98 return '0.0.0';
99 }
100 const prefixSlashV = `${tagPrefix}/v`;
101 if (!tag.startsWith(prefixSlashV)) {
102 console.warn(`No tag found for ${tagPrefix}`);
103 return '0.0.0';
104 }
105 return tag.slice(prefixSlashV.length);
106}
107
108function getShortHash() {
109 return git(['rev-parse', '--short', 'HEAD']);

Callers 1

getVersionFunction · 0.85

Calls 2

gitFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected