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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for private NPM packages #556

Open
hjdarnel opened this issue Jun 7, 2019 · 4 comments
Open

Support for private NPM packages #556

hjdarnel opened this issue Jun 7, 2019 · 4 comments
Assignees

Comments

@hjdarnel
Copy link

hjdarnel commented Jun 7, 2019

Hi!

I think it would be cool if a line such as const jest= require(@jest/core'); linked to https://www.npmjs.com/package/@jest/core

Thanks! Will be recommending this extension to my coworkers 馃槃

@stefanbuck
Copy link
Member

Thanks for reporting this issue! OctoLinker does support NPM namespaces already see2, but the issue here is slightly different. In your given example it links to https://github.com/facebook/jest, because we OctoLinker gets the url defined in the package.json in this case from here https://github.com/facebook/jest/blob/07c554e8dd74a80e89928ab96faf0387999fe977/packages/jest-core/package.json#L51-L55

Jest is a monorepo and actually this import should resolve to https://github.com/facebook/jest/tree/master/packages/jest-core in my opinion. While writing this reply I discovered this directory field which can be used to concatenate the url to solve as I suggested. This would also fix this issue for other monorepos as well if the follow this convention.

@stefanbuck stefanbuck self-assigned this Jun 7, 2019
@hjdarnel
Copy link
Author

hjdarnel commented Jun 7, 2019

Hi @stefanbuck, thanks for responding! In my attempt to anonymize my code I might've missed my actual problem. Here's the import that I'm actually attempting to dig into: const orderServiceClient = require('@casestack/tms-order-service-client').v15;

This is a private NPM package. I assumed it would just link me to https://www.npmjs.com/package/@casestack/tms-order-service-client.

Let me know if I can give any more details, or if private NPM packages isn't supported! Thanks!

@stefanbuck
Copy link
Member

Ahh I see, at least you pointed me to another problem 馃槈

Private packages aren't supported, simply because they are private and OctoLinker can't ensure that this package really exists on npm. We could just fallback to npmjs.com/package/whatever, but for example in my company we use an internal registry and such a blind guess would break links for us.

Adding an option to allow such a blind resolves could solve it, but I'm not a big fan of to many options. Let's see if this is a common ask and I'll cosnider it.

@stefanbuck stefanbuck changed the title Support for namespaced NPM packages require() Support for private NPM packages Jun 7, 2019
@daytonlowell
Copy link

I would really appreciate a setting to allow this. <3

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

No branches or pull requests

3 participants