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

Function deprecate

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

* Deprecates a specific version of a package. * @throws With the process log output if the deprecation failed. * @param packageName The name of the package to deprecate. * @param version The version of the package to deprecate. * @param message The deprecation message. * @param regist

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

Source from the content-addressed store, hash-verified

62 * @param registryUrl The registry URL to use for the deprecation.
63 */
64 static async deprecate(
65 packageName: string,
66 version: string,
67 message: string,
68 registryUrl: string | undefined,
69 ) {
70 const args = ['deprecate', `${packageName}@${version}`, message];
71
72 // If a custom registry URL has been specified, add the `--registry` flag.
73 if (registryUrl !== undefined) {
74 args.push('--registry', registryUrl);
75 }
76
77 try {
78 await ChildProcess.spawn('npm', args, {mode: 'silent'});
79 } catch (e) {
80 // TODO(alanagius): remove try/catch block once https://buganizer.corp.google.com/u/1/issues/512428441 is fixed.
81 Log.error(Array(80).join('#'));
82 Log.error(` ✘ An error occurred while deprecating "${packageName}".`);
83 Log.error(e);
84 Log.error(Array(80).join('#'));
85 }
86 }
87
88 /**
89 * Sets the NPM tag to the specified version for the given package.

Callers

nothing calls this directly

Calls 2

pushMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected