-
Notifications
You must be signed in to change notification settings - Fork 3
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
Observations on npm's behavior #11
base: main
Are you sure you want to change the base?
Conversation
@@ -40,6 +41,13 @@ Analysis of the `name` property | |||
- `npm config set <Scope>:registry <Registry URL>` or `npm login --registry=<Registry URL> --scope=<Scope>` (`<Scope>` must include the `@` symbol). | |||
- One scope must only ever point to one registry. | |||
- One registry can host multiple scopes. | |||
- Observations from [email protected]: | |||
- `npm install` installs dependencies listed in the current `package.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing this is a WIP? Sorry if this is too early of a comment, but I think we should avoid documenting too many specific behaviors. The goal would likely be to call out specifically any unexpected behaviors around the name
field specifically but not much else. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good feedback. yes, a little early, and my additions in this PR definitely need organizing and elaboration.
I think the behavior shows that the description of the name
field in npm
is (understandably) assuming you are only thinking of package.json
describing a package being added to or installed from a registry. At runtime, when package.json
is in a module in your node_modules
folder, the name
field is essentially unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… except when it's got an exports field and is self-referencing - then it's quite used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb True! I don’t understand how widespread self-import is. (I didn’t even know it was a special case instead of just node_modules
resolution until a day ago or so!) Do you know if there are any stats?
I personally have been using relative URL imports inside a package so as not to repeat the package name everywhere and so I can run my code in a browser without transpilation/bundling.
No description provided.