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

Function getVersion

cli/scripts/build-cli.mjs:73–87  ·  view source on GitHub ↗

* Returns version from environment variable if set, * otherwise from local git repository. * Returns undefined if no version can be determined.

(tagPrefix)

Source from the content-addressed store, hash-verified

71 * Returns undefined if no version can be determined.
72 */
73function getVersion(tagPrefix) {
74 const envName = { cli: 'CLI_VERSION', js: 'JS_VERSION' }[tagPrefix];
75 const envVersion = envName ? process.env[envName]?.trim() : undefined;
76 if (envVersion) {
77 return envVersion;
78 }
79 try {
80 const shortHash = getShortHash();
81 const semver = semverFromLatestTag(tagPrefix);
82 return `${semver}+${shortHash}`;
83 } catch (error) {
84 console.warn(`Error getting version for ${tagPrefix}:`, error);
85 return undefined;
86 }
87}
88
89/**
90 * Returns latest version (as x.y.z) from tags matching

Callers 1

build-cli.mjsFile · 0.85

Calls 3

getShortHashFunction · 0.85
semverFromLatestTagFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected