Skip to content

Commit

Permalink
test(manager): manager need to exports updateDependency or `extract…
Browse files Browse the repository at this point in the history
…PackageFile` when exporting `extractAllPackageFiles` (#27954)

Co-authored-by: Vivien Tintillier <vtintillier.privatedev@gmail.com>
  • Loading branch information
Shegox and vtintillier committed Mar 15, 2024
1 parent 42ee263 commit 5075318
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/development/adding-a-package-manager.md
Expand Up @@ -71,6 +71,8 @@ As another example, in order for Gradle to extract dependencies Renovate must fi
The `extractAllPackageFiles` function takes an array of filenames as input.
It returns an array of filenames and dependencies.

If you implement `extractAllPackageFiles` the manager must export as well either `updateDependency` or `extractPackageFile`.

### `getRangeStrategy(config)` (optional)

Write this optional function if you want the manager to support "auto" range strategies.
Expand Down
8 changes: 8 additions & 0 deletions lib/modules/manager/index.spec.ts
Expand Up @@ -59,6 +59,14 @@ describe('modules/manager/index', () => {
if (!module.extractPackageFile && !module.extractAllPackageFiles) {
return false;
}
// managers must export either extractPackageFile or a custom updateDependency function in addition to extractAllPackageFiles
if (
module.extractAllPackageFiles &&
!module.extractPackageFile &&
!module.updateDependency
) {
return false;
}
if (Object.values(module).some((v) => v === undefined)) {
return false;
}
Expand Down

0 comments on commit 5075318

Please sign in to comment.