Galooshi / import-js

A tool to simplify importing JS modules
MIT License
525 stars 55 forks source link

Enable per-package installations #491

Open lencioni opened 6 years ago

lencioni commented 6 years ago

It would be nice if teams could specify a version of import-js they depend on in their package.json, and then have that version be what the editor uses when interacting in that project. This would couple well with #490, where there might be other plugins that are relevant for that project.

I think the trick here would be sorting out how the daemon works and how one might be able to run multiple daemons simultaneously.

trotzig commented 6 years ago

The daemon is run by invoking importjs start. If importjs is installed locally, we'd have to figure out a way to run it from within the local node_modules folder instead of invoking that command directly. Something like

$(npm bin)/importjs start

I guess we need to build into the editor plugins/clients some way of detecting the importjs binary to use. Something like:

if (file_exists($cwd/node_modules/.bin/importjs)) then
  $cwd/node_modules/.bin/importjs start
else 
  importjs start
fi

where $cwd is the project root.