Skip to content

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

Closed as not planned
@jase88

Description

@jase88

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
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions