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

FUTURE: basic support for .npmrc file #23560

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

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Apr 25, 2024

Towards #16105

TODO:

  • support other auth methods besides authToken
  • add another private registry with different token and scope
  • add tests for deno compile
  • support in the LSP

bartlomieju added a commit that referenced this pull request Apr 26, 2024
Factored out from #23560 to make it
easier to review.
cli/http_util.rs Outdated
Comment on lines 361 to 365
let mut builder = self.get_no_redirect(new_url.clone())?;
if let Some((header_name, header_value)) = maybe_header.as_ref() {
builder = builder.header(header_name, header_value);
}
let new_response = builder.send().await?;
Copy link
Member

Choose a reason for hiding this comment

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

You should only serve auth tokens after a redirect if the original and redirected URL have the same origin.

bartlomieju added a commit that referenced this pull request Apr 26, 2024
@bartlomieju bartlomieju changed the title feat: discover .npmrc file [WIP] FUTURE: discover .npmrc file [WIP] May 6, 2024
@bartlomieju bartlomieju changed the title FUTURE: discover .npmrc file [WIP] FUTURE: basic support for .npmrc file May 6, 2024
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

Nice! Looks really good. Just a few comments.

.unwrap();
let mut relative_url = registry_root_dir.make_relative(specifier)?;
if relative_url.starts_with("../") {
return None;
Copy link
Member

Choose a reason for hiding this comment

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

I think we could make this more optimal by storing root_url_to_safe_local_dirname for each registry url in the constructor, then here getting the relative path from the self.root_dir_url, then check the first component for a match, then continue below

cli/npm/managed/resolvers/mod.rs Show resolved Hide resolved
cli/standalone/mod.rs Show resolved Hide resolved
cli/standalone/mod.rs Show resolved Hide resolved
Copy link
Member Author

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

It appears --reload flag is not working correctly if .npmrc is present and custom registries are used.

This is a blocker to landing this 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.

None yet

3 participants