Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit487486a

Browse files
committed
refactor(@schematics/angular): automatically determine the version string to match latest Angular
Automatically determine the latest compatible Angular Framework version by using `~` matchingfor the current minor version of @schematics/angular.
1 parent04e9ffe commit487486a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

‎packages/schematics/angular/utility/latest-versions.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,30 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9+
/** Retrieve the minor version for the provided version string. */
10+
functiongetEarliestMinorVersion(version:string){
11+
constversionMatching=version.match(/^(\d+)\.(\d+)\.*/);
12+
13+
if(versionMatching===null){
14+
throwError('Unable to determine the minor version for the provided version');
15+
}
16+
const[_,major,minor]=versionMatching;
17+
18+
return`${major}.${minor}.0`;
19+
}
20+
921
exportconstlatestVersions={
1022
// These versions should be kept up to date with latest Angular peer dependencies.
11-
Angular:'~12.1.2',
1223
RxJs:'~6.6.0',
1324
ZoneJs:'~0.11.4',
1425
TypeScript:'~4.3.2',
1526
TsLib:'^2.2.0',
1627

28+
// As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
29+
// Angular CLI minor version with earliest prerelease (appended with `-`) will match the latest
30+
// Angular Framework minor.
31+
Angular:`~${getEarliestMinorVersion(require('../package.json')['version'])}-`,
32+
1733
// Since@angular-devkit/build-angular and @schematics/angular are always
1834
// published together from the same monorepo, and they are both
1935
// non-experimental, they will always have the same version.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp