log4brains icon indicating copy to clipboard operation
log4brains copied to clipboard

docs: replace global install with npx

Open BearAlliance opened this issue 3 years ago • 3 comments
trafficstars

I had no trouble setting up a new project and creating ADRs without installing globally.

BearAlliance avatar Nov 24 '21 19:11 BearAlliance

Confirmed that at least npx log4brains preview worked.

fire avatar Jan 09 '22 10:01 fire

Sorry for the delay. Thank you for your proposal! However, I am not sure about this one... What are the pros compared to a global install? Because I have a a cons that bothers me: it is longer to type "npx log4brains " compared to "log4brains " On the other hand, it enables you to use different versions of Log4brains more easily, I agree. Also, we have to think about the consequences in the CI pipelines: is it easily possible to cache npx installed packages?

Happy to have feedback on this!

Related ADR: https://thomvaill.github.io/log4brains/adr/adr/20210113-distribute-log4brains-as-a-global-npm-package/

thomvaill avatar Sep 23 '22 13:09 thomvaill

What are the pros compared to a global install?

  • One command rather than two (install, then run) for people who do not use it often
  • npx will install the package before executing if it is not already present
  • Can specify the exact version in the command, so it's invocation is more easily scripted and reproducible

the consequences in the CI pipelines: is it easily possible to cache npx installed packages?

If a project includes log4brains in its dependencies or devDependencies, it will be cached along with the other node_modules. npx will prefer the package already installed if there is one.

From the docs

Package names provided without a specifier will be matched with whatever version exists in the local project.

BearAlliance avatar Jan 03 '23 16:01 BearAlliance