@@ -40,8 +40,6 @@ const pickManifest = require('npm-pick-manifest') as (
40
40
selector : string ,
41
41
) => PackageManifest ;
42
42
43
- const oldConfigFileNames = [ '.angular-cli.json' , 'angular-cli.json' ] ;
44
-
45
43
const NG_VERSION_9_POST_MSG = colors . cyan (
46
44
'\nYour project has been updated to Angular version 9!\n' +
47
45
'For more info, please see: https://v9.angular.io/guide/updating-to-version-9' ,
@@ -367,20 +365,6 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
367
365
}
368
366
369
367
this . logger . info ( `Using package manager: '${ this . packageManager } '` ) ;
370
-
371
- // Special handling for Angular CLI 1.x migrations
372
- if (
373
- options . migrateOnly === undefined &&
374
- options . from === undefined &&
375
- packages . length === 1 &&
376
- packages [ 0 ] . name === '@angular/cli' &&
377
- this . workspace &&
378
- oldConfigFileNames . includes ( path . basename ( this . workspace . filePath ) )
379
- ) {
380
- options . migrateOnly = true ;
381
- options . from = '1.0.0' ;
382
- }
383
-
384
368
this . logger . info ( 'Collecting installed dependencies...' ) ;
385
369
386
370
const rootDependencies = await getProjectDependencies ( this . context . root ) ;
@@ -623,6 +607,28 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
623
607
return 1 ;
624
608
}
625
609
610
+ if ( node . package ?. name === '@angular/cli' ) {
611
+ // Migrations for non LTS versions of Angular CLI are no longer included in @schematics /angular v12.
612
+ const toBeInstalledMajorVersion = + manifest . version . split ( '.' ) [ 0 ] ;
613
+ const currentMajorVersion = + node . package . version . split ( '.' ) [ 0 ] ;
614
+ if ( currentMajorVersion < 9 && toBeInstalledMajorVersion >= 12 ) {
615
+ const updateVersions : Record < number , number > = {
616
+ 1 : 6 ,
617
+ 6 : 7 ,
618
+ 7 : 8 ,
619
+ 8 : 9 ,
620
+ } ;
621
+
622
+ const updateTo = updateVersions [ currentMajorVersion ] ;
623
+ this . logger . error ( 'Updating multiple major versions at once is not recommended. ' +
624
+ `Run 'ng update @angular/cli@${ updateTo } ' in your workspace directory ` +
625
+ `to update to latest '${ updateTo } .x' version of '@angular/cli'.\n\n` +
626
+ 'For more information about the update process, see https://update.angular.io/.' ) ;
627
+
628
+ return 1 ;
629
+ }
630
+ }
631
+
626
632
if ( manifest . version === node . package ?. version ) {
627
633
this . logger . info ( `Package '${ packageName } ' is already up to date.` ) ;
628
634
continue ;
0 commit comments