@@ -40,8 +40,6 @@ const pickManifest = require('npm-pick-manifest') as (
4040 selector : string ,
4141) => PackageManifest ;
4242
43- const oldConfigFileNames = [ '.angular-cli.json' , 'angular-cli.json' ] ;
44-
4543const NG_VERSION_9_POST_MSG = colors . cyan (
4644 '\nYour project has been updated to Angular version 9!\n' +
4745 'For more info, please see: https://v9.angular.io/guide/updating-to-version-9' ,
@@ -367,20 +365,6 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
367365 }
368366
369367 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-
384368 this . logger . info ( 'Collecting installed dependencies...' ) ;
385369
386370 const rootDependencies = await getProjectDependencies ( this . context . root ) ;
@@ -623,6 +607,28 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
623607 return 1 ;
624608 }
625609
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+
626632 if ( manifest . version === node . package ?. version ) {
627633 this . logger . info ( `Package '${ packageName } ' is already up to date.` ) ;
628634 continue ;
0 commit comments