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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opt-in npm-on-ipfs support #907

Closed
2 tasks
olizilla opened this issue Apr 16, 2019 · 10 comments · Fixed by ipfs/ipfs-webui#1048
Closed
2 tasks

Add opt-in npm-on-ipfs support #907

olizilla opened this issue Apr 16, 2019 · 10 comments · Fixed by ipfs/ipfs-webui#1048
Assignees
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@olizilla
Copy link
Member

olizilla commented Apr 16, 2019

As per discussions over on ipfs-shipyard/npm-on-ipfs#94 we'd like make it easy for ipfs-desktop users to try out npm-on-ipfs, and co-host modules that they install.

  • Offer a prompt to install the ipfs-npm command line tools
  • alias it as npm or yarn
@olizilla olizilla added the kind/enhancement A net-new feature or improvement to an existing feature label Apr 16, 2019
@hacdias hacdias self-assigned this Apr 16, 2019
@olizilla
Copy link
Member Author

olizilla commented Apr 16, 2019

There are some UX challenges to solve here.

  • Should be easy to opt in to using ipfs-npm in place of npm. Perhaps a checkbox in the settings page is the simplest initial implementation
  • Should be easy to undo. If you want to reset back to regular npm then you should be able to just uncheck the box.

I'm sure there are more. @hacdias @ericronne drop any thoughts you have here!

@hacdias
Copy link
Member

hacdias commented Apr 16, 2019

I agree with the checkbox in settings. Also, I think that on a first run, if we detect that Node.js is installed, we could actively prompt the user.

@hacdias
Copy link
Member

hacdias commented Apr 21, 2019

So I was implementing this and an issue surged: I was thinking about aliasing ipfs-npm as npm and to do so I thought about replacing /usr/local/bin/npm with our script. Although this would create a loop on ipfs-npm where it'd call itself forever when looking up for npm.

We could set an alias on the user profile but this would require (1) finding the shell they're using and (2) finding a way to do this on Windows.

The other option I see is trying to set --package-manager to the right path.

@hacdias hacdias mentioned this issue Apr 21, 2019
2 tasks
@lidel
Copy link
Member

lidel commented May 10, 2019

I was thinking about aliasing ipfs-npm as npm and to do so I thought about replacing /usr/local/bin/npm with our script

This feels risky. I think we need to do a sanity check around this. Is moving binaries belonging to other packages installed in the system better than adding a directory in front of PATH variable?
Think about scenario when someone uninstalls npm. Our proxy be removed.

Unless I am, missing something,
adding a directory to the front of PATH seems the only "safe" way to override third party binaries.

@hacdias
Copy link
Member

hacdias commented May 10, 2019

@lidel I agree that it is risky changing binaries. For now, we decided just to install npm-on-ipfs package and tell the user to use ipfs-npm instead of regular npm/yarn commands. This needs some more thought because changing the variable PATH is not as easy as it seems since it might depend a lot on the shell the user is using.

On Windows it's relatively easy and we already do it to add IPFS to the PATH.

@DavidBurela
Copy link

Something to think about, is that a common developer pattern on Windows is to use WSL (Windows Subsystem for Linux).

I have IPFS Desktop installed on Windows and use it for my general use. But then I open WSL Ubuntu and use the Node development tools in there. It has access to all of the local disk and ports. So just detecting PATH= on Windows is not enough, but needs to be more generic.

@hacdias
Copy link
Member

hacdias commented May 11, 2019

@DavidBurela WSL is still running on a separate "world" so it will also be harder for us to detect the presence of Node.js on those situations. What if the user has 3 different distributions, all with Node.js and then they also have Node installed on Windows itself? What would you do?

@DavidBurela
Copy link

I think I misread how it was going to be detected. My thoughts were that all of the environments had access to the IPFS node running on localhost, so that can be used.

But after re-reading I realised that IPFS-Desktop simply looks up if it has access to npm, and if it does it tries to run npm install -g npm-on-ipfs (or prompts user to manually do it).

You can ignore my notes.

@ericronne
Copy link

This might be a good chance to co-opt @fsdiogo's help system. Each IPFS Experiment could be automatically installed upon release, and the user notified upon app launch, and offered the option to disable it, e.g. …

image

Settings could be home base for managing these add ons.

image

@ericronne
Copy link

ericronne commented May 16, 2019

And a less obtrusive, opt-in option …

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants