* Checks whether a specific version of a package exists on the registry. * @returns Whether the version exists.
(
packageName: string,
version: string,
registryUrl: string | undefined,
)
| 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', |
nothing calls this directly
no test coverage detected