MCPcopy Create free account
hub / github.com/angular/dev-infra / getSCMVersions

Function getSCMVersions

ng-dev/release/stamping/env-stamp.ts:62–83  ·  view source on GitHub ↗

* Get the versions for generated packages. The stamped versions are always based * on the workspace version. Relying on tags is less reliable because tags can be * modified easily in an untracked/uncontrolled way, and are less predictable with * regards to the source control revision currently be

(
  git: GitClient,
  mode: EnvStampMode,
)

Source from the content-addressed store, hash-verified

60 * In snapshot mode, we will include the current SHA along with the workspace version.
61 */
62function getSCMVersions(
63 git: GitClient,
64 mode: EnvStampMode,
65): {version: string; experimentalVersion: string} {
66 const version = getVersionFromWorkspacePackageJson(git).format();
67 const experimentalVersion = createExperimentalSemver(version).format();
68
69 if (mode === 'release') {
70 return {
71 version,
72 experimentalVersion,
73 };
74 }
75
76 const headShaAbbreviated = getCurrentSha(git).slice(0, 7);
77 const localChanges = hasLocalChanges(git) ? '-with-local-changes' : '';
78
79 return {
80 version: `${version}+sha-${headShaAbbreviated}${localChanges}`,
81 experimentalVersion: `${experimentalVersion}+sha-${headShaAbbreviated}${localChanges}`,
82 };
83}
84
85/** Get the current SHA of HEAD. */
86function getCurrentSha(git: GitClient) {

Callers 1

printEnvStampFunction · 0.85

Calls 6

createExperimentalSemverFunction · 0.85
getCurrentShaFunction · 0.85
hasLocalChangesFunction · 0.85
formatMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected