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

feat(package-rules): warn for depName fallback #28547

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2886,6 +2886,12 @@ See also `excludePackageNames`.

The above will configure `rangeStrategy` to `pin` only for the package `angular`.

<!-- prettier-ignore -->
!!! note
`matchPackageNames` will try matching `packageName` first and then fall back to matching `depName`.
If the fallback is used, Renovate will log a warning, because the fallback will be removed in a future release.
Use `matchDepNames` instead.

### matchPackagePatterns

Use this field if you want to have one or more package names patterns in your package rule.
Expand All @@ -2904,6 +2910,12 @@ See also `excludePackagePatterns`.

The above will configure `rangeStrategy` to `replace` for any package starting with `angular`.

<!-- prettier-ignore -->
!!! note
`matchPackagePatterns` will try matching `packageName` first and then fall back to matching `depName`.
If the fallback is used, Renovate will log a warning, because the fallback will be removed in a future release.
Use `matchDepPatterns` instead.

### matchPackagePrefixes

Use this field to match a package prefix without needing to write a regex expression.
Expand All @@ -2922,8 +2934,11 @@ See also `excludePackagePrefixes`.

Like the earlier `matchPackagePatterns` example, the above will configure `rangeStrategy` to `replace` for any package starting with `angular`.

`matchPackagePrefixes` will match against `packageName` first, and then `depName`, however `depName` matching is deprecated and will be removed in a future major release.
If matching against `depName`, use `matchDepPatterns` instead.
<!-- prettier-ignore -->
!!! note
`matchPackagePrefixes` will try matching `packageName` first and then fall back to matching `depName`.
If the fallback is used, Renovate will log a warning, because the fallback will be removed in a future release.
Use `matchDepPatterns` instead.

### matchSourceUrlPrefixes

Expand Down
4 changes: 2 additions & 2 deletions lib/util/package-rules/package-names.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('util/package-rules/package-names', () => {
},
);
expect(result).toBeTrue();
expect(logger.logger.once.info).toHaveBeenCalled();
expect(logger.logger.once.warn).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -108,7 +108,7 @@ describe('util/package-rules/package-names', () => {
},
);
expect(result).toBeTrue();
expect(logger.logger.once.info).toHaveBeenCalled();
expect(logger.logger.once.warn).toHaveBeenCalled();
});
});
});
4 changes: 2 additions & 2 deletions lib/util/package-rules/package-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class PackageNameMatcher extends Matcher {
}

if (matchPackageNames.includes(depName)) {
logger.once.info(
logger.once.warn(
{ packageRule, packageName, depName },
'Use matchDepNames instead of matchPackageNames',
);
Expand All @@ -48,7 +48,7 @@ export class PackageNameMatcher extends Matcher {
}

if (excludePackageNames.includes(depName)) {
logger.once.info(
logger.once.warn(
{ packageRule, packageName, depName },
'Use excludeDepNames instead of excludePackageNames',
);
Expand Down
4 changes: 2 additions & 2 deletions lib/util/package-rules/package-patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class PackagePatternsMatcher extends Matcher {
return true;
}
if (matchPatternsAgainstName(matchPackagePatterns, depName)) {
logger.once.info(
logger.once.warn(
{ packageRule, packageName, depName },
'Use matchDepPatterns instead of matchPackagePatterns',
);
Expand Down Expand Up @@ -70,7 +70,7 @@ export class PackagePatternsMatcher extends Matcher {
}

if (matchPatternsAgainstName(excludePackagePatterns, depName)) {
logger.once.info(
logger.once.warn(
{ packageRule, packageName, depName },
'Use excludeDepPatterns instead of excludePackagePatterns',
);
Expand Down
4 changes: 2 additions & 2 deletions lib/util/package-rules/package-prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class PackagePrefixesMatcher extends Matcher {
return true;
}
if (matchPackagePrefixes.some((prefix) => depName.startsWith(prefix))) {
logger.once.info(
logger.once.warn(
{ packageName, depName },
'Use matchDepPatterns instead of matchPackagePrefixes',
);
Expand Down Expand Up @@ -52,7 +52,7 @@ export class PackagePrefixesMatcher extends Matcher {
return true;
}
if (excludePackagePrefixes.some((prefix) => depName.startsWith(prefix))) {
logger.once.info(
logger.once.warn(
{ packageName, depName },
'Use excludeDepPatterns instead of excludePackagePrefixes',
);
Expand Down