Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng migrate --force should not fail if there is no migration #29949

Closed
1 task
jase88 opened this issue Mar 26, 2025 · 1 comment
Closed
1 task

ng migrate --force should not fail if there is no migration #29949

jase88 opened this issue Mar 26, 2025 · 1 comment

Comments

@jase88
Copy link

jase88 commented Mar 26, 2025

Command

update

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

First: I'm sorry, I'm not sure if this is a bug behavior or rather a feature request.

If executing
npx ng update @angular-devkit/build-angular --from=18.2.14 --to=18.2.15 --migrate-only --allow-dirty --force

the process exits with code 1

Package does not provide migrations.

I would have expected with the --force flag the command would not have failed and

Package does not provide migrations

would just be a warning.

If this is not a bug in the CLI, would a flag be possible to ignore missing migrations? (feature request)

My use case is that I want to execute ng update regular as renovate postUpgradeTask within the CI.

Minimal Reproduction

  • git clone https://github.com/jase88/ng-update-devkit-build-angular-migration-fail
  • npm run migrate-devkit-build-angular

Exception or Error

> The installed Angular CLI version is outdated.
> Installing a temporary Angular CLI versioned 18.2.16 to perform the update.
> Using package manager: npm
> Collecting installed dependencies...
> Found 69 dependencies.
> Package does not provide migrations.
>
> Process finished with exit code 1

Your Environment

Angular CLI: 18.2.14
Node: 22.14.0
Package Manager: npm 10.9.2
OS: darwin arm64

Angular: 18.2.13
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.14
@angular-devkit/build-angular   18.2.14
@angular-devkit/core            18.2.14
@angular-devkit/schematics      18.2.14
@angular/cli                    18.2.14
@schematics/angular             18.2.14
rxjs                            7.8.2
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

This occurs if using renovate to create merge-requests that executed ng update

for context the renovate.json:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": ["config:recommended"],
    {
      "groupName": "angular",
      "matchManagers": ["npm"],
      "matchPackageNames": ["@angular/{/,}**", "@angular-devkit/{/,}**"],
      "postUpgradeTasks": {
        "commands": [
          "npm ci --ignore-scripts --audit=false --fund=false",
          "npx ng update {{{depName}}} --from={{{currentVersion}}} --to={{{newVersion}}} --migrate-only --allow-dirty --force"
        ],
        "fileFilters": ["**/**"]
      },
      "separateMultipleMajor": true
    }
  ]
}
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Mar 26, 2025

The error happens because @angular-devkit/* packages never include migrations, which makes the command ng update @angular-devkit/build-angular invalid.

The --force flag is used to override peer dependency version conflicts.

The issue lies with your Renovate configuration. You should not run postUpgradeTasks when updating @angular-devkit/ packages.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants