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

Function handler

ng-dev/release/precheck/cli.ts:39–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39async function handler() {
40 // Note: Stdin input is buffered until we start reading from it. This allows us to
41 // asynchronously start reading the `stdin` input. With the default `readableFlowing`
42 // value of `null`, data is buffered. See: https://nodejs.org/api/stream.html#three-states.
43 const stdin = await readBufferFromStdinUntilClosed();
44 const config = await getConfig();
45 assertValidReleaseConfig(config);
46
47 // Parse the JSON metadata read from `stdin`.
48 const {builtPackagesWithInfo, newVersion: newVersionRaw} = JSON.parse(
49 stdin.toString('utf8'),
50 ) as ReleasePrecheckJsonStdin;
51
52 if (!Array.isArray(builtPackagesWithInfo)) {
53 Log.error(` ✘ Release pre-checks failed. Invalid list of built packages was provided.`);
54 process.exitCode = 1;
55 return;
56 }
57
58 const newVersion = semver.parse(newVersionRaw);
59 if (newVersion === null) {
60 Log.error(` ✘ Release pre-checks failed. Invalid new version was provided.`);
61 process.exitCode = 1;
62 return;
63 }
64
65 if (!(await assertPassingReleasePrechecks(config.release, newVersion, builtPackagesWithInfo))) {
66 process.exitCode = 1;
67 }
68}
69
70/** CLI command module for running checks before releasing. */
71export const ReleasePrecheckCommandModule: CommandModule<{}, {}> = {

Callers

nothing calls this directly

Calls 6

getConfigFunction · 0.85
assertValidReleaseConfigFunction · 0.85
toStringMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected