-
Notifications
You must be signed in to change notification settings - Fork 240
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
rfc: new npm link command #3
Conversation
accepted/0003-npm-link-changes.md
Outdated
Broken out by command: | ||
|
||
### `npm link` | ||
### `npm unlink |
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.
Missing backtick here (and is this supposed to be npm link
& npm unlink
together (like the heading below)? or is there something missing for npm link
?)
What you are calling "ephemeral" may be a misnomer. The distinction in that use case seems to be that you are linking to a package in a separate repo, and that it may not be linked for all (or any other) developers. Whether or not it is a temporary state for "trying things out" doesn't matter. I have use cases where links will differ between developers, but the links may exist long-term, even permanently. I work on several different apps that share libraries. Each app or library is in its own repo. Not all developers on my team work on all apps or libraries, so it would be inappropriate to commit a package-lock dictating links to repos that may not even be cloned on other developers' systems. Further complicating matters, we prefix all our internal packages with our company initials to avoid naming collisions. (These are published in a private registry.) However, when changing directories in the command line, I find it tedious typing that prefix, so I clone the repos into directories named without the prefix. Other developers do not do this. So, where I might want to link to The point is that for many developer workflows, linking to local packages is going to be specific to the developer, and not specific to the package. Thus, committing a package-lock with links will cause headaches. |
I consider For instance, if I am working on an ecosystem of modules, then I will be (tirelessly) maintaining links between my local copies in a directory, or between my version of a microcomponent and the surrounding ecosystem depending on it. But, when I incrementally publish my improvements, I would not expect the links to be carried. Nor, would I want them to-- especially in cases where there is a 1-component:1-developer workflow. |
@JDvorak |
Because it is respected by anyone running npm install from within a cloned repository.
|
On further reflection, I realize that there are two different understandings of what a dependency is:
But, if you notice, the community seems to keep reinventing ways to express a separation between a variable's declaration and its initialization. The |
I'm having trouble seeing the difference between your version of npm link and the aliasing that was just ratified. |
If I could just do what I used to do with |
By "you" I think you mean @giltayar, who I was quoting there. (Tagging them so they can clarify their intent.) What I understood them to be asking for was very-short-term links, something closer to what npm's current behavior results in (where they're kept until you run
If I said that your concern is that there will be package lock churn between your installation and your co-workers because you have atypical way of cloning your repos and so when they make links they'd stomp on yours and vice versa? Would your concerns be alayed by storing this in a different file? (I'm not super keen on introducing Yet Another File, but in so far as I can tell, it's what's here, adding something new or remove the
It would not.
I'm confused as to how you think aliasing would actually solve this problem for you? Can you elaborate? Aliases are published as a part of the module metadata. They change the source of the module for everyone that uses them. They are not a local development tool, but a way to ease the use of forks (so you can switch without changing your source code). |
Yes! With the caveat that removing the links on each
I'm really not keen on introducing another file either! You could put the information in the npm home folder (usuually |
+1 for @giltayar's "ephemeral" use case as described here. My coworkers and I use links all the time but I'm pretty sure we wouldn't be interested in sharing them with each other. All our packages are in different repos; and so even if multiple developers were working on the same branch of repo A, which branch required that each developer instantiate a link, committing that link to the branch would not be sufficient to "enable" the link for all developers and would probably be otherwise confusing. I am very interested in not having Separately, very interested in having |
I just want to add a quick note, for others using npm 5 and wanting to restore the old behavior, where "npm install" does not delete symlinked packages: try updating to the latest version of npm 5. (npm 5.10.0, atm) I had been using the npm 5.6.0 that came with node 8.11, but then saw this comment. I tried updating to the latest 5.X version of npm, and this seems to have restored the old This is good enough for me, until we get a revamped |
Does anybody else have concerns about the revised I'd love to see |
Anybody know the answer to the following question (copied from the previous thread)?
|
The latest commit (npm-link: Revise for non-lock-file storage) looks perfect. Just what the doctor ordered. My monorepo build tool just got simpler! :-) |
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.
Yay Ratification!!one
So what's the status on this? npm 7 still deletes linked modules |
@ties-s What version of npm did you try it with? I ask because, in this issue, an npm dev (@nlf) suggests the bug may have been fixed by some changes to npm link between version 7.2.0 and 7.5.2, but the OP did not confirm whether those changes fixed it or not. (the lack of response suggested it was resolved, though) It will be good for someone to confirm if the bug is still present in the latest versions. (7.5.2+) [I'll eventually test it myself if no one else gets to it, but am too busy/lazy atm.] |
@Venryx I have npm@7.6.1 |
Try v7.7.5 just in case, and if there’s still problems, please file an issue. |
Just quickly tried it with npm 7.8.0 and the bug is still there. |
I tried with npm 7.8.0 and the bug is still there. Running This is a major issue for my team. We have to waste a lot of time relinking after installing new dependency versions. |
@joe-gre it sounds like you need to comment on npm/cli#2372 which is marked as closed, and apparently shouldn't be. |
Still happens with npm 7.11.2... 😞 |
And 7.18.1 ... |
And 7.24.0... |
This threw me off as well, since an NPM upgrade on one machine made only the last-linked stick around. I now have a |
This was originally discussed here: npm/npm#19421