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: check project directory for .npmrc first #78

Closed
wants to merge 1 commit into from

Conversation

GfxKai
Copy link

@GfxKai GfxKai commented Nov 17, 2022

Proposed changes:

  1. Check project directory for .npmrc first
  2. Use project directory as default location for creating one if none found

NPM prioritises project-level .npmrc above the config defined at the user level (see here).

Current behaviour does not check the project directory for an .npmrc so our release stage fails in CI, despite having a valid .npmrc file pointing to a private GitLab registry.

If no .npmrc is found, creating one in the project repo feels safer than creating one in home—the change is obvious, explicit and scoped to the project rather than the user.

@changeset-bot
Copy link

changeset-bot bot commented Nov 17, 2022

🦋 Changeset detected

Latest commit: da26308

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
changesets-gitlab Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@JounQin
Copy link
Member

JounQin commented Jan 18, 2023

Thanks for PR first. Is this an accepted upstream feature? I don't want to have many differences with upstream repository.

@pmjhonwang
Copy link
Contributor

Proposed changes:

  1. Check project directory for .npmrc first
  2. Use project directory as default location for creating one if none found

NPM prioritises project-level .npmrc above the config defined at the user level (see here).

Current behaviour does not check the project directory for an .npmrc so our release stage fails in CI, despite having a valid .npmrc file pointing to a private GitLab registry.

If no .npmrc is found, creating one in the project repo feels safer than creating one in home—the change is obvious, explicit and scoped to the project rather than the user.

I did these in docker image build

@JounQin JounQin mentioned this pull request Oct 24, 2023
@JounQin
Copy link
Member

JounQin commented Oct 24, 2023

This could be breaking change, because a project level .npmrc could contain no registry config with auth token.

@JounQin
Copy link
Member

JounQin commented Oct 24, 2023

I believe you can just provide a fake NPM_TOKEN environment variable to bypass the check.

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.

None yet

4 participants