About showed a bare "v0.21.5" for a checkout 1913 commits past the tag (`hermes --version`: "v0.21.5+1913.gf83a9e9"), because /api/health only reports the base release; the statusbar showed the version plus the exact commit beside it. VersionInfo.display_version is the short `<release>+<distance>` form and /api/health carries it as displayVersion (older backends fall back to the bare release). One renderer formatter, shortVersion, turns any version into that form, and About, the updates overlay, the statusbar and the command palette all label through it: "v0.21.5+1913". The full commit stays in the statusbar tooltip and the expanded version details.
11 lines
501 B
TypeScript
11 lines
501 B
TypeScript
/**
|
|
* The one short form every surface names a version by: `<release>+<distance>`
|
|
* (`0.21.5+1913`), matching `hermes --version` minus its commit. The commit
|
|
* (`.g<sha>`, `.dirty`) is build metadata the expanded version details show in
|
|
* full; in a label it only adds noise. Callers own the `v` prefix, which the
|
|
* localized copy already carries.
|
|
*/
|
|
export function shortVersion(version: string): string {
|
|
return version.replace(/^v/, '').replace(/(\+\d+)\.g[0-9a-f]+(?:\.dirty)?$/i, '$1')
|
|
}
|