Unibeautify/cli

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.

OK, yes, the CLI only looks for globally installed beautifiers via g-search, then loads them via requireg. It would be an enhancement to add support for local installations.

@Glavin001 is there a package out there that searches or lists locally installed packages? I can't seem to find one.

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...

cdfa commented

Is running npx list <pkg-name> out of the question? Otherwise, looking at the way npx does it might be helpful.