()
| 37 | } |
| 38 | |
| 39 | async 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. */ |
| 71 | export const ReleasePrecheckCommandModule: CommandModule<{}, {}> = { |
nothing calls this directly
no test coverage detected