Skip to content

A plugin that will compare the differences in a repository to ensure only changed items are deployed

License

Notifications You must be signed in to change notification settings

gavinhughpalmer/sfdx-tools

Repository files navigation

sfdx-tools

A collection of tools for working with Salesforce source format based projects, extending the SFDX CLI plugin framework

CircleCI

Known Vulnerabilities

License: MIT

$ npm install -g sfdx-tools
$ sfdx-tools COMMAND
running command...
$ sfdx-tools (-v|--version|version)
sfdx-tools/0.0.0 darwin-x64 node-v19.4.0
$ sfdx-tools --help [COMMAND]
USAGE
  $ sfdx-tools COMMAND
...

sfdx-tools gpalm:org:prune [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

This command allows for pruning out some of the scratch org files that can start to build up, these don't typically get deleted so this command is useful to run every now and then as a housekeeping excersise

USAGE
  $ sfdx-tools gpalm:org:prune [-d] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --dryrun                                                                      Displays the scrath org files that
                                                                                    will be pruned out as part of the
                                                                                    process

  --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 gpalm:org:prune --dryrun
           test-hi51rwfgi974@example.com

See code: src/commands/gpalm/org/prune.ts

sfdx-tools gpalm:source:backup [-v <number>] [-d <string>] [-w <integer>] [-i <array>] [-s <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

This command will perform a full backup of a given orgs metadata, simply provide the org and a full backup of metadata will be pulled into provided project folder

USAGE
  $ sfdx-tools gpalm:source:backup [-v <number>] [-d <string>] [-w <integer>] [-i <array>] [-s <array>] [-u <string>] 
  [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --outputdir=outputdir
      [default: force-app] The directory where the source format should be output to

  -i, --ignoretypes=ignoretypes
      Comma seperated list of any additional types that you wish to ignore from the retrieve process, this can be used if 
      the error "The retrieved zip file exceeded the limit of 629145600 bytes. Total bytes retrieved: 629534861" is 
      recieved

  -s, --secondaryretrieve=secondaryretrieve
      [default: ] Comma seperated list of values that should be included fro a secondary retrieve, useful if the retrieve 
      is too large for a single retrieve job

  -u, --targetusername=targetusername
      username or alias for the target org; overrides default target org

  -v, --packageversion=packageversion
      [default: 56] Version number that the package.xml should use in the retrieve call

  -w, --waittimemillis=waittimemillis
      [default: 1000] The wait time between retrieve checks

  --apiversion=apiversion
      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

EXAMPLE
  $ sfdx gpalm:source:backup --targetusername myOrg@example.com
     Backup completed!

See code: src/commands/gpalm/source/backup.ts

sfdx-tools gpalm:source:fix [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

This command is intended to convert the flow files from metadata format to the source format, that is without the version numebr in the file name and without the flow definition file. The command will delete all flow definition files and any flow files with the number in them, maintaining the active flow file

USAGE
  $ sfdx-tools gpalm:source:fix [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  --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 gpalm:source:backup --targetusername myOrg@example.com
     Backup completed!

See code: src/commands/gpalm/source/fix.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
  1. Set some breakpoints in your command code
  2. Click on the Debug icon in the Activity Bar on the side of VS Code to open up the Debug view.
  3. In the upper left hand corner of VS Code, verify that the "Attach to Remote" launch configuration has been chosen.
  4. 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.
  5. 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!

About

A plugin that will compare the differences in a repository to ensure only changed items are deployed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages