Handover execution from global CLI to local CLI when using NPM #2894
felipeplets
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
@felipeplets - Thank you for sharing this idea. You've done an excellent job outlining the technical requirements for this idea. Unfortunately, I don't understand the functional benefits of having different CLI versions in each SFDX project. Could you elaborate on your use cases? Specifically, could you highlight the business value associated with the advantages you shared? Thanks! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Salesforce CLI can be installed via the NPM registry, either globally or locally (in a project).
To install it globally you can run:
To install it locally in a given project you can use:
The advantages of installing it by project are
The disadvantage of only installing it locally is that you can't run SF CLI commands directly in your terminal like
sf --version
you would need to run it via NPM with a command likenpx sf --version
.You could install it globally and locally, so you could have something like:
In this scenario above the problem is that depending how we are running the CLI the version will be different. For instance a user running a command directly in their terminal will be using version 2.10.2, while a user running an NPM script in project A will use version 2.0.1.
A project I use regularly called NX solves this problem with the following approach, documented in their installation page:
Such feature would be really welcome for teams managing multiple projects or trying to enforce an SF CLI version centrally.
Beta Was this translation helpful? Give feedback.
All reactions