-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
bin/package-unlink unlinks all packages instead of the one that was specified #6248
Comments
This is yucky. This is indeed an But it seems that won't be until at least npm@7. I've experimented a bunch and there appear to be a few different bugs. Some I can fix. I have a draft PR here: #6251 I'd like to also figure out a way to maintain the other links when unlinking one, but I think we'd have to create a file to track the links and re-create them all in the unlink script after unlinking. In other words, essentially write our own version of the NPM RFC proposal. A bigger concern is that I am seeing that often, after I link a second package, the code from the first package is no longer executing, even though the symlink is still there and the symlinked files have the changes. It's like there's a different version of the package also installed somewhere in the |
@loan-laux Yes! I hadn't thought about the cache. I don't know why that would override what's actually there but it's an idea to explore. |
I'm also seeing issues where npm link and docker are very problematic together that I'd rather see us use something else like yalc (https://github.com/whitecolor/yalc). I've tested with the new admin at the start and it was far less buggy. |
@mikemurray Since @aldeed's latest changes, I've found that I needed to use However, I do agree that Yalc looks like a much better solution. This looks like what we should implement! |
@loan-laux your suggestion worked for me. I think there was a disconnect for me between the plugin name used during the link is different than the unlink. I think a quick fix to the current script could be, either an error message suggesting |
@mikemurray 100% agreed. |
Definitely should be using the full pkg name for both link and unlink now. It's done that way so that non-Reaction pkgs can be linked, too. But I agree there could be ways to add sanity checks. I think it would also be easy to add a flag or something telling it to use yalc instead of link. Most of the script other than the link command would be the same (if I'm understanding yalc). Only problem is I think you'd need to update the node-dev Docker images to have yalc preinstalled. |
This past week, I've been running the The steps I've used for linking packages and running tests. # Install yalc globally
npm i -g yalc
# Go you the plugin, or package you want to publish
cd api-plugin-<name>/
# Publish package
yalc publish
# Go to reaction
cd reaction/
# Publish (use one of the following, preferably link)
yalc link @reactioncommerce/api-plugin-<name> # Safer, doesn't add to package.json
yalc add @reactioncommerce/api-plugin-<name> # Adds to package.json so be careful
# Make changes in the package and republish
cd api-plugin-<name>/
yalc push # Publishes and auto updates reaction (or any project that contains this as yalc dependency) |
Prerequisites
Issue Description
Running
bin/package-unlink some-plugin
(works for all plugins) seems to unlink all plugins and not justsome-plugin
. This is the case regardless of whether the plugin was linked withbin/package-link
beforehand or not.Steps to Reproduce
bin/package-link some-plugin
, then link another plugin withbin/package-link other-plugin
.docker exec -it reaction_api_1 bash
./usr/local/src/app/node_modules/@reactioncommerce
.ls -la
. Notice you have two symlinks in place: one forsome-plugin
and another forother-plugin
.bin/package-unlink some-plugin
to unlinksome-plugin
.ls-ls
. Notice that bothsome-plugin
andother-plugin
were unlinked.Possible Solution
No idea. Is this even on Reaction's side or is it an NPM issue?
The text was updated successfully, but these errors were encountered: