6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+ /** Retrieve the minor version for the provided version string. */
10
+ function getEarliestMinorVersion ( version : string ) {
11
+ const versionMatching = version . match ( / ^ ( \d + ) \. ( \d + ) \. * / ) ;
12
+
13
+ if ( versionMatching === null ) {
14
+ throw Error ( 'Unable to determine the minor version for the provided version' ) ;
15
+ }
16
+ const [ _ , major , minor ] = versionMatching ;
17
+
18
+ return `${ major } .${ minor } .0` ;
19
+ }
20
+
9
21
export const latestVersions : Record < string , string > & {
10
22
Angular : string ;
11
23
DevkitBuildAngular : string ;
@@ -14,8 +26,10 @@ export const latestVersions: Record<string, string> & {
14
26
// but ts_library doesn't support JSON inputs.
15
27
...require ( './latest-versions/package.json' ) [ 'dependencies' ] ,
16
28
17
- // These versions should be kept up to date with latest Angular peer dependencies.
18
- Angular : '~12.2.0-next.2' ,
29
+ // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
30
+ // Angular CLI minor version with earliest prerelease (appended with `-`) will match the latest
31
+ // Angular Framework minor.
32
+ Angular : `~${ getEarliestMinorVersion ( require ( '../package.json' ) [ 'version' ] ) } -` ,
19
33
20
34
// Since @angular -devkit/build-angular and @schematics/angular are always
21
35
// published together from the same monorepo, and they are both
0 commit comments