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?

1

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>

| improve this answer | |
  • Awesome, marked this as the answer. Thanks @MohithShrivastava – trebleCode Sep 25 '19 at 14:17
  • You mean you upvoted it ? There is a green mark to mark as answered ! – Mohith Shrivastava Sep 25 '19 at 14:18
  • 1
    forgot that, just marked it an answer not upvote – trebleCode Sep 25 '19 at 14:34
1

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.

| improve this answer | |
  • Great tip, thank you! – trebleCode Mar 20 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.