sfpu v0.0.6
sfpu
salesforce package utils - for working with unlocked packages
install
sfdx plugins:install sfpu
Setup
yarn build
yarn prepack
sfdx plugins link
Examples
sfdx sfpu:up:info -v devhub -n sf-core -m 1.1.0.1 -b
sfdx sfpu:release:report -v devhub -u sandbox1 --releaseplan ./examples/releasePlan.json
sfdx sfpu:scratchorg:create -v devhub --email --numberofdays 1 --orgalias test1 -c ./examples/project-scratch-def.json --adminemail ubyfish@example.com --json
sfdx sfpu:project:info -v devhub -u sandbox1
sfdx sfpu:up:version:latest -v devhub -n sf-sales -s
$ npm install -g sfpu
$ sfdx COMMAND
running command...
$ sfdx (--version)
sfpu/0.0.6 linux-x64 node-v16.19.0
$ sfdx --help [COMMAND]
USAGE
$ sfdx COMMAND
...
sfdx sfpu:project:info [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:release:report [-r <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:scratchorg:create [-e] [-x <string>] [-d <number>] [-a <string>] [-c <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:up:info [-n <string>] [-m <string>] [-b] [-o] [-i <string>] [-v <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:up:installed [-e -n <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:up:version:latest -n <string> [-r] [-s] [-v <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
sfdx sfpu:project:info [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Gets the Package information for this project from the target Org. Useful for getting tag information
USAGE
$ sfdx sfpu:project:info [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-u, --targetusername=<value> username or alias for the target
org; overrides default target org
-v, --targetdevhubusername=<value> username or alias for the dev hub
org; overrides default dev hub org
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Gets the Package information for this project from the target Org. Useful for getting tag information
EXAMPLES
sfpu:project:pkginfo --targetdevhubusername devhub@org.com --targetusername sfdxsit1
See code: src/commands/sfpu/project/info.ts
sfdx sfpu:release:report [-r <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Generate some report info from a releasePlan.json definition. If you supply targetusername it checks the org if installed
USAGE
$ sfdx sfpu:release:report [-r <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-r, --releaseplan=<value> supply the location of a valid
releasePlan.json
-u, --targetusername=<value> username or alias for the target
org; overrides default target org
-v, --targetdevhubusername=<value> username or alias for the dev hub
org; overrides default dev hub org
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Generate some report info from a releasePlan.json definition. If you supply targetusername it checks the org if
installed
EXAMPLES
sfpu:release:report --targetdevhubusername PROD --targetusername SIT1
sfpu:release:report --targetdevhubusername PROD --releaseplan ../releasePlan.json
See code: src/commands/sfpu/release/report.ts
sfdx sfpu:scratchorg:create [-e] [-x <string>] [-d <number>] [-a <string>] [-c <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Create new scratch org, configures previous or preview and email developer credentials
USAGE
$ sfdx sfpu:scratchorg:create [-e] [-x <string>] [-d <number>] [-a <string>] [-c <string>] [-v <string>] [-u <string>]
[--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-a, --orgalias=<value> Org alias
-c, --configpath=<value> Scratch Org Definition file Path -
defaults to ./config/scratch-org-con
fig/project-scratch-def.json
-d, --numberofdays=<value> number of days to keep the org
(defaults to 5)
-e, --email Email credenitals to users
(devhubuser)
-u, --targetusername=<value> username or alias for the target
org; overrides default target org
-v, --targetdevhubusername=<value> username or alias for the dev hub
org; overrides default dev hub org
-x, --adminemail=<value> Email address to set as admin -
otherwise derived from the devHub
user email
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Create new scratch org, configures previous or preview and email developer credentials
EXAMPLES
sfpu:org:newscratch --targetdevhubusername devhub@org.com
sfpu:org:newscratch --targetdevhubusername devhub@org.com --email --numberofdays 1 --orgalias so1 --configpath=./config/project-scratch-def.json
See code: src/commands/sfpu/scratchorg/create.ts
sfdx sfpu:up:info [-n <string>] [-m <string>] [-b] [-o] [-i <string>] [-v <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Get the latest package version info
USAGE
$ sfdx sfpu:up:info [-n <string>] [-m <string>] [-b] [-o] [-i <string>] [-v <string>] [--apiversion <string>]
[--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-b, --allbetas when supplied all beta versions of
the package version will be returned
- e.g. 1.1.0.1,1.1.0.2,1.1.0.2
-i, --versionid=<value> package version id 04t....
-m, --versionnumber=<value> pacakge version number e.g. 1.1.1.1
-n, --name=<value> name of the package
-o, --orgdeps show the dev hub dependency versions
-v, --targetdevhubusername=<value> username or alias for the dev hub
org; overrides default dev hub org
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Get the latest package version info
EXAMPLES
sfpu:info --name my-core-pkg --targetdevhubusername devhub@org.com --versionnumber 1.28.0.1
sfpu:info --name my-core-pkg --targetdevhubusername devhub@org.com versionId 04txxxxxxxxxxx
sfpu:info --name my-core-pkg --targetdevhubusername devhub@org.com --versionnumber 1.28.0.1 -b
See code: src/commands/sfpu/up/info.ts
sfdx sfpu:up:installed [-e -n <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Table view of installed packages in an org. can be filtered by supplied name
USAGE
$ sfdx sfpu:up:installed [-e -n <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-e, --exactmatch name of the package
-n, --name=<value> name of the package
-u, --targetusername=<value> username or alias for the target
org; overrides default target org
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Table view of installed packages in an org. can be filtered by supplied name
EXAMPLES
sfpu:installed --targetusername devhub@org.com
sfpu:installed --name my-core-pkg --targetusername devhub@org.com
See code: src/commands/sfpu/up/installed.ts
sfdx sfpu:up:version:latest -n <string> [-r] [-s] [-v <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
Get the latest package version info
USAGE
$ sfdx sfpu:up:version:latest -n <string> [-r] [-s] [-v <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-n, --name=<value> (required) name of the package
-r, --released relased packaged only
-s, --showversions Verbosly shows the versions in order
retrieved
-v, --targetdevhubusername=<value> username or alias for the dev hub
org; overrides default dev hub org
--apiversion=<value> override the api version used for
api requests made by this command
--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
DESCRIPTION
Get the latest package version info
EXAMPLES
sfpu:version:latest --name my-core-pkg --targetdevhubusername devhub@org.com
sfpu:version:latest --name my-core-pkg --targetdevhubusername devhub@org.com --released
See code: src/commands/sfpu/up/version/latest.ts
Debugging your plugin
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:
1. 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!