( config: T & Partial<DevInfraReleaseConfig>, )
| 138 | * notes. Elements in the list need to match with the groups as determined according |
| 139 | * to the `commitToGroup` option. |
| 140 | * |
| 141 | * Each group for the release notes, will appear in the order provided in `groupOrder` |
| 142 | * and any other groups will appear after these groups, sorted alphanumerically. |
| 143 | */ |
| 144 | groupOrder?: string[]; |
| 145 | } |
| 146 | |
| 147 | /** Configuration for releases in the dev-infra configuration. */ |
| 148 | export type DevInfraReleaseConfig = {release: ReleaseConfig}; |
| 149 | |
| 150 | /** Asserts that the given configuration is a valid `DevInfraReleaseConfig`. */ |
| 151 | export function assertValidReleaseConfig<T extends NgDevConfig>( |
| 152 | config: T & Partial<DevInfraReleaseConfig>, |
| 153 | ): asserts config is T & DevInfraReleaseConfig { |
| 154 | // List of errors encountered validating the config. |
| 155 | const errors: string[] = []; |
| 156 | |
| 157 | if (config.release === undefined) { |
| 158 | throw new ConfigValidationError('No configuration provided for `release`'); |
| 159 | } |
| 160 | if (config.release.representativeNpmPackage === undefined) { |
| 161 | errors.push(`No "representativeNpmPackage" configured for releasing.`); |
| 162 | } |
| 163 | if (config.release.npmPackages === undefined) { |
| 164 | errors.push(`No "npmPackages" configured for releasing.`); |
| 165 | } |
| 166 | if (config.release.buildPackages === undefined) { |
| 167 | errors.push(`No "buildPackages" function configured for releasing.`); |
| 168 | } |
| 169 | |
| 170 | if (config.release.representativeNpmPackage && config.release.npmPackages) { |
| 171 | const representativePkgEntry = config.release.npmPackages.find( |
| 172 | (pkg) => pkg.name === config.release?.representativeNpmPackage, |
| 173 | ); |
| 174 | |
| 175 | if (representativePkgEntry === undefined) { |
| 176 | errors.push( |
| 177 | `Configured "representativeNpmPackage" (${config.release.representativeNpmPackage}) ` + |
| 178 | `does not match a package in "npmPackages".`, |
| 179 | ); |
| 180 | } else if (representativePkgEntry.experimental) { |
| 181 | errors.push( |
| 182 | `Configured "representativeNpmPackage" (${config.release.representativeNpmPackage}) ` + |
| 183 | `corresponds to an experimental package. The representative NPM package is ` + |
| 184 | `expected to be a long-standing and non-experimental package of the project.`, |
no test coverage detected