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

Function assertPassingReleasePrechecks

ng-dev/release/precheck/index.ts:26–57  ·  view source on GitHub ↗
(
  config: ReleaseConfig,
  newVersion: yargs.SemVer,
  builtPackagesWithInfo: BuiltPackageWithInfo[],
)

Source from the content-addressed store, hash-verified

24 * @returns A boolean that indicates whether the prechecks are passing or not.
25 */
26export async function assertPassingReleasePrechecks(
27 config: ReleaseConfig,
28 newVersion: yargs.SemVer,
29 builtPackagesWithInfo: BuiltPackageWithInfo[],
30): Promise<boolean> {
31 if (config.prereleaseCheck === undefined) {
32 Log.warn(' ⚠ Skipping release pre-checks. No checks configured.');
33 return true;
34 }
35
36 // The user-defined release precheck function is supposed to throw errors upon unmet
37 // checks. We catch this here and print a better message and determine the status.
38 try {
39 // Note: We do not pass the `SemVer` instance to the user-customizable precheck
40 // function. This is because we bundled our version of `semver` and the version
41 // used in the precheck logic might be different, causing unexpected issues.
42 await config.prereleaseCheck(newVersion.format(), builtPackagesWithInfo);
43 Log.info(green(' ✓ Release pre-checks passing.'));
44 return true;
45 } catch (e) {
46 if (e instanceof ReleasePrecheckError) {
47 // Note: Error messaging is expected to be handled manually.
48 debug(e.message);
49 Log.error(` ✘ Release pre-checks failed. Please check the output above.`);
50 } else {
51 Log.error(e, '\n');
52 Log.error(` ✘ Release pre-checks errored with unexpected runtime error.`);
53 }
54
55 return false;
56 }
57}

Callers 1

handlerFunction · 0.85

Calls 2

formatMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected