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

Function checkVersionExists

ng-dev/release/versioning/npm-command.ts:34–54  ·  view source on GitHub ↗

* Checks whether a specific version of a package exists on the registry. * @returns Whether the version exists.

(
    packageName: string,
    version: string,
    registryUrl: string | undefined,
  )

Source from the content-addressed store, hash-verified

32 }
33 await ChildProcess.spawn('npm', args, {
34 mode: 'silent',
35 ...(cwd ? {cwd} : {}),
36 ...(env ? {env} : {}),
37 });
38 }
39
40 /**
41 * Checks whether a specific version of a package exists on the registry.
42 * @returns Whether the version exists.
43 */
44 static async checkVersionExists(
45 packageName: string,
46 version: string,
47 registryUrl: string | undefined,
48 cwd?: string,
49 env?: NodeJS.ProcessEnv,
50 ): Promise<boolean> {
51 const args = ['view', `${packageName}@${version}`, 'version'];
52 if (registryUrl !== undefined) {
53 args.push('--registry', registryUrl);
54 }
55 try {
56 const result = await ChildProcess.spawn('npm', args, {
57 mode: 'silent',

Callers

nothing calls this directly

Calls 2

getErrorMessageFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected