Skip to content

Commit 6a268d7

Browse files
authored
fix(audit)!: remove fallback to publish registries (#4639)
1 parent 73b3fab commit 6a268d7

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

.yarn/versions/9bb15e03.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
releases:
2+
"@yarnpkg/cli": major
3+
"@yarnpkg/plugin-npm": major
4+
"@yarnpkg/plugin-npm-cli": major
5+
6+
declined:
7+
- "@yarnpkg/plugin-compat"
8+
- "@yarnpkg/plugin-constraints"
9+
- "@yarnpkg/plugin-dlx"
10+
- "@yarnpkg/plugin-essentials"
11+
- "@yarnpkg/plugin-init"
12+
- "@yarnpkg/plugin-interactive-tools"
13+
- "@yarnpkg/plugin-nm"
14+
- "@yarnpkg/plugin-pack"
15+
- "@yarnpkg/plugin-patch"
16+
- "@yarnpkg/plugin-pnp"
17+
- "@yarnpkg/plugin-pnpm"
18+
- "@yarnpkg/plugin-stage"
19+
- "@yarnpkg/plugin-typescript"
20+
- "@yarnpkg/plugin-version"
21+
- "@yarnpkg/plugin-workspace-tools"
22+
- "@yarnpkg/builder"
23+
- "@yarnpkg/core"
24+
- "@yarnpkg/doctor"

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
1919
- The network settings configuration option has been renamed from `caFilePath` to `httpsCaFilePath`.
2020
- Set `nmMode` to `hardlinks-local` by default.
2121
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
22+
- `yarn npm audit` no longer takes into account publish registries. Use [`npmAuditRegistry`](https://yarnpkg.com/configuration/yarnrc#npmAuditRegistry) instead.
2223

2324
### **API Changes**
2425

@@ -38,6 +39,8 @@ The following changes only affect people writing Yarn plugins:
3839

3940
- `renderForm`'s `options` argument is now required to enforce that custom streams are always specified.
4041

42+
- `npmConfigUtils.getAuditRegistry` no longer takes a `Manifest` as its first argument.
43+
4144
### Installs
4245

4346
- The `pnpm` linker avoids creating symlinks that lead to loops on the file system, by moving them higher up in the directory structure.

packages/plugin-npm-cli/sources/commands/npm/audit.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ export default class AuditCommand extends BaseCommand {
142142
dependencies,
143143
};
144144

145-
const registry = npmConfigUtils.getAuditRegistry(workspace.manifest, {
146-
configuration,
147-
});
145+
const registry = npmConfigUtils.getAuditRegistry({configuration});
148146

149147
let result!: npmAuditTypes.AuditResponse;
150148
const httpReport = await LightReport.start({

packages/plugin-npm/sources/npmConfigUtils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ export function normalizeRegistry(registry: string) {
1515
return registry.replace(/\/$/, ``);
1616
}
1717

18-
// TODO: Remove the fallback on publishConfig
19-
export function getAuditRegistry(manifest: Manifest, {configuration}: {configuration: Configuration}) {
20-
const defaultRegistry = configuration.get(RegistryType.AUDIT_REGISTRY);
21-
if (defaultRegistry !== null)
22-
return normalizeRegistry(defaultRegistry);
23-
24-
return getPublishRegistry(manifest, {configuration});
18+
export function getAuditRegistry({configuration}: {configuration: Configuration}) {
19+
return getDefaultRegistry({configuration, type: RegistryType.AUDIT_REGISTRY});
2520
}
2621

2722
export function getPublishRegistry(manifest: Manifest, {configuration}: {configuration: Configuration}) {

0 commit comments

Comments
 (0)