The SFDX CLI, sfpowerkit plugin, and sfdmu are required for this plugin to work. If you have not already done so, please install both of these before continuing.
To install the sfpowerscripts plugin, run the following command:
$ sfdx plugins:install sfpowerkit$ sfdx plugins:install sfdmu$ sfdx plugins:install @dxatscale/sfpowerscripts
For automated installations as part of a CI process or Dockerfile:
$ echo 'y' | sfdx plugins:install @dxatscale/sfpowerscripts
$ npm install -g @dxatscale/sfpowerscripts$ sfdx COMMANDrunning command...$ sfdx (-v|--version|version)@dxatscale/sfpowerscripts/1.4.5 win32-x64 node-v12.16.3$ sfdx --help [COMMAND]USAGE$ sfdx COMMAND...
sfpowerscripts:orchestrator commands allow controlling attributes of a package in its stage by adding additional properties to each package as described in sfdx-project.json. This allows one to change the behaviour of the pipeline without changing any pipeline scripts
{"type":"data" //Mention the type of package, only to be used for source and data packages"aliasfy": <boolean>, // Only for source packages, allows to deploy a subfolder whose name matches the alias of the org when using deploy command"skipDeployOnOrgs": ["org1","org2"], // List of org's that this package should be skipped during deployment"isOptimizedDeployment": <boolean> // default:true for source packages, Utilizes the apex classes in the package for deployment,"skipTesting":<boolean> //default:false, skip apex testing installation of source package"skipCoverageValidation":<boolean> //default:false, skip apex coverage validation during validation phase,"destructiveChangePath:<path> // only for source, if enabled, this will be applied before the package is deployed"assignPermSetsPreDeployment: ["","",]"assignPermSetsPostDeployment: ["","",]"preDeploymentScript":<path> //All Packages"postDeploymentScript:<path> // All packages"reconcileProfiles:<boolean> //default:true Source Packages"ignoreOnStage": [ //Skip this package during the below orchestrator commands"prepare","validate"]}
Almost all the CLI commands have StatsD metrics capture enabled. This means you can setup deployment dashboards in a tool like Graphite or DataDog and capture your deployment statistics
To enable stasd, add the following environment variable, in the format below
# Set STATSD Environment Variables for logging metrics about this buildexport SFPOWERSCRIPTS_STATSD=trueexport SFPOWERSCRIPTS_STATSD_HOST=172.23.95.52export SFPOWERSCRIPTS_STATSD_PORT=8125 // Optional, defaults to 8125export SFPOWERSCRIPTS_STATSD_PROTOCOL=UDP // Optional, defualts to UDP, Supports UDP/TCP
Many of the commands listed below will output variables which may be consumed as flag inputs in subsequent commands. Simply pass the variable name to the command, and it will be substituted with the corresponding value, at runtime.
Eg.
$ sfdx sfpowerscripts:package:incrementBuildNumber -n <mypackage>​...​Output variable:sfpowerscripts_incremented_project_version=1.0.0.1​$ sfdx sfpowerscripts:package:source:create -n <mypackage> --versionnumber sfpowerscripts_incremented_project_version
The following output variables are currently supported:
sfpowerscripts_incremented_project_version
sfpowerscripts_artifact_directory
sfpowerscripts_artifact_metadata_directory
sfpowerscripts_delta_package_path
sfpowerscripts_package_version_id
sfpowerscripts_package_version_number
sfpowerscripts_pmd_output_path
sfpowerkit_deploysource_id
If you require access to the variables at the shell layer, you may do so using the readVars helper script, which is included as part of this package.
Commands that output variables optionally accept a --refname
flag that prefixes output variables with a user-specified string. The prefix is intended as a variable namespace that allows the same command to be invoked multiple times without overwriting the output variables.
$ sfdx sfpowerscripts:package:unlocked:create --refname core -n core_package -b -x -v DevHub​Output variables:core_sfpowerscripts_package_version_id=04t2v000007X2YRAA0​$ sfdx sfpowerscripts:CreateUnlockedPackage --refname utility -n utility_package -b -x -v Devhub​Output variables:utility_sfpowerscripts_package_version_id=04t2v000007X2YWAA0
Orchestrator Commands
sfdx sfpowerscripts:orchestrator:prepare
sfdx sfpowerscripts:orchestrator:validate
sfdx sfpowerscripts:orchestrator:quickbuild
sfdx sfpowerscripts:orchestrator:build
sfdx sfpowerscripts:orchestrator:deploy
sfdx sfpowerscripts:orchestrator:promote
sfdx sfpowerscripts:orchestrator:publish
Changelog (Track Releases)
sfdx sfpowerscripts:changelog:generate
Package Commands ( Build your own workflow)
sfdx sfpowerscripts:package:data:create
sfdx sfpowerscripts:package:data:install
sfdx sfpowerscripts:package:delta:create
sfdx sfpowerscripts:package:incrementBuildNumber
sfdx sfpowerscripts:package:source:create
sfdx sfpowerscripts:package:source:install
sfdx sfpowerscripts:package:unlocked:create
sfdx sfpowerscripts:package:unlocked:install
sfdx sfpowerscripts:source:deploy
sfdx sfpowerscripts:source:deployDestructiveManifest
Pool Management
sfdx sfpowerscripts:pool:delete
sfdx sfpowerscripts:pool:fetch
sfdx sfpowerscripts:pool:list
​
Static Analysis
sfdx sfpowerscripts:analyze:pmd
Apex tests
sfdx sfpowerscripts:apextests:trigger
sfdx sfpowerscripts:apextests:validate
Prepare a pool of scratchorgs with all the packages upfront, so that any incoming change can be validated in an optimized manner, Please note for this feature to work the devhub should be enabled and scratchorgpool (additional fields to ScratchOrgInfo object) should be deployed to devhub. Please see the instructions here. This command also install an unlocked package to the scratch org 'sfpowerscripts-artifact' (04t1P000000ka0fQAA) for skipping unchanged packages during a validation phase. This particular package can be prebuilt against your org and the ID could be overriden by setting up the environment variable SFPOWERSCRIPTS_ARTIFACT_UNLOCKED_PACKAGE
Prepare a pool of scratchorgs with all the packages upfront, so that any incoming change can be validated in an optimized manner,​​USAGE$ sfdx sfpowerscripts:orchestrator:prepare -t <string> [-e <number>] [-m <number>] [-f <filepath>][--installassourcepackages --installall] [-s <filepath>] [--succeedondeploymenterrors] [--keys <string>] [-v <string>][--apiversion <string>]​OPTIONS-e, --expiry=expiry [default: 2] Expiry of the scratchorg's created in the pool​-f, --config=config [default:config/project-scratch-def.json] Thefile path to the definition file forthe scratch org shape​-m, --maxallocation=maxallocation [default: 10] The size of thescratch org pool to be created​-s, --artifactfetchscript=artifactfetchscript The path to the script file that isused to fetch the validatedartifacts to be used in the preparecommand​-t, --tag=tag (required) The name/tag of thescratch org pool​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion API version to be used​--installall Install the dependencies,along withall the packages in the repo​--installassourcepackages Install all packages as Sourcepackages​​--keys=keys Keys to be used while installing anymanaged package dependent​​--succeedondeploymenterrors Do not fail the scratch orgs, if apackage failed to deploy, return thescratch org with packages till thelast failure​EXAMPLE$ sfdx sfpowerscripts:orchestrator:prepare -t CI_1 -v <devhub>
See code: lib/commands/sfpowerscripts/orchestrator/prepare.js​
Validate the incoming change against a prepared scratch org fetched from the provided pools (created using the prepare command). Please note it will only deploy the changed packages in the repo by comparing against the package version installed in the fetched scratchorg
Validate the incoming change against a prepared scratch org fetched from the provided pools.​USAGE$ sfdx sfpowerscripts:orchestrator:validate -u <string> -p <array> -f <filepath> -i <string> [--shapefile <string>][--coveragepercent <integer>] [-g <array>] [-x]​OPTIONS-f, --jwtkeyfile=jwtkeyfile (required) Path to a file containingthe private key​-g, --logsgroupsymbol=logsgroupsymbol Symbol used by CICD platform togroup/collapse logs in the console.Provide an opening group, and anoptional closing group symbol.​-i, --clientid=clientid (required) OAuth client ID, alsoknown as the consumer key​-p, --pools=pools (required) Fetch scratch-orgvalidation environment from one oflisted pools, sequentially​-u, --devhubusername=devhubusername (required) Authentication usernamefor Dev Hub​-x, --deletescratchorg Delete scratch-org validationenvironment, after the command hasfinished running​--coveragepercent=coveragepercent [default: 75] Minimum requiredpercentage coverage for validatingcode coverage of packages with Apexclasses​​--shapefile=shapefile Path to .zip file of scratch orgshape / metadata to deploy​EXAMPLE$ sfdx sfpowerscripts:orchestrator:validate -p "POOL_TAG_1,POOL_TAG_2" -u <devHubUsername> -i <clientId> -f <jwt_file>
See code: lib/commands/sfpowerscripts/orchestrator/validate.js​
Build packages (unlocked/source/data) in a repo in parallel, without validating depenencies or coverage in the case of unlocked packages. For diffcheck to work(build packages that are changed), it compares against the last know git tags, so make sure that you strategically place the tags push at the required state in your pipeline.
Build packages (unlocked/source/data) in a repo in parallel, without validating depenencies or coverage in the case of unlocked packages​USAGE$ sfdx sfpowerscripts:orchestrator:quickbuild [--diffcheck] [--gittag] [-r <string>] [-f <filepath>] [--artifactdir<directory>] [--waittime <number>] [--buildnumber <number>] [--executorcount <number>] [--branch <string>] [--tag<string>] [-v <string>] [--apiversion <string>]​OPTIONS-f, --configfilepath=configfilepath [default:config/project-scratch-def.json]Path in the current projectdirectory containing config filefor the packaging org​-r, --repourl=repourl Custom source repository URL to usein artifact metadata, overridesorigin URL defined in git config​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion override the api version used forapi requests made by this command​--artifactdir=artifactdir [default: artifacts] The directorywhere the generated artifact is tobe written​--branch=branch The git branch that this build istriggered on, Useful for metrics andgeneral identification purposes​--buildnumber=buildnumber [default: 1] The build number to beused for source packages, UnlockedPackages will be assigned thebuildnumber from Saleforce directlyif using .NEXT​--diffcheck Only build the packages which havechanged by analyzing previous tags​--executorcount=executorcount [default: 5] Number of parallelpackage task schedulors​--gittag Tag the current commit ID with anannotated tag containing the packagename and version - does not push tag​--tag=tag Tag the build with a label, usefulto identify in metrics​--waittime=waittime [default: 120] Wait time for commandto finish in minutes
See code: lib/commands/sfpowerscripts/orchestrator/quickbuild.js​
Build all packages (unlocked/source/data) in a repo in parallel, respecting the dependency of each packages and generate artifacts to a provided directory.For diffcheck to work(build packages that are changed), it compares against the last know git tags, so make sure that you strategically place the tags push at the required state in your pipeline.
Build all packages (unlocked/source/data) in a repo in parallel, respecting the dependency of each packages and generate artifacts to a provided directory​USAGE$ sfdx sfpowerscripts:orchestrator:build [--diffcheck] [--gittag] [-r <string>] [-f <filepath>] [--artifactdir<directory>] [--waittime <number>] [--buildnumber <number>] [--executorcount <number>] [--branch <string>] [--tag<string>] [-v <string>] [--apiversion <string>]​OPTIONS-f, --configfilepath=configfilepath [default:config/project-scratch-def.json]Path in the current projectdirectory containing config filefor the packaging org​-r, --repourl=repourl Custom source repository URL to usein artifact metadata, overridesorigin URL defined in git config​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion override the api version used forapi requests made by this command​--artifactdir=artifactdir [default: artifacts] The directorywhere the generated artifact is tobe written​--branch=branch The git branch that this build istriggered on, Useful for metrics andgeneral identification purposes​--buildnumber=buildnumber [default: 1] The build number to beused for source packages, UnlockedPackages will be assigned thebuildnumber from Saleforce directlyif using .NEXT​--diffcheck Only build the packages which havechanged by analyzing previous tags​--executorcount=executorcount [default: 5] Number of parallelpackage task schedulors​--gittag Tag the current commit ID with anannotated tag containing the packagename and version - does not push tag​--tag=tag Tag the build with a label, usefulto identify in metrics​--waittime=waittime [default: 120] Wait time for commandto finish in minutes
See code: lib/commands/sfpowerscripts/orchestrator/build.js​
Deploy packages from the provided aritfact directory, to a given org, using the order and configurable flags provided in sfdx-project.json skipifalreadyinstalled
only works provide the target org has sfpowerscripts-artifact' (04t1P000000ka0fQAA) installed. Please note you can deploy your own instance of 'sfpowerscripts-artifact' by building it from the repo and overriding using the environment variable SFPOWERSCRIPTS_ARTIFACT_UNLOCKED_PACKAGE
Deploy packages from the provided aritfact directory, to a given org, using the order and configurable flags provided in sfdx-project.json​USAGE$ sfdx sfpowerscripts:orchestrator:deploy -u <string> [--artifactdir <directory>] [--waittime <number>] [-g <array>][-t <string>] [--skipifalreadyinstalled]​OPTIONS-g, --logsgroupsymbol=logsgroupsymbol Symbol used by CICD platform togroup/collapse logs in the console.Provide an opening group, and anoptional closing group symbol.​-t, --tag=tag Tag the deploy with a label, usefulfor identification in metrics​-u, --targetorg=targetorg (required) [default: scratchorg]Alias/User Name of the targetenvironment​--artifactdir=artifactdir [default: artifacts] The directorycontaining artifacts to be deployed​​--skipifalreadyinstalled Skip the package installation if thepackage is already installed in theorg​--waittime=waittime [default: 120] Wait time for commandto finish in minutes​EXAMPLE$ sfdx sfpowerscripts:orchestrator:deploy -u <username>
See code: lib/commands/sfpowerscripts/orchestrator/deploy.js​
Promotes validated unlocked packages with code coverage greater than 75%
Promotes validated unlocked packages with code coverage greater than 75%​USAGE$ sfdx sfpowerscripts:orchestrator:promote -d <directory> [-v <string>]OPTIONS-d, --artifactdir=artifactdir (required) [default: artifacts] Thedirectory where artifacts arelocated​-v, --devhubalias=devhubalias [default: HubOrg] Provide the aliasof the devhub previouslyauthenticated, default value isHubOrg if using the AuthenticateDevhub task​​EXAMPLE$ sfdx sfpowerscripts:orchestrator:promote -d path/to/artifacts -v <org>
See code: lib/commands/sfpowerscripts/orchestrator/promote.js​
Publish packages to an artifact registry, using a user-provided script that is responsible for authenticating & uploading to the registry.
Publish packages to an artifact registry, using a user-provided script that is responsible for authenticating & uploading to the registry.​USAGE$ sfdx sfpowerscripts:orchestrator:publish -d <directory> -f <filepath> [-p -v <string>] [-t <string>]OPTIONS-d, --artifactdir=artifactdir (required) [default: artifacts] Thedirectory containing artifacts to bepublished​-f, --scriptpath=scriptpath (required) Path to script thatauthenticates and uploaded artifactsto the registry​-p, --publishpromotedonly Only publish unlocked packages thathave been promoted​-t, --tag=tag Tag the publish with a label, usefulfor identification in metrics​-v, --devhubalias=devhubalias Provide the alias of the devhubpreviously authenticated​​EXAMPLES$ sfdx sfpowerscripts:orchestrator:publish -f path/to/script$ sfdx sfpowerscripts:orchestrator:publish -p -v HubOrg
See code: lib/commands/sfpowerscripts/orchestrator/publish.js​
Generates release changelog, providing a summary of artifact versions, work items and commits introduced in a release. Creates a release definition based on artifacts contained in the artifact directory, and compares it to previous release definition in changelog stored on a source repository
Generates release changelog, providing a summary of artifact versions, work items and commits introduced in a release. Creates a release definition based on artifacts contained in the artifact directory, and compares it to previous release definition in changelog stored on a source repository​USAGE$ sfdx sfpowerscripts:changelog:generate -d <directory> -n <string> -w <string> -r <string> -b <string> [--limit<integer>] [--workitemurl <string>] [--showallartifacts]OPTIONS-b, --branchname=branchname (required) Repository branch inwhich the changelog files arelocated​-d, --artifactdir=artifactdir (required) [default: artifacts]Directory containing sfpowerscriptsartifacts​-n, --releasename=releasename (required) Name of the release forwhich to generate changelog​-r, --repourl=repourl (required) Repository in which thechangelog files are located. Assumesuser is already authenticated.​-w, --workitemfilter=workitemfilter (required) Regular expression usedto search for work items (userstories) introduced in release​--json format output as json​--limit=limit limit the number of releases todisplay in changelog markdown​--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level forthis command invocation​--showallartifacts Show all artifacts in changelogmarkdown, including those that havenot changed in the release​--workitemurl=workitemurl Generic URL for work items. Eachwork item ID will be appended to theURL, providing quick access to workitems​EXAMPLE$ sfdx sfpowerscripts:changelog:generate -n <releaseName> -d path/to/artifact/directory -w <regexp> -r <repoURL> -b<branchName>
See code: lib/commands/sfpowerscripts/changelog/generate.js​
This task is used to run a static analysis of the apex classes and triggers using PMD, Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task
This task is used to run a static analysis of the apex classes and triggers using PMD, Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task​USAGE$ sfdx sfpowerscripts:analyze:pmd [--sourcedir <string>] [--ruleset <string>] [--rulesetpath <string>] [--format<string>] [-o <string>] [--version <string>] [-b] [--refname <string>] [--json] [--logleveltrace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-b, --istobreakbuild Enable this option if the buildshould be reported as failure if 1or more critical defects arereported during the analysis​-o, --outputpath=outputpath The file to which the output forstatic analysis will be written​--format=text|textcolor|csv|emacs|summaryhtml|html|xml|xslt|yahtml|vbhtml|textpad [default: text]https://pmd.github.io/latest/pmd_userdocs_cli_reference.html#available-report-formats​--json format output as json​--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level forthis command invocation​--refname=refname Reference name to be prefixed tooutput variables​--ruleset=sfpowerkit|Custom [default: sfpowerkit] Inbuilt isthe default ruleset that comes withthe task, If you choose custom,please provide the path to theruleset​--rulesetpath=rulesetpath The path to the ruleset if you areutilizing your own ruleset​--sourcedir=sourcedir The directory that is to be analzedusing PMD, If omitted defaultproject diretory as mentioned insfdx-project.json will be used​--version=version [default: 6.26.0] The version ofPMD to be used for static analysis​EXAMPLES$ sfdx sfpowerscripts:analyze:pmd -b​Output variable:sfpowerscripts_pmd_output_path<refname>_sfpowerscripts_pmd_output_path
See code: lib/commands/sfpowerscripts/analyze/pmd.js​
Triggers Apex unit test in an org. Supports test level RunAllTestsInPackage, which optionally allows validation of individual class code coverage
Triggers Apex unit test in an org. Supports test level RunAllTestsInPackage, which optionally allows validation of individual class code coverage​USAGE$ sfdx sfpowerscripts:apextests:trigger [-u <string>] [-l <string>] [-n <string>] [-c] [--validatepackagecoverage][-s] [--specifiedtests <string>] [--apextestsuite <string>] [-p <integer>] [--waittime <string>] [--json] [--logleveltrace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-c, --validateindividualclasscoverageValidate that individual classes have a coverage greater than the minimum required percentage coverage, onlyavailable when test level is RunAllTestsInPackage​-l, --testlevel=RunSpecifiedTests|RunApexTestSuite|RunLocalTests|RunAllTestsInOrg|RunAllTestsInPackage[default: RunLocalTests] The test level of the test that need to be executed when the code is to be deployed​-n, --package=packageName of the package to run tests. Required when test level is RunAllTestsInPackage​-p, --coveragepercent=coveragepercent[default: 75] Minimum required percentage coverage, when validating code coverage​-s, --synchronousSelect an option if the tests are to be run synchronously​-u, --targetorg=targetorg[default: scratchorg] username or alias for the target org; overrides default target org​--apextestsuite=apextestsuitecomma-separated list of Apex test suite names to run​--jsonformat output as json​--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)[default: warn] logging level for this command invocation​--specifiedtests=specifiedtestscomma-separated list of Apex test class names or IDs and, if applicable, test methods to run​--validatepackagecoverageValidate that the package coverage is greater than the minimum required percentage coverage, only available whentest level is RunAllTestsInPackage​--waittime=waittime[default: 60] wait time for command to finish in minutes​EXAMPLES$ sfdx sfpowerscripts:apextests:trigger -u scratchorg -l RunLocalTests -s$ sfdx sfpowerscripts:apextests:trigger -u scratchorg -l RunAllTestsInPackage -n <mypackage> -c
See code: lib/commands/sfpowerscripts/apextests/trigger.js​
Validates apex test coverage in the org, Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task.
Validates apex test coverage in the org, Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task.​USAGE$ sfdx sfpowerscripts:apextests:validate -t <string> [-u <string>] [--json] [--logleveltrace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-t, --testcoverage=testcoverage (required) The percentage of testcoverage for apex clasess, thatshould be as per the last test runstatus​-u, --targetorg=targetorg [default: scratchorg] Alias orusername of the target org​--json format output as json​--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level forthis command invocation​EXAMPLE$ sfdx sfpowerscripts:apextests:validate -u scratchorg -t 80
See code: lib/commands/sfpowerscripts/apextests/validate.js​
Creates a versioned artifact from a source directory containing SFDMU-based data (in csv format and export json). The artifact can be consumed by release pipelines, to deploy the data to orgs
Creates a versioned artifact from a source directory containing SFDMU-based data (in csv format and export json). The artifact can be consumed by release pipelines, to deploy the data to orgs​USAGE$ sfdx sfpowerscripts:package:data:create -n <string> -v <string> [--artifactdir <directory>] [--diffcheck] [--branch<string>] [--gittag] [-r <string>] [--refname <string>]​OPTIONS-n, --package=package(required) The name of the package​-r, --repourl=repourlCustom source repository URL to use in artifact metadata, overrides origin URL defined in git config​-v, --versionnumber=versionnumber(required) The format is major.minor.patch.buildnumber . This will override the build number mentioned in thesfdx-project.json, Try considering the use of Increment Version Number task before this task​--artifactdir=artifactdir[default: artifacts] The directory where the artifact is to be written​--branch=branchThe git branch that this build is triggered on, Useful for metrics and general identification purposes​--diffcheckOnly build when the package has changed​--gittagTag the current commit ID with an annotated tag containing the package name and version - does not push tag​--refname=refnameReference name to be prefixed to output variables​EXAMPLES$ sfdx sfpowerscripts:package:data:create -n mypackage -v <version>$ sfdx sfpowerscripts:package:data:create -n <mypackage> -v <version> --diffcheck --gittagOutput variable:sfpowerscripts_artifact_directory<refname>_sfpowerscripts_artifact_directorysfpowerscripts_package_version_number<refname>_sfpowerscripts_package_version_number
See code: lib/commands/sfpowerscripts/package/data/create.js​
Installs a SFDMU-based data package consisting of csvfiles and export.json to a target org
Installs a SFDMU-based data package consisting of csvfiles and export.json to a target org​USAGE$ sfdx sfpowerscripts:package:data:install -n <string> -u <string> [--artifactdir <directory>] [-s][--skipifalreadyinstalled] [--subdirectory <directory>]​OPTIONS-n, --package=package (required) Name of the package to beinstalled​-s, --skiponmissingartifact Skip package installation if thebuild artifact is missing. Enablethis if artifacts are only beingcreated for modified packages​-u, --targetorg=targetorg (required) Alias/User Name of thetarget environment​--artifactdir=artifactdir [default: artifacts] The directorywhere the artifact is located​--skipifalreadyinstalled Skip the package installation if thepackage is already installed in theorg​--subdirectory=subdirectory Install specific subdirectory in thepackage. Useful when packageconsists of multiple discretesub-packages​EXAMPLE$ sfdx sfpowerscripts:package:data:install -n mypackage -u <org>
See code: lib/commands/sfpowerscripts/package/data/install.js​
This task is used to create a delta package between two commits and bundle the created delta as as a deployable artifact. Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task
This task is used to create a delta package between two commits and bundle the created delta as as a deployable artifact. Please ensure that the SFDX CLI and sfpowerkit plugin are installed before using this task​USAGE$ sfdx sfpowerscripts:package:delta:create -r <string> -v <string> [-n <string>] [-t <string>] [--repourl <string>][--branch <string>] [--artifactdir <directory>] [-x] [--refname <string>]OPTIONS-n, --package=package The name of the package​-r, --revisionfrom=revisionfrom (required) Provide the full SHACommit ID, from where the diffshould start generating​-t, --revisionto=revisionto [default: HEAD] If not set, the headcommit ID of the current branch isused​-v, --versionname=versionname (required) Provide a meaningful namesuch as the default value, so thisartifact can be identified in therelease​-x, --generatedestructivemanifest Check this option to generate adestructive manifest to be deployed​--artifactdir=artifactdir [default: artifacts] The directorywhere the artifact is to be written​--branch=branch The git branch that this build istriggered on, Useful for metrics andgeneral identification purposes​--refname=refname Reference name to be prefixed tooutput variables​--repourl=repourl Custom source repository URL to usein artifact metadata, overridesorigin URL defined in git config​EXAMPLES$ sfdx sfpowerscripts:package:delta:create -n <packagename> -r <61635fb> -t <3cf01b9> -v <version>​Output variable:sfpowerscripts_delta_package_path<refname>_sfpowerscripts_delta_package_pathsfpowerscripts_artifact_metadata_directory<refname>_sfpowerscripts_artifact_metadata_directorysfpowerscripts_artifact_directory<refname>_sfpowerscripts_artifact_directory
See code: lib/commands/sfpowerscripts/package/delta/create.js​
Increment the selected version counter by one and optionally commit changes to sfdx-project.json. This command does not push changes to the source repository
Increment the selected version counter by one and optionally commit changes to sfdx-project.json. This command does not push changes to the source repository​USAGE$ sfdx sfpowerscripts:package:incrementBuildNumber [--segment <string>] [-a -r <string>] [-n <string>] [-d <string>][-c] [--refname <string>]​OPTIONS-a, --appendbuildnumberSet the build segment of the version number to the build number rather than incremenenting​-c, --commitchangesMark this if you want to commit the modified sfdx-project json, Please note this will not push to the repo onlycommits in the local checked out repo, You would need to have a push to the repo at the end of the packaging task ifeverything is successfull​-d, --projectdir=projectdirThe directory should contain a sfdx-project.json for this command to succeed​-n, --package=packageThe name of the package of which the version need to be incremented,If not specified the default package is utilized​-r, --runnumber=runnumberThe build number of the CI pipeline, usually available through an environment variable​--refname=refnameReference name to be prefixed to output variables​--segment=Major|Minor|Patch|BuildNumber[default: BuildNumber] Select the segment of the version​EXAMPLES$ sfdx sfpowerscripts:package:incrementBuildNumber --segment BuildNumber -n packagename -c​Output variable:sfpowerscripts_incremented_project_version<refname>_sfpowerscripts_incremented_project_version
See code: lib/commands/sfpowerscripts/package/incrementBuildNumber.js​
This task simulates a packaging experience similar to unlocked packaging - creating an artifact that consists of the metadata wrapped into an artifact. The artifact can then be consumed by release tasks, to deploy the package
This task simulates a packaging experience similar to unlocked packaging - creating an artifact that consists of the metadata (e.g. commit Id), source code & an optional destructive manifest. The artifact can then be consumed by release pipelines, to deploy the package​USAGE$ sfdx sfpowerscripts:package:source:create -n <string> -v <string> [--artifactdir <directory>] [--diffcheck][--branch <string>] [--gittag] [-r <string>] [--refname <string>]​OPTIONS-n, --package=package(required) The name of the package​-r, --repourl=repourlCustom source repository URL to use in artifact metadata, overrides origin URL defined in git config​-v, --versionnumber=versionnumber(required) The format is major.minor.patch.buildnumber . This will override the build number mentioned in thesfdx-project.json, Try considering the use of Increment Version Number task before this task​--artifactdir=artifactdir[default: artifacts] The directory where the artifact is to be written​--branch=branchThe git branch that this build is triggered on, Useful for metrics and general identification purposes​--diffcheckOnly build when the package has changed​--gittagTag the current commit ID with an annotated tag containing the package name and version - does not push tag​--refname=refnameReference name to be prefixed to output variables​EXAMPLES$ sfdx sfpowerscripts:package:source:create -n mypackage -v <version>$ sfdx sfpowerscripts:package:source:create -n <mypackage> -v <version> --diffcheck --gittagOutput variable:sfpowerscripts_artifact_metadata_directory<refname>_sfpowerscripts_artifact_metadata_directorysfpowerscripts_artifact_directory<refname>_sfpowerscripts_artifact_directorysfpowerscripts_package_version_number<refname>_sfpowerscripts_package_version_number
See code: lib/commands/sfpowerscripts/package/source/create.js​
Installs a sfpowerscripts source package to the target org. skipifalreadyinstalled` only works provide the target org has sfpowerscripts-artifact' (04t1P000000ka0fQAA) installed. Please note you can deploy your own instance of 'sfpowerscripts-artifact' by building it from the repo and overriding using the environment variable SFPOWERSCRIPTS_ARTIFACT_UNLOCKED_PACKAGE
Installs a sfpowerscripts source package to the target org​USAGE$ sfdx sfpowerscripts:package:source:install -n <string> -u <string> [--artifactdir <directory>][--skipifalreadyinstalled] [-s] [--subdirectory <directory>] [-o] [-t] [--waittime <string>] [--refname <string>]​OPTIONS-n, --package=package (required) Name of the package to beinstalled​-o, --optimizedeployment Optimize deployment by triggeringtest classes that are in thepackage, rather than using the wholetests in the org​-s, --skiponmissingartifact Skip package installation if thebuild artifact is missing. Enablethis if artifacts are only beingcreated for modified packages​-t, --skiptesting Skips running test when deploying toa sandbox​-u, --targetorg=targetorg (required) Alias/User Name of thetarget environment​--artifactdir=artifactdir [default: artifacts] The directorywhere the artifact is located​​--refname=refname Reference name to be prefixed tooutput variables​--skipifalreadyinstalled Skip the package installation if thepackage is already installed in theorg​--subdirectory=subdirectory Install specific subdirectory in thepackage. Useful when packageconsists of multiple discretesub-packages​--waittime=waittime [default: 120] wait time for commandto finish in minutes​EXAMPLE$ sfdx sfpowerscripts:package:source:install -n mypackage -u <org>
See code: lib/commands/sfpowerscripts/package/source/install.js​
Creates a new package version, and generates an artifact that consists of the metadata (e.g. version Id). The artifact can then be consumed by release pipelines, to install the unlocked package. Utilize this task in a package build for DX Unlocked Package
Creates a new package version, and generates an artifact that consists of the metadata (e.g. version Id). The artifact can then be consumed by release pipelines, to install the unlocked package. Utilize this task in a package build for DX Unlocked Package​USAGE$ sfdx sfpowerscripts:package:unlocked:create -n <string> [-b] [-k <string> | -x] [--diffcheck] [--gittag] [-r<string>] [--versionnumber <string>] [-f <filepath>] [--artifactdir <directory>] [--enablecoverage] [-s] [--branch<string>] [--tag <string>] [--waittime <string>] [--refname <string>] [-v <string>] [--apiversion <string>]​OPTIONS-b, --buildartifactenabled[DEPRECATED - always generate artifact] Create a build artifact, so that this pipeline can be consumed by a releasepipeline​-f, --configfilepath=configfilepath[default: config/project-scratch-def.json] Path in the current project directory containing config file for thepackaging org​-k, --installationkey=installationkeyInstallation key for this package​-n, --package=package(required) ID (starts with 0Ho) or alias of the package to create a version of​-r, --repourl=repourlCustom source repository URL to use in artifact metadata, overrides origin URL defined in git config​-s, --isvalidationtobeskippedSkips validation of dependencies, package ancestors, and metadata during package version creation. Skippingvalidation reduces the time it takes to create a new package version, but package versions created withoutvalidation can’t be promoted.​-v, --targetdevhubusername=targetdevhubusernameusername or alias for the dev hub org; overrides default dev hub org​-x, --installationkeybypassBypass the requirement for having an installation key for this version of the package​--apiversion=apiversionoverride the api version used for api requests made by this command​--artifactdir=artifactdir[default: artifacts] The directory where the artifact is to be written​--branch=branchThe git branch that this build is triggered on, Useful for metrics and general identification purposes​--diffcheckOnly build when the package has changed​--enablecoveragePlease note this command takes a longer time to compute, activating this on every packaging build might notnecessary​--gittagTag the current commit ID with an annotated tag containing the package name and version - does not push tag​​--refname=refnameReference name to be prefixed to output variables​--tag=tagthe package version's tag​--versionnumber=versionnumberThe format is major.minor.patch.buildnumber . This will override the build number mentioned in thesfdx-project.json, Try considering the use of Increment Version Number task before this task​--waittime=waittime[default: 120] wait time for command to finish in minutes​EXAMPLES$ sfdx sfpowerscripts:package:unlocked:create -n <packagealias> -b -x -v <devhubalias> --refname <name>$ sfdx sfpowerscripts:package:unlocked:create -n <packagealias> -b -x -v <devhubalias> --diffcheck --gittag​Output variable:sfpowerscripts_package_version_id<refname>_sfpowerscripts_package_version_idsfpowerscripts_artifact_metadata_directory<refname>_sfpowerscripts_artifact_metadata_directorysfpowerscripts_artifact_directory<refname>_sfpowerscripts_artifact_directorysfpowerscripts_package_version_number<refname>_sfpowerscripts_package_version_number
See code: lib/commands/sfpowerscripts/package/unlocked/create.js​
Installs an unlocked package using sfpowerscripts metadata
Installs an unlocked package using sfpowerscripts metadata​USAGE$ sfdx sfpowerscripts:package:unlocked:install [-n <string>] [-u <string>] [-v <string> | -i] [-k <string>] [-a][--artifactdir <directory>] [--securitytype <string>] [-f] [-s undefined] [--upgradetype <string>] [--waittime<string>] [--publishwaittime <string>] [--json] [--logleveltrace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-a, --apexcompileonlypackage Each package installation triggers acompilation of apex, flag to triggercompilation of package only​-f, --skipifalreadyinstalled Skip the package installation if thepackage is already installed in theorg​-i, --packageinstalledfrom automatically retrieve the versionID of the package to be installed,from the build artifact​-k, --installationkey=installationkey installation key for key-protectedpackage​-n, --package=package Name of the package to be installed​-s, --skiponmissingartifact Skip package installation if thebuild artifact is missing. Enablethis if artifacts are only beingcreated for modified packages​-u, --targetorg=targetorg Alias/User Name of the targetenvironment​-v, --packageversionid=packageversionid manually input package version Id ofthe package to be installed​--artifactdir=artifactdir [default: artifacts] The directorywhere the artifact is located​--publishwaittime=publishwaittime [default: 10] number of minutes towait for subscriber package versionID to become available in the targetorg​--securitytype=AllUsers|AdminsOnly [default: AllUsers] Select thesecurity access for the packageinstallation​--upgradetype=DeprecateOnly|Mixed|Delete [default: Mixed] the upgrade typefor the package installation​--waittime=waittime [default: 120] wait time for commandto finish in minutes​EXAMPLE$ sfdx sfpowerscripts:package:unlocked:install -n packagename -u sandboxalias -i
See code: lib/commands/sfpowerscripts/package/unlocked/install.js​
Deletes the pooled scratch orgs from the Scratch Org Pool
Deletes the pooled scratch orgs from the Scratch Org Pool​USAGE$ sfdx sfpowerscripts:pool:delete -t <string> [-m] [-i | -a] [-v <string>] [--apiversion <string>] [--json][--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-a, --allscratchorgs Deletes all used and unused Scratchorgs from pool by the tag​-i, --inprogressonly Deletes all In Progress Scratch orgsfrom pool by the tag​-m, --mypool Filter only Scratch orgs created bycurrent user in the pool​-t, --tag=tag (required) tag used to identify thescratch org pool​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion override the api version used forapi requests made by this command​EXAMPLES$ sfdx sfpowerscripts:pool:delete -t core$ sfdx sfpowerscripts:pool:delete -t core -v devhub
See code: lib/commands/sfpowerscripts/pool/delete.js​
Gets an active/unused scratch org from the scratch org pool
Gets an active/unused scratch org from the scratch org pool​USAGE$ sfdx sfpowerscripts:pool:fetch -t <string> [-v <string>] [--apiversion <string>]OPTIONS-t, --tag=tag (required) (required) tag used toidentify the scratch org pool​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion override the api version used forapi requests made by this command​​​EXAMPLES$ sfdx sfpowerkit:pool:fetch -t core$ sfdx sfpowerkit:pool:fetch -t core -v devhub$ sfdx sfpowerkit:pool:fetch -t core -v devhub -m$ sfdx sfpowerkit:pool:fetch -t core -v devhub -s [email protected]
See code: lib/commands/sfpowerscripts/pool/fetch.js​
Retrieves a list of active scratch org and details from any pool. If this command is run with -m|--mypool, the command will retrieve the passwords for the pool created by the user who is executing the command.
Retrieves a list of active scratch org and details from any pool. If this command is run with -m|--mypool, the command will retrieve the passwords for the pool created by the user who is executing the command.​USAGE$ sfdx sfpowerscripts:pool:list [-t <string>] [-m] [-a] [-v <string>] [--apiversion <string>]OPTIONS-a, --allscratchorgs Gets all used and unused Scratchorgs from pool​-m, --mypool Filter the tag for any additionscreated by the executor of thecommand​-t, --tag=tag tag used to identify the scratch orgpool​-v, --targetdevhubusername=targetdevhubusername username or alias for the dev huborg; overrides default dev hub org​--apiversion=apiversion override the api version used forapi requests made by this command​EXAMPLES$ sfdx sfpowerscripts:pool:list -t core$ sfdx sfpowerscripts:pool:list -t core -v devhub$ sfdx sfpowerscripts:pool:list -t core -v devhub -m$ sfdx sfpowerscripts:pool:list -t core -v devhub -m -a
See code: lib/commands/sfpowerscripts/pool/list.js​
Deploy source to org using mdapi based deploy (converts source to mdapi and use mdapi deployment)
Deploy source to org using mdapi based deploy (converts source to mdapi and use mdapi deployment)​USAGE$ sfdx sfpowerscripts:source:deploy [-u <string>] [--sourcedir <string>] [--waittime <string>] [-c] [-f <string>] [-l<string>] [--specifiedtests <string>] [--apextestsuite <string>] [--ignorewarnings] [--ignoreerrors] [-b] [--refname<string>]​OPTIONS-b, --istobreakbuildifemptyUncheck this field, to allow for empty folders not to break build, useful in the case of pre/post step uniformityacross projects​-c, --checkonlyValidate a deployment, but don't save to the org, Use this for Stage 1/2 CI Run's​-f, --validationignore=validationignore[default: .forceignore] Validation only deployment has issues with certain metadata such as apexttestsuite, create adifferent file similar to .forceignore and use it during validate only deployment​-l, --testlevel=NoTestRun|RunSpecifiedTests|RunApexTestSuite|RunLocalTests|RunAllTestsInOrg[default: NoTestRun] The test level of the test that need to be executed when the code is to be deployed​-u, --targetorg=targetorg[default: scratchorg] Alias or username of the target org where the code should be deployed​--apextestsuite=apextestsuiteName of the Apex Test Suite that needs to be executed during this deployment​--ignoreerrorsIgnores the deploy errors, and continues with the deploy operation​--ignorewarningsIgnores any warnings generated during metadata deployment​​--refname=refnameReference name to be prefixed to output variables​--sourcedir=sourcedir[default: force-app] The source directory to be deployed​--specifiedtests=specifiedtestsSpecify a comma seperated values of Apex Test that need to be executed during this deployment​--waittime=waittime[default: 20] wait time for command to finish in minutes​EXAMPLES$ sfdx sfpowerscripts:source:deploy -u scratchorg --sourcedir force-app -c​Output variable:sfpowerkit_deploysource_id<refname_sfpowerkit_deploysource_id
See code: lib/commands/sfpowerscripts/source/deploy.js​
Delete components in org according to destructive manifest - an empty package.xml will be automatically created, Read more about the task at https://sfpowerscripts.com/tasks/deployment-tasks/deploy-destructive-maifest-to-an-org/​
Delete components in org according to destructive manifest - an empty package.xml will be automatically created, Read more about the task at https://sfpowerscripts.com/tasks/deployment-tasks/deploy-destructive-maifest-to-an-org/​USAGE$ sfdx sfpowerscripts:source:deployDestructiveManifest [-u <string>] [-m <string>] [-f <string> | -t <string>][--skiponmissingmanifest] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]​OPTIONS-f, --destructivemanifestfilepath=destructivemanifestfilepathThe location to the xml file which contains the destructive changes​-m, --method=Text|FilePath[default: Text] If text is specified, add the members in the next field, if URL, pass in the location of thedestructiveChanges.xml such as the raw git url​-t, --destructivemanifesttext=destructivemanifesttextType in the destructive manifest, follow the instructions,https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_destructive_changes.htm​-u, --targetorg=targetorg[default: scratchorg] Alias or username of the target org where the code should be deployed​​--skiponmissingmanifestSkip if unable to find destructive manfiest file​EXAMPLES$ sfdx sfpowerscripts:source:deployDestructiveManifest -u scratchorg -m Text -t "<?xml version="1.0"encoding="UTF-8"?><Packagexmlns="http://soap.sforce.com/2006/04/metadata"><types><members>myobject__c</members><name>CustomObject</name></types></Package>"
See code: lib/commands/sfpowerscripts/source/deployDestructiveManifest.js