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

fix(audit)!: remove fallback to publish registries #4639

Merged
merged 1 commit into from
Jul 19, 2022
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
24 changes: 24 additions & 0 deletions .yarn/versions/9bb15e03.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
releases:
"@yarnpkg/cli": major
"@yarnpkg/plugin-npm": major
"@yarnpkg/plugin-npm-cli": major

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https:
- The network settings configuration option has been renamed from `caFilePath` to `httpsCaFilePath`.
- Set `nmMode` to `hardlinks-local` by default.
- `yarn workspaces foreach` now automatically enables the `-v,--verbose` flag in interactive terminal environments.
- `yarn npm audit` no longer takes into account publish registries. Use [`npmAuditRegistry`](https://yarnpkg.com/configuration/yarnrc#npmAuditRegistry) instead.

### **API Changes**

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

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

- `npmConfigUtils.getAuditRegistry` no longer takes a `Manifest` as its first argument.

### Installs

- The `pnpm` linker avoids creating symlinks that lead to loops on the file system, by moving them higher up in the directory structure.
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-npm-cli/sources/commands/npm/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ export default class AuditCommand extends BaseCommand {
dependencies,
};

const registry = npmConfigUtils.getAuditRegistry(workspace.manifest, {
configuration,
});
const registry = npmConfigUtils.getAuditRegistry({configuration});

let result!: npmAuditTypes.AuditResponse;
const httpReport = await LightReport.start({
Expand Down
9 changes: 2 additions & 7 deletions packages/plugin-npm/sources/npmConfigUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ export function normalizeRegistry(registry: string) {
return registry.replace(/\/$/, ``);
}

// TODO: Remove the fallback on publishConfig
export function getAuditRegistry(manifest: Manifest, {configuration}: {configuration: Configuration}) {
const defaultRegistry = configuration.get(RegistryType.AUDIT_REGISTRY);
if (defaultRegistry !== null)
return normalizeRegistry(defaultRegistry);

return getPublishRegistry(manifest, {configuration});
export function getAuditRegistry({configuration}: {configuration: Configuration}) {
return getDefaultRegistry({configuration, type: RegistryType.AUDIT_REGISTRY});
}

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