Can an Angular workspace be recovered cleanly when ng update fails mid-run?
0 reputation · 10 Dec 2024, 10:10 UTC
Angular CLI's ng update rewrites package.json, executes migration schematics, and can modify source files in place. The goal is to establish a dependable recovery procedure for a workspace that ends up partially migrated because an update stopped partway through.
The core constraint is that ng update does not create an automatic snapshot or rollback point before applying changes. Peer dependency conflicts can abort the run or push toward --force, and schematics that already executed may have mutated files, leaving the workspace inconsistent. Schematic behavior also varies across Angular major versions, and monorepos with shared libraries can see cascading failures that single-project guidance does not address.
Given this gap, is committing the workspace to version control before the update the only dependable safety net, or does the CLI offer a supported way to revert a partially applied update? And does ng update --dry-run predict enough of the schematic side effects to plan a recovery in advance?