LinuxCommandLibrary

ng-update

Update Angular applications and dependencies

TLDR

Update all dependencies in the workspace

$ ng update
copy

Update a specific package
$ ng update [package]
copy

Update multiple packages
$ ng update [package1 package2 ...]
copy

Ignore peer dependency version mismatches
$ ng update [package] --force
copy

Allow updating when the repository contains modified or untracked files
$ ng update [package] --allow-dirty
copy

Update to prerelease versions, including beta and release candidates
$ ng update [package] --next
copy

Display additional details about internal operations
$ ng update [package] --verbose
copy

SYNOPSIS

ng update [package] [options]

PARAMETERS

--allow-dirty
    Allows update in a dirty Git working directory.

--dry-run
    Preview changes without applying updates.

--force
    Force update, skipping some checks.

--from version
    Update from a specific version.

--migrate-only
    Run only migration schematics, skip package updates.

--next
    Use next (beta/RC) versions for updates.

DESCRIPTION

The ng update command is part of the Angular CLI, a command-line interface tool for Angular applications. It automates the process of updating Angular packages, schematics, and dependencies to compatible newer versions. This includes updating @angular/core, @angular/cli, and other related packages while applying necessary migrations to keep the codebase compatible.

Running ng update analyzes your project's dependencies, checks for available updates, and executes schematics to migrate configurations, code, and assets. It supports updating specific packages or all Angular packages at once. This is crucial for leveraging new features, security fixes, and performance improvements in Angular.

Typically invoked from the root of an Angular project, it interacts with npm or yarn package managers. It ensures peer dependencies are resolved and provides a dry-run mode to preview changes without applying them. This command simplifies maintenance compared to manual package.json edits.

CAVEATS

Must run from Angular project root.
Requires Node.js, npm/yarn, and Git.
May fail on incompatible updates; use --dry-run first.

EXAMPLES

ng update @angular/cli - Update CLI.
ng update @angular/core - Update core packages.
ng update --dry-run - Preview all updates.

HISTORY

Introduced in Angular CLI v6.0.0 (May 2018) to automate migrations from manual updates. Evolved in later versions to support unified updates for Angular framework and ecosystem packages.

SEE ALSO

ng(1), npm(1), yarn(1)

Copied to clipboard