max-mapper / monu

menubar process monitor mac app [ALPHA]
https://github.com/maxogden/monu/releases
BSD 2-Clause "Simplified" License
1.11k stars 74 forks source link

support installing/running npm bins #6

Open max-mapper opened 9 years ago

max-mapper commented 9 years ago

would be super cool if you could somehow easily install bins from npm

for example, if you could click a '+' button in the app, type a npm module name in, hit 'install and save as a process' and then it would automatically do npm install in the background, and update your config to have the new app added

remixz commented 9 years ago

crazy idea: with the protocol module (https://github.com/atom/atom-shell/blob/master/docs/api/protocol.md), what if projects that had executables (ex: ghost) could have a button in their README that links to something like monu://install/ghost, which when clicked would open up in monu, install, and then be running. the project's package.json could specify the command for monu, and any pre/post steps that need to be ran. it'd be sort of like heroku's deploy button, except for local apps!

max-mapper commented 9 years ago

@remixz http://media1.giphy.com/media/gLRDi5KnA3Fte/giphy.gif

max-mapper commented 9 years ago

was thinking about this more.

it would be cool to maybe be compatible with the heroku button

the only downside is we'd need the full heroku buildpack. it's doable but it might be too complex to start with...

we might be able to do something like https://nodei.co/ for NPM installable bins, where you could put a badge in your readme.

the requirement is they must be able to be installed with only 'npm install', no other steps needed.

so you would click the badge, monu would ask you if you wanna install the program, and it would install it and take you to a 'new process' window that is already filled out with all the details. at this point you can tweak the launch command or add environment variables and click 'save' and then start the process

max-mapper commented 9 years ago

it would also be cool to figure out how to do this in a way that wasn't monu specific... e.g. a defacto standard and try and get other people on board. what other apps/platforms might be interested in this kinda thing?

ryanramage commented 9 years ago

This is is an awesome idea. It reminds me of this, from a long time ago in couchapp land :)

@remixz I have just played with the protocol module, and it seems that it only registers for the app, not across the os/installed browsers. I would love for this to work, but maybe we need to track down another way register.

ryanramage commented 9 years ago

What about monu binding on a known port on localhost, an have a url with http://localhost:knownport/install/ghost

Which then prompts the user to install via a dialog from monu.

This seems scary, but there is nothing monu specific about this.

balupton commented 9 years ago

https://github.com/bevry/lazy-require with the save option seems like it will work for this

https://github.com/bevry/safeps can then be used for executing the binaries in a cross-platform compatible way, it also has helper functions for working with npm if you'd prefer to use it directly

balupton commented 9 years ago

@remixz https://github.com/npm/npm/issues/3669

zeke commented 9 years ago

it would be cool to maybe be compatible with the heroku button

@maxogden can you elaborate on this? I'm not sure what you mean. The Heroku Button is little more than a web interface that helps kick off a build using Heroku's Build API. But I'm not sure how this relates to this awesome protocol concept that @remixz outlined.

max-mapper commented 9 years ago

@zeke well I was thinking if you had an app that already was set up to build with the buildpack, you could add a e.g. monu:// link for it and people could install it directly into the monu.app as a deployed service rather than deploying to heroku

zeke commented 9 years ago

I see. One could use the buildpack, but that would be overkill. In essence the buildpack does this:

If by deployed service you mean a service running locally, then you already have node of course, and this thing could just be whittled down to npm install && npm start.

max-mapper commented 9 years ago

I was looking into custom protocols more and it seems possible:

https://gist.github.com/Zren/4150939288687aef1fd9

hardest part would be step 2. it would require a custom module that installs the protocol on the users machine when they install Monu.app

max-mapper commented 9 years ago

who wants to write this module!??

remixz commented 9 years ago

one issue with editing LaunchServices.plist on mac: http://apple.stackexchange.com/questions/50004/why-is-a-command-line-change-to-library-preferences-com-apple-launchservices-p (tl;dr: computer must be restarted for it to register)

also, i'm not even sure if that'd work... i think for a mac app to properly handle a URL, it needs to handle it natively: http://stackoverflow.com/questions/9289613/handlegeturlevent-doesnt-get-called

remixz commented 9 years ago

i like @ryanramage's idea of binding to a port, seems a lot easier and is cross platform. the flow could be pretty smooth too... maybe the page just triggers the monu tray window to open with the appropriate details, and then just goes back to the previous page (i.e. the web page hosted would just be some JS running window.history.back())