jspm / jspm-cli

ES Module Package Manager
https://jspm.org
Apache License 2.0
3.79k stars 272 forks source link

Should all global bins use local versions by default #2498

Closed guybedford closed 1 year ago

guybedford commented 5 years ago

Currently jspm install -g mocha would create a global mocha bin in /path/to/global/jspm_packages/.bin/mocha.

The idea is that this global /path/to/global/jspm_packages/.bin can be added to the PATH to get global bins support.

When using that mocha command, a very common scenario is wanting to ensure you are using the right version of the mocha command locally.

The suggestion is this - what if we make all global commands check the local project (process cwd), for a local version of that same command and then use that if it is available?

This seems a very useful property to have for global command installs.

The downside is opting out of the behaviour if you don't want it but jspm bin -g mocha can remain an alias to the global version specifically providing an opt-out path too.

jspm itself would certainly take advantage of this feature.

guybedford commented 5 years ago

Implemented in https://github.com/jspm/jspm-cli/pull/2496.