2

Usually DX CLI plugins are installed via sfdx plugins:install <plugin-name>

The examples provided from sfdx plugins:install --help list these:

$ sfdx plugins:install myplugin
$ sfdx plugins:install https://github.com/someuser/someplugin
$ sfdx plugins:install someuser/someplugin

If I write something I want to use internally, would sfdx plugins:install <https or ssh link to repo> work?

Or is it a better practice to host on an internal registry and provide consumers of the plugin some command to use like npm install git://<address>?

Any tips from admins or devs in similar situations?

2 Answers 2

3

You can certainly keep the code on your private git repo and have you users install using below commands

git clone <https/ ssh link of repo>

Then users will need to cd into the directory of the project cd <PluginFolderRoot>

After that they can execute the below command

sfdx plugins:link <pluginname>

The other alternative approach is to use sfdx plugins:install <github link>. In this case the node modules for the plugin gets installed at the location $HOME/.local/share/sfdx/node_modules/<Plugin root folder>

You will need to cd into same and run sfdx plugins:link <pluginname>

4
  • Awesome, marked this as the answer. Thanks @MohithShrivastava
    – trebleCode
    Sep 25, 2019 at 14:17
  • You mean you upvoted it ? There is a green mark to mark as answered ! Sep 25, 2019 at 14:18
  • 1
    forgot that, just marked it an answer not upvote
    – trebleCode
    Sep 25, 2019 at 14:34
  • you can also, if building this and having another version installed use sfdx plugins:link <path to root of project> to link and use the plugin. EX: sfdx plugins:link ./
    – Ronnie
    Oct 26, 2021 at 20:47
2

At work we have a plugin hosted on a private npm registry and are using GitLab for source control. After trying many different things, I found that providing the url is the best practice for installing private plugins:

sfdx plugins:install https://your-git-whatever.com/namespace/project-name.git

Doing it this way will allow you to run sfdx update and it will update the base sfdx package as well as any plugins you have installed. Just make sure you can authenticate to the url that you provide.

1
  • Great tip, thank you!
    – trebleCode
    Mar 20, 2020 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .