* Invokes the `ng-dev release precheck` command in order to validate the * built packages or run other validations before actually releasing. * * This is run as an external command because prechecks can be customized * through the `ng-dev` configuration, and we wouldn't want to run prech
(
projectDir: string,
newVersion: semver.SemVer,
builtPackagesWithInfo: BuiltPackageWithInfo[],
)
| 166 | * from the `next` branch for older branches, like patch or an LTS branch. |
| 167 | */ |
| 168 | static async invokeReleasePrecheck( |
| 169 | projectDir: string, |
| 170 | newVersion: semver.SemVer, |
| 171 | builtPackagesWithInfo: BuiltPackageWithInfo[], |
| 172 | ): Promise<void> { |
| 173 | const precheckStdin: ReleasePrecheckJsonStdin = { |
| 174 | builtPackagesWithInfo, |
| 175 | newVersion: newVersion.format(), |
| 176 | }; |
| 177 | |
| 178 | try { |
| 179 | await this._spawnNpmScript(['ng-dev', 'release', 'precheck'], projectDir, { |
| 180 | // Note: We pass the precheck information to the command through `stdin` |
| 181 | // because command line arguments are less reliable and have length limits. |
| 182 | input: JSON.stringify(precheckStdin), |
| 183 | }); |
| 184 | |
| 185 | Log.info(green(` ✓ Executed release pre-checks for ${newVersion}`)); |
| 186 | } catch (e) { |
| 187 | // The `spawn` invocation already prints all stdout/stderr, so we don't need re-print. |
| 188 | // To ease debugging in case of runtime exceptions, we still print the error to `debug`. |
| 189 | Log.debug(e); |
| 190 | Log.error(` ✘ An error occurred while running release pre-checks.`); |
| 191 | throw new FatalReleaseActionError(); |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Invokes the `nvm install` command in order to install the correct Node.js version |