Intended for most users
First install the Salesforce CLI. Next install the commerce orchestration plugin
echo y | sfdx plugins:install ssh://git@github.com:forcedotcom/commerce-on-lightning-orchestration.git
Now, you can run the commerce commands.
sfdx commerce:setup
See below for the full list of commands.
Intended for plugin developers or people trying out a workaround and don't want to override there b2c sfdx plugin.
$ yarn install
$ bin/run commerce
When you’re ready to test-drive your plug-in from local git repo, link your git repo to Salesforce CLI.
Intended for plugin developers or people trying out a workaround and want this to be their default for sfdx b2c commands from inside the root of the git repo
sfdx plugins:link
sfdx commerce:devhub:auth [-c <filepath>] [-F <filepath>] [-J] [-i <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx commerce:open:devhubconfig [-e <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx commerce:scratchorg:create [-c <filepath>] [-a <string>] [-v <string>] [-u <string>] [-n <number>] [-p] [-g <string>] [-t <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx commerce:setup [-c <filepath>] [-u <string>] [-s <string>] [-t <string>] [-n <integer>] [-m <integer>] [-o <string>] [-f <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx commerce:devhub:auth [-c <filepath>] [-F <filepath>] [-J] [-i <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Authorize a devhub
USAGE
$ sfdx commerce:devhub:auth [-c <filepath>] [-F <filepath>] [-J] [-i <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-F, --server-cert=server-cert [default:
/Users/jarndt/.commerce/.certs/serve
r.crt] Server Cert file
-J, --use-jwt Use JWT to auth
-c, --configuration=configuration [default:
/Users/jarndt/.commerce/devhub-confi
guration.json] Pass in config to
override default
-i, --client-id=client-id Client Id for auth:web:login
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLE
sfdx commerce:devhub:auth --configuration devhub-configuration.json
sfdx commerce:open:devhubconfig [-e <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Open devhub-configuration.json file
USAGE
$ sfdx commerce:open:devhubconfig [-e <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-e, --editor=editor [default: vi] Editor to open file
with
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLE
sfdx commerce:open:devhubconfig -e atom
sfdx commerce:scratchorg:create [-c <filepath>] [-a <string>] [-v <string>] [-u <string>] [-n <number>] [-p] [-g <string>] [-t <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Create a scratch org
USAGE
$ sfdx commerce:scratchorg:create [-c <filepath>] [-a <string>] [-v <string>] [-u <string>] [-n <number>] [-p] [-g
<string>] [-t <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-a, --hub-org-admin-username=hub-org-admin-username [default: ceo@mydevhub.com] username
of the hub org admin
-c, --configuration=configuration [default:
/Users/jarndt/.commerce/devhub-confi
guration.json] Pass in config to
override default
-g, --scratch-org-alias=scratch-org-alias [default: devhub] Alias name for
this scratch org
-n, --scratch-org-number=scratch-org-number Which store to create from config
file scratchOrgs list -1 for all
stores
-p, --is-b2c-lite-access-perm-needed Should the script run sfdx
force:org:open and wait for you to
save B2CLiteAccessPerm?
-t, --type=type [default: b2c] b2b or b2c
-u, --scratch-org-admin-username=scratch-org-admin-username [default: demo@1commerce.com]
username of the admin to associate
with the scratch org.
-v, --api-version=api-version [default: 52.0] Version of current
Salesforce
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLE
sfdx commerce:scratchorg:create --configuration devhub-configuration.json
sfdx commerce:setup [-c <filepath>] [-u <string>] [-s <string>] [-t <string>] [-n <integer>] [-m <integer>] [-o <string>] [-f <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Setup a devhub and scratch org from start to finish with one command
USAGE
$ sfdx commerce:setup [-c <filepath>] [-u <string>] [-s <string>] [-t <string>] [-n <integer>] [-m <integer>] [-o
<string>] [-f <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-c, --configuration=configuration [default:
/Users/jarndt/.commerce/devhub-confi
guration.json] Pass in config to
override default
-f, --definitionfile=definitionfile [default:
/Users/jarndt/.commerce/config/store
-scratch-def.json] store scratch def
-m, --store-number=store-number [default: -1] Index number for the
store to be created
-n, --scratch-org-number=scratch-org-number [default: -1] Which store to create
from config file scratchOrgs list -1
for all stores
-o, --type=b2c|b2b|both [default: both] The type of store
you want to create
-s, --scratch-org-store-name=scratch-org-store-name [default: 1commerce] Name of scratch
org store
-t, --templatename=templatename [default: b2c-lite-storefront]
template to use to create a site
-u, --scratch-org-admin-username=scratch-org-admin-username [default: demo@1commerce.com]
username of the admin to associate
with the scratch org.
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLES
sfdx commerce:setup --configuration devhub-configuration.json
sfdx commerce:setup
We recommend using the Visual Studio Code (VS Code) IDE for your plugin development. Included in the .vscode
directory of this plugin is a launch.json
config file, which allows you to attach a debugger to the node process when running your commands.
To debug the hello:org
command:
- Start the inspector
If you linked your plugin to the sfdx cli, call your command with the dev-suspend
switch:
$ sfdx hello:org -u myOrg@example.com --dev-suspend
Alternatively, to call your command using the bin/run
script, set the NODE_OPTIONS
environment variable to --inspect-brk
when starting the debugger:
$ NODE_OPTIONS=--inspect-brk bin/run hello:org -u myOrg@example.com
- Set some breakpoints in your command code
- Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
- In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
- Hit the green play button to the left of the "Attach to Remote" launch configuration window. The debugger should now be suspended on the first line of the program.
- Hit the green play button at the top middle of VS Code (this play button will be to the right of the play button that you clicked in step #5).
Congrats, you are debugging!