Set of commands making CI and dev's life easier.
npm install ci-sf-pluginci-sf-plugin
==============
Set of commands making CI and dev's life easier.
  
Intro\
Configuration\
Commands\
Development
``shinstallation
$ sf plugins install ci-sf-plugin@x.y.z
Configuration
* Complete example of
ciconfig.json file which should be placed in the root of your DX project.
`json
{
"projectName": "my-project",
"packageIds": [
{
"id": "04t1W000000aaa4QAK"
},
{
"id": "04t2E000000bbbxQAA",
"name": "name of this package",
"versionNumber": "2.14"
}
],
"apexPrePush": [
"scripts/anonymous-apex/enableMarketingUser.apex"
],
"apexPostPush": [
"scripts/anonymous-apex/insertCustomSettings.apex"
],
"profile": "My Admin Profile",
"permsetGroups": [
"Admin_Application_Access",
"Admin_Accounts_Access"
],
"permsets": [
"Order_CRM2CPQ_Edit_All_Statuses"
],
"postCreateManualSteps": {
"apexOrgVerification": "scripts/anonymous-apex/verifyOrgFeatures.apex",
"continueInstruction": "Please, continue by running '...' command.",
"features": [
{
"name": "ContactsToMultipleAccounts",
"manualStepDescription": "Open the new scratch org, go to Setup/Account Settings and enable 'Allow users to relate a contact to multiple accounts'."
},
{
"manualStepDescription": "Open the new scratch org, go to Setup/Asset Settings and turn on 'Enable Asset Sharing'."
}
],
"settings": {
"accountSettings": {
"enableRelateContactToMultipleAccounts": true
}
}
}
}
`
Commands
$3
`bash
Run unit tests in an org.USAGE
$ sf ci apex test run -o [--json] [--flags-dir ] [-l RunLocalTests|RunAllTestsInOrg]
FLAGS
-l, --test-level=
target-org configuration variable is already set.GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Run unit tests in an org.
EXAMPLES
$ sf ci apex test run -o orgAlias
$ sf ci apex test run -o orgAlias --test-level RunLocalTests
`$3
`bash
Executes Apex in an org. Either 'pre-push' or 'post-push' flag must be provided.USAGE
$ sf ci apex execute -o [--json] [--flags-dir ] [--pre-push] [--post-push] [-x ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'apexPrePush' or 'apexPostPush' property
--post-push executes post-push scripts.
--pre-push executes pre-push scripts.GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Executes Apex in an org. Either 'pre-push' or 'post-push' flag must be provided.
EXAMPLES
$ sf ci apex execute -o orgAlias --pre-push
$ sf ci apex execute --post-push
`$3
`bash
Display org's limits.USAGE
$ sf ci limits api display -o [--json] [--flags-dir ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Display org's limits.
EXAMPLES
$ sf ci limits api limits -o orgAlias
`$3
`bash
Creates a scratch org from your default dev hub. User can be also notified about possibly needed post-org-create manual steps together with instructions how to continue. Different behaviour can be configured for CI environment.USAGE
$ sf ci org create -v [--json] [--flags-dir ] [-a ] [-d ] [-f ] [--ci] [-t ] [-x ] [-w ]
FLAGS
-a, --set-alias= alias for the created org
-d, --duration-days= [default: 30] duration of the scratch org (in days) (min:1, max:30)
-f, --definition-file= [default: config/project-scratch-def.json] path to an org definition file
-t, --validation-timeout= [default: 30] timeout in seconds before org validation happens
-v, --target-dev-hub= (required) [default: kamil.malecek@durrgroup.com] Username or alias of the Dev Hub org. Not required if the
target-dev-hub configuration variable is already
set.
-w, --wait= [default: 60] number of minutes to wait for the scratch org to be ready
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'projectName' property
--ci set for CI environmentGLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Creates a scratch org from your default dev hub. User can be also notified about possibly needed post-org-create manual steps together with instructions how to continue. Different behaviour can
be configured for CI environment.
EXAMPLES
$ sf ci org create -a orgAlias
$ sf ci org create --set-alias orgAlias --definition-file config/project-scratch-def.json
$ sf ci org create --set-alias orgAlias --ci --validation-timeout 60
`$3
`bash
Delete a scratch org. Either explicitly specified org or the default one, if any.USAGE
$ sf ci org delete -o [--json] [--flags-dir ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Delete a scratch org. Either explicitly specified org or the default one, if any.
EXAMPLES
$ sf ci org delete -o orgAlias
`$3
`bash
Display navigation URL for either specified org or the default one, if any, but don’t launch browser.USAGE
$ sf ci org printurl -o [--json] [--flags-dir ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Display navigation URL for either specified org or the default one, if any, but don’t launch browser.
EXAMPLES
$ sf ci org printurl -o orgAlias
`$3
`bash
Installs packages into an org.USAGE
$ sf ci package install -o [--json] [--flags-dir ] [-s AllUsers|AdminsOnly] [-p ] [-x ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-p, --package= ID (starts with 04t) or alias of the package version to install, overrides 'ciconfig.json' configuration
-s, --security-type= `$3
`bash
Pushes DX source into an org.USAGE
$ sf ci source push -o [--json] [--flags-dir ] [--ci] [-x ]
FLAGS
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'ciForceignore' property
--ci set for CI environmentGLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Pushes DX source into an org.
EXAMPLES
$ sf ci source push -o orgAlias
$ sf ci source push -o orgAlias --ci
`$3
`bash
Sort selected metadata. Profiles, permission sets, muting permission sets and permission set groups are sorted by default.USAGE
$ sf ci source sort [--json] [--flags-dir ] [-d ]
FLAGS
-d, --directory= [default: src/main/default] relative path to the parent folder of metadata ('profiles' etc. folders inside)
GLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Sort selected metadata. Profiles, permission sets, muting permission sets and permission set groups are sorted by default.
EXAMPLES
$ sf ci source sort
$ sf ci source sort -d '~/projects/project-dx/src/main/default'
`$3
`bash
Assigns permission sets to an authenticated user.USAGE
$ sf ci user assign permset -o [--json] [--flags-dir ] [-n ] [-x ]
FLAGS
-n, --permset-name= permission set name to assign
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'permsets' array propertyGLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Assigns permission sets to an authenticated user.
EXAMPLES
$ sf ci user assign permset -o orgAlias
$ sf ci user assign permset --target-org orgAlias --permset-name Permset_DevName
`$3
`bash
Assigns permission set groups to an authenticated user.USAGE
$ sf ci user assign permsetgroup -o [--json] [--flags-dir ] [-n ] [-x ]
FLAGS
-n, --permset-group-name= permission set group name to assign
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'permsetGroups' array propertyGLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Assigns permission set groups to an authenticated user.
EXAMPLES
$ sf ci user assign permsetgroup -o orgAlias
$ sf ci user assign permsetgroup --target-org orgAlias --permset-group-name PermsetGroup_DevName
`$3
`bash
Assigns profile to the currently authenticated user.USAGE
$ sf ci user assign profile -o [--json] [--flags-dir ] [-n ] [-x ]
FLAGS
-n, --profile-name= profile name to assign
-o, --target-org= (required) Username or alias of the target org. Not required if the
target-org configuration variable is already set.
-x, --ci-config-file= [default: ciconfig.json] path to a 'ciconfig.json' file with 'profile' propertyGLOBAL FLAGS
--flags-dir= Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Assigns profile to the currently authenticated user.
EXAMPLES
$ sf ci user assign profile -o orgAlias
$ sf ci user assign profile --target-org orgAlias --profile-name "Custom Admin Profile"
`
Development
* Install the dependencies and compile
`bash
yarn && yarn build
`To use your plugin, run using the local
./bin/dev or ./bin/dev.cmd file.`bash
Run using local run file.
./bin/dev hello world
`There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be
useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
`bash
Link your plugin to the sf cli
sf plugins link .
To verify
sf plugins
``