angularnpmangular-upgrade

Is this correct, ng update --all only shows the upgrade options available?


If I run the command

ng update

I see a listing of items such as
@angular/cdk  6.4.7 > 8.2.0   ng update @angular/cdk
...
...

There might be additional packages that are outdated.

Or run ng update --all to try and update all at the same time.

It does not appear that the command by itself ng update makes any changes.

So, does the execution of the ng update --all make changes?

I just want to see ALL packages are detected to need updating.


Solution

  • Note: The ng update command allows for packages separated by spaces to be specified with additional arguments:

    ng update [packages] [options]
    

    Check out the ng update command docs for more info.


    This is because by default, the ng update command when specified without any arguments/packages will try to update all of the packages if possible.

    Here's the portion of the code of the update command which checks if no packages were specified:

    if (options.all || packages.length === 0) {
          // Either update all packages or show status
          return this.runSchematic({
            collectionName: '@schematics/update',
            schematicName: 'update',
            dryRun: !!options.dryRun,
            showNothingDone: false,
            additionalOptions: {
              force: options.force || false,
              next: options.next || false,
              verbose: options.verbose || false,
              packageManager,
              packages: options.all ? Object.keys(rootDependencies) : [],
            },
          });
        }
    

    From the code above, this also means that either specifying the --all option or not specifying any options at all will try to update all of the packages.


    Note: You can view the entire source code of the update command to see how the command works.