Support local installations of beautifiers
stevenzeck opened this issue · 9 comments
From @cdfa on December 11, 2018 13:49
Is your feature request related to a problem? Please describe.
Yes, I was trying to get this working for a project where in which the dev-dependencies state everything I'm using to develop the project except for editor specific stuff, but unibeautify seems to be unable to find beautifiers (like beautifier-js-beautify) when they are installed locally.
Describe the solution you'd like
Support locally installed beautifiers.
Describe alternatives you've considered
- Having the beautifiers globally installed, but the other stuff locally, with a comment in the package.json saying the beautifiers need to be installed globally.
Additional context
Copied from original issue: Unibeautify/unibeautify#213
@cdfa are you using the CLI, VSCode plugin or just calling it via Node?
From @cdfa on December 12, 2018 0:14
I was using the cli. When it's installed locally, I can run it with npx unibeautify
.
Applicable code:
https://github.com/Unibeautify/unibeautify-cli/blob/master/src/utils.ts#L3-L20
It may require a change to Unibeautify core at https://github.com/Unibeautify/unibeautify/blob/master/src/DependencyManager/NodeDependency.ts#L44-L46 as well as CLI to search for global in addition to local.
Pull Requests very welcome!
@Glavin001 is there a package out there that searches or lists locally installed packages? I can't seem to find one.
@stevenzeck Anything in https://github.com/prettier/prettier/blob/master/src/common/load-plugins.js look helpful?
Not really. Looking for something like this, only it searches in local: https://github.com/TremayneChrist/npm-g-search. Guess we could borrow that code and modify it to our needs...
Is running npx list <pkg-name>
out of the question? Otherwise, looking at the way npx
does it might be helpful.