翻新:在一个合并请求中对依赖项进行分组

Renovate: group dependencies in one merge request

我想将所有相关的依赖项组合到一个合并请求 (MR) 中,如下例所示:

在一个MR中(除了@angular/cli之外都是@angular/):

    "@angular/animations": "10.2.5",
    "@angular/cdk": "10.2.5",
    "@angular/common": "10.2.5",
    "@angular/compiler": "10.2.5",
    "@angular/core": "10.2.5",
    "@angular/forms": "10.2.5",
    "@angular/localize": "10.2.5",
    "@angular/platform-browser": "10.2.5",
    "@angular/platform-browser-dynamic": "10.2.5",
    "@angular/router": "10.2.5",
    "@angular/compiler-cli": "10.2.5"

在一个 MR 中:

    "@ngrx/effects": "10.1.2",
    "@ngrx/router-store": "10.1.2",
    "@ngrx/store": "10.1.2",
    "@ngrx/store-devtools": "10.1.2",
    "@ngrx/schematics": "10.1.2",

在一个 MR 中:

    "ag-grid-angular": "24.1.0",
    "ag-grid-community": "24.1.0"

在一个 MR 中:

    "@angular-eslint/builder": "1.2.0",
    "@angular-eslint/eslint-plugin": "1.2.0",
    "@angular-eslint/eslint-plugin-template": "1.2.0",
    "@angular-eslint/schematics": "1.2.0",
    "@angular-eslint/template-parser": "1.2.0",

如果我有这个package.json:

"dependencies": {
    "@angular/animations": "10.2.5",
    "@angular/cdk": "10.2.5",
    "@angular/common": "10.2.5",
    "@angular/compiler": "10.2.5",
    "@angular/core": "10.2.5",
    "@angular/forms": "10.2.5",
    "@angular/localize": "10.2.5",
    "@angular/platform-browser": "10.2.5",
    "@angular/platform-browser-dynamic": "10.2.5",
    "@angular/router": "10.2.5",
    "@ng-bootstrap/ng-bootstrap": "7.0.0",
    "@ng-select/ng-select": "5.1.0",
    "@ngrx/effects": "10.1.2",
    "@ngrx/router-store": "10.1.2",
    "@ngrx/store": "10.1.2",
    "@ngrx/store-devtools": "10.1.2",
    "@ngx-translate/core": "13.0.0",
    "@ngx-translate/http-loader": "6.0.0",
    "ag-grid-angular": "24.1.0",
    "ag-grid-community": "24.1.0",
    "bootstrap": "4.6.0",
    "crypto-js": "4.0.0",
    "fbc-iam-angular": "2.0.0",
    "ngx-toastr": "13.2.1",
    "rxjs": "6.6.7",
    "tslib": "2.1.0",
    "zone.js": "0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.1002.1",
    "@angular-eslint/builder": "1.2.0",
    "@angular-eslint/eslint-plugin": "1.2.0",
    "@angular-eslint/eslint-plugin-template": "1.2.0",
    "@angular-eslint/schematics": "1.2.0",
    "@angular-eslint/template-parser": "1.2.0",
    "@angular/cli": "10.2.3",
    "@angular/compiler-cli": "10.2.5",
    "@foundation/npm-oss-clearing": "2.2.0",
    "@ngrx/schematics": "10.1.2",
    "@types/jest": "24.9.1",
    "@typescript-eslint/eslint-plugin": "4.18.0",
    "@typescript-eslint/parser": "4.18.0",
    "eslint": "7.22.0",
    "eslint-config-airbnb-typescript": "12.3.1",
    "eslint-plugin-cypress": "2.11.2",
    "eslint-plugin-header": "3.1.1",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jest": "24.3.6",
    "eslint-plugin-promise": "4.3.1",
    "eslint-plugin-rxjs": "3.1.3",
    "eslint-plugin-unicorn": "28.0.2",
    "https-proxy-agent": "2.2.4",
    "jest": "24.9.0",
    "jest-marbles": "2.5.1",
    "jest-preset-angular": "7.1.1",
    "jspdf": "2.3.1",
    "ng-mocks": "11.9.1",
    "ngx-translate-testing": "5.1.0",
    "typescript": "4.0.3"
  }

并且我想将一些依赖项分组到一个 MR 中(在这种情况下,将具有相同名称的那些分组在一起)。

测试 1:失败 -> 我得到一个只有 @angular/cdk 升级的 MR。这里是 renovate.json:

{
  "gradle-lite": {
    "enabled": true
  },
  "gradle": {
    "enabled": false
  },
  "docker-compose": {
    "enabled": false
  },
  "dockerfile": {
    "enabled": false
  },
  "gitlabci": {
    "enabled": false
  },
  "packageRules": [
    {
      "groupName": "angular-eslint",
      "matchPackagePatterns": [
        "^@angular-eslint/"
      ]
    },
    {
      "groupName": "typescript-eslint",
      "matchPackagePatterns": [
        "^@typescript-eslint/"
      ]
    },
    {
      "groupName": "angular",
      "matchPackagePatterns": [
        "^@angular/"
      ],
      "excludePackageNames": [
        "@angular/cli"
      ]
    },
    {
      "groupName": "ngrx",
      "matchPackagePatterns": [
        "^@ngrx/"
      ]
    },
    {
      "groupName": "ag-grid",
      "matchPackagePatterns": [
        "^ag-grid-"
      ]
    },
    {
      "groupName": "spring-boot",
      "matchPackagePrefixes": [
        "org.springframework.boot:"
      ]
    },
    {
      "groupName": "mapstruct",
      "matchPackagePrefixes": [
        "org.mapstruct:"
      ]
    },
    {
      "groupName": "springfox",
      "matchPackagePrefixes": [
        "io.springfox:"
      ]
    }
  ],
  "prConcurrentLimit": 1
}

测试 2:失败 -> 我得到一个 MR 几个更新 (@angular-devkit/build-angular, @angular/cdk, @typescript-eslint/eslint-plugin, @typescript-eslint/parser、cypress、org.apache.tika:tika-parsers、tslib 等等(npm 和 gradle 依赖混合)

{
  "gradle-lite": {
    "enabled": true
  },
  "gradle": {
    "enabled": false
  },
  "docker-compose": {
    "enabled": false
  },
  "dockerfile": {
    "enabled": false
  },
  "gitlabci": {
    "enabled": false
  },
  "packageRules": [
    {
      "groupName": "angular-eslint",
      "matchPackagePrefixes": [
        "@angular-eslint/"
      ]
    },
    {
      "groupName": "typescript-eslint",
      "matchPackagePrefixes": [
        "@typescript-eslint/"
      ]
    },
    {
      "groupName": "core-ui",
      "matchPackagePrefixes": [
        "@siemens/core-ui"
      ],
      "excludePackageNames": [
        "@siemens/core-ui-icons"
      ]
    },
    {
      "groupName": "angular",
      "matchPackagePrefixes": [
        "@angular/"
      ],
      "excludePackageNames": [
        "@angular/cli"
      ]
    },
    {
      "groupName": "ngrx",
      "matchPackagePrefixes": [
        "@ngrx/"
      ]
    },
    {
      "groupName": "ag-grid",
      "matchPackagePrefixes": [
        "ag-grid-"
      ]
    },
    {
      "groupName": "spring-boot",
      "matchPackagePrefixes": [
        "org.springframework.boot:"
      ]
    },
    {
      "groupName": "mapstruct",
      "matchPackagePrefixes": [
        "org.mapstruct:"
      ]
    },
    {
      "groupName": "springfox",
      "matchPackagePrefixes": [
        "io.springfox:"
      ]
    }
  ],
  "prConcurrentLimit": 1
}

在第一个 renovate.json 中我使用了 matchPackagePatterns,在第二个中我使用了 matchPackagePrefixes,但是没有人在工作。 我该怎么办?

注意:也有java个依赖关系,但我认为有了package.json就足以理解问题了。

提前致谢

显然这是一个错误

https://github.com/renovatebot/renovate/pull/9949

在25.18.5版本应该修复了