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: support .npmrc for custom repo detection in bun projects #34322

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

stephen-dahl
Copy link
Contributor

Changes

this moves the npm logic to read .npmrc into a helper function then calls that helper function in both npm and bun managers. it also exports npm's detectGlobalConfig function from bun.

Context

there is no issue for this PR

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@stephen-dahl stephen-dahl changed the title Bun/read npmrc feat: support .npmrc for custom repo detection in bun projects Feb 19, 2025
@stephen-dahl stephen-dahl marked this pull request as draft February 19, 2025 18:17
@stephen-dahl stephen-dahl marked this pull request as ready for review February 19, 2025 19:17
@@ -4,7 +4,7 @@ import { NpmDatasource } from '../../datasource/npm';

export { updateArtifacts } from './artifacts';
export { extractAllPackageFiles } from './extract';
export { getRangeStrategy, updateDependency } from '../npm';
export { getRangeStrategy, updateDependency, detectGlobalConfig } from '../npm';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't essential for this PR, please move it to a separate discussion. I'm not sure this export even achieves anything

Comment on lines +18 to +20
const formatNpmrc = (
...npmrcs: (string | undefined | null)[]
): string | undefined => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid nesting of functions

import { newlineRegex } from '../../../../../util/regex';
import type { ExtractConfig } from '../../../types';

export async function readNpmrc(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do this refactor in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants