-
Notifications
You must be signed in to change notification settings - Fork 3k
New command "fake" or "mock" #10000
Comments
Hey this is issue #10000 :) |
Congrats #10000 🎉 |
omg how can npm have 10'000 issue reports? :P |
Part 2 is one that I noticed and I think is super interesting to try to solve. Perhaps is the crux of the matter. |
@aredridel as you can see I've already opened a feature request for node that tries to fix this. |
We're closing this issue as it has gone thirty days without activity. In our experience if an issue has gone thirty days without any activity then it's unlikely to be addressed. In the case of bug reports, often the underlying issue will be addressed but finding related issues is quite difficult and often incomplete. If this was a bug report and it is still relevant then we encourage you to open it again as a new issue. If this was a feature request then you should feel free to open it again, or even better open a PR. For more information about our new issue aging policies and why we've instituted them please see our blog post. |
Hi folks
I'd like to discuss adding a new command "npm fake" or "npm mock" or something else that describes its functionality even better.
What does it do?
Basically it tells npm to use a specific package from a local source instead of installing it from the web. If we then npm install this specific package, npm creates a symlink to the location of that module inside node_modules instead of installing the official version from the web. Everything else would work the same.
Npm would save this information in some local settings file like ".npmsources". So everytime I'd run "npm install" in the root directory of my app, npm would be aware of the replaced package and act accordingly.
It's important to note that this is a temporary setting usually for development purposes. So we don't change the "package.json" file. Basically we just want to replace a specific package with another one during development. So the developer would always add the ".npmsources" file to ".gitignore", because it's really a local setting and not something we want to provide to the users.
But why?
In NPMv3 a lot has changed. In version 3, it tries to build the most efficient package tree. And additionally, it does no longer allow GIT-repositories to be in the "node_modules" folder.
But sometimes, I'd like to develop on 2 packages at the same time, to see if they work together flawlessly. In the past, I just cloned the in-development dependency into the node_modules folder and everything worked great. But that's no longer possible, so we need an alternative. An even more elegant one, if possible.
And I think the suggested new command would be exactly this. It would developers allow to use GIT repositories as submodules during development without changing anything in the "package.json" files, and it would allow NPM to manage where to place the symlink in the package tree, so that it remains efficient and clean.
Why not use npm link?
I've tried to use it at first, but I noticed that it's unusable for this task for the following reasons:
I've explained the situation a bit better in #5875. As you can see, there aren't any satisfactory solutions for this yet.
Please let me know what you think about it or if you don't understand something.
Thanks :)
The text was updated successfully, but these errors were encountered: