Command
update
Is this a regression?
The previous version in which this bug was not present was
not working in v19, v20 and v21, cannot confirm for other versions
Description
I maintain an Angular library that provides migrations via ng update.
The library is published through two different registries:
- GitHub Packages
- Verdaccio
The package contains:
{
"schematics": "./schematics/collection.json",
"ng-update": {
"migrations": "./schematics/migration.json"
}
}
and the migration is registered in:
{
"schematics": {
"migration-rfc-001": {
"version": "21.2.0",
"factory": "./migrations/rfc-001-utilities-modular-import/index#addUtilitiesModularImport"
}
}
}
The migration can be executed successfully when:
ng generate @company/library-name:migration-rfc-001
and also when using:
ng update @company/library-name \
--migrate-only \
--from 21.1.0 \
--to 21.2.0-next21.1
However, when performing a normal update from GitHub Packages:
ng update @company/library-name@21.2.0-next21.1
Angular updates the package but never executes the migration.
The exact same migration works correctly when the package is published to Verdaccio.
Expected behavior
Running:
ng update @company/library-name@21.2.0-next21.1
should:
- Update the dependency.
- Discover the migration.
- Execute the migration automatically.
Expected output similar to:
** Executing migrations of package '@company/library-name' **
Actual behavior
Angular updates package.json and reinstalls packages but never executes migrations.
Output:
Updating package.json with dependency @company/library-name @ "21.2.0-next21.1" (was "21.1.0")...
UPDATE package.json
✔ Cleaning node modules directory
✔ Installing packages.
No migration execution follows.
Reproduction
Initial version
"@company/library-name": "21.1.0"
Target version
"@company/library-name": "21.2.0-next21.1"
Command
ng update @company/library-name@21.2.0-next21.1 --verbose
Result
Package is updated.
Migration is not executed.
Evidence that the migration itself is valid
The migration executes successfully when invoked explicitly:
ng update @company/library-name \
--migrate-only \
--from 21.1.0 \
--to 21.2.0-next21.1 \
--verbose
Output:
** Executing migrations of package '@company/library-name' **
❯ Automatically does xyz during 21.2.0-next21.1 upgrade.
UPDATE src/styles.scss
Migration completed (1 file modified).
This demonstrates that Angular can:
- locate the package
- read
ng-update
- load
migration.json
- execute the migration implementation
Package verification
The published package contains:
schematics/collection.json
schematics/migration.json
schematics/migrations/rfc-001-utilities-modular-import/index.js
The installed package contains:
{
"schematics": "./schematics/collection.json",
"ng-update": {
"migrations": "./schematics/migration.json"
}
}
Tarballs from both registries were compared and contain the migration files.
Interesting registry difference
When inspecting registry metadata:
GitHub Packages
npm view @company/library-name@21.2.0-next21.1 --json
The returned metadata does not contain:
or
even though both entries exist inside the package's package.json.
Verdaccio
npm view @company/library-name@21.2.0-next21.1 --json --registry=http://localhost:4873
returns:
{
"schematics": "./schematics/collection.json",
"ng-update": {
"migrations": "./schematics/migration.json"
}
}
For packages published via Verdaccio, automatic migration execution works correctly.
Question
Does Angular CLI rely on registry metadata returned by the package registry when determining whether migrations should run during ng update?
If so, could a registry that does not expose the ng-update and schematics fields (while still shipping them inside the tarball) cause Angular CLI to skip migration execution during a normal update, even though:
works correctly?
Minimal Reproduction
See above.
Exception or Error
Your Environment
Angular CLI : 21.2.6
Angular : 21.2.6
Node.js : 22.13.0
Package Manager : npm 10.9.2
Operating System : win32 x64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/build-angular │ 21.2.6 │ ^21.1.2 │
│ @angular/animations │ 21.2.6 │ ^21.1.2 │
│ @angular/build │ 21.2.6 │ ^21.1.2 │
│ @angular/cdk │ 21.2.4 │ ^21.1.2 │
│ @angular/cli │ 21.2.6 │ ^21.1.2 │
│ @angular/common │ 21.2.6 │ ^21.1.2 │
│ @angular/compiler │ 21.2.6 │ ^21.1.2 │
│ @angular/compiler-cli │ 21.2.6 │ ^21.1.2 │
│ @angular/core │ 21.2.6 │ ^21.1.2 │
│ @angular/forms │ 21.2.6 │ ^21.1.2 │
│ @angular/platform-browser │ 21.2.6 │ ^21.1.2 │
│ @angular/platform-browser-dynamic │ 21.2.6 │ ^21.1.2 │
│ @angular/router │ 21.2.6 │ ^21.1.2 │
│ ng-packagr │ 21.2.2 │ ^21.2.2 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ vitest │ 4.1.7 │ ^4.1.7 │
│ zone.js │ 0.15.1 │ ~0.15.0 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Command
update
Is this a regression?
The previous version in which this bug was not present was
not working in v19, v20 and v21, cannot confirm for other versions
Description
I maintain an Angular library that provides migrations via
ng update.The library is published through two different registries:
The package contains:
{ "schematics": "./schematics/collection.json", "ng-update": { "migrations": "./schematics/migration.json" } }and the migration is registered in:
{ "schematics": { "migration-rfc-001": { "version": "21.2.0", "factory": "./migrations/rfc-001-utilities-modular-import/index#addUtilitiesModularImport" } } }The migration can be executed successfully when:
and also when using:
However, when performing a normal update from GitHub Packages:
Angular updates the package but never executes the migration.
The exact same migration works correctly when the package is published to Verdaccio.
Expected behavior
Running:
should:
Expected output similar to:
Actual behavior
Angular updates
package.jsonand reinstalls packages but never executes migrations.Output:
No migration execution follows.
Reproduction
Initial version
Target version
Command
Result
Package is updated.
Migration is not executed.
Evidence that the migration itself is valid
The migration executes successfully when invoked explicitly:
Output:
This demonstrates that Angular can:
ng-updatemigration.jsonPackage verification
The published package contains:
The installed package contains:
{ "schematics": "./schematics/collection.json", "ng-update": { "migrations": "./schematics/migration.json" } }Tarballs from both registries were compared and contain the migration files.
Interesting registry difference
When inspecting registry metadata:
GitHub Packages
The returned metadata does not contain:
"schematics"or
"ng-update"even though both entries exist inside the package's
package.json.Verdaccio
returns:
{ "schematics": "./schematics/collection.json", "ng-update": { "migrations": "./schematics/migration.json" } }For packages published via Verdaccio, automatic migration execution works correctly.
Question
Does Angular CLI rely on registry metadata returned by the package registry when determining whether migrations should run during
ng update?If so, could a registry that does not expose the
ng-updateandschematicsfields (while still shipping them inside the tarball) cause Angular CLI to skip migration execution during a normal update, even though:works correctly?
Minimal Reproduction
See above.
Exception or Error
Your Environment
Anything else relevant?
No response