0.1.2 • Published 4 years ago

@raspikabek/booker-sfdx-plugin v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

booker-sfdx-plugin

Version Downloads/week

Helper CLI for Salefsorce DX commands and extra utilities for Salesforce Development

$ npm install -g @raspikabek/booker-sfdx-plugin
$ sfdx COMMAND
running command...
$ sfdx (-v|--version|version)
@raspikabek/booker-sfdx-plugin/0.1.2 linux-x64 node-v12.18.3
$ sfdx --help [COMMAND]
USAGE
  $ sfdx COMMAND
...

sfdx booker:cert:create [-d <directory>] [-k <string>] [-s <number>] [--days <number>] [--algorithm sha256|sha1] [--commonname <string>] [--countryname <string>] [--localityname <string>] [--stateorprovincename <string>] [--organizationname <string>] [--organizationalunitname <string>] [--emailaddress <email>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

creates selfsigned certificates for your connected app

USAGE
  $ sfdx booker:cert:create [-d <directory>] [-k <string>] [-s <number>] [--days <number>] [--algorithm sha256|sha1] 
  [--commonname <string>] [--countryname <string>] [--localityname <string>] [--stateorprovincename <string>] 
  [--organizationname <string>] [--organizationalunitname <string>] [--emailaddress <email>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --directory=directory                                                         [default: assets/] directory to
                                                                                    store generated credential files

  -k, --password=password                                                           password for the encrypted file

  -s, --keysize=keysize                                                             [default: 2048] the size for the
                                                                                    private key in bits

  --algorithm=(sha256|sha1)                                                         [default: sha256] sign the
                                                                                    certificate with specified algorithm

  --commonname=commonname                                                           [default: example.org] client
                                                                                    certificate's common name

  --countryname=countryname                                                         [default: IE] client certificate's
                                                                                    country name

  --days=days                                                                       [default: 365] how long till expiry
                                                                                    of the signed certificate

  --emailaddress=emailaddress                                                       client certificate's email name

  --json                                                                            format output as json

  --localityname=localityname                                                       [default: Dublin] client
                                                                                    certificate's locality name

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

  --organizationalunitname=organizationalunitname                                   [default: DevOps] client
                                                                                    certificate's organizational unit
                                                                                    name

  --organizationname=organizationname                                               [default: Acme] client certificate's
                                                                                    organization name

  --stateorprovincename=stateorprovincename                                         [default: Dublin] client
                                                                                    certificate's state or province name

EXAMPLES
  $ sfdx force:cert:create --password myAwesomePassword
  $ sfdx force:cert:create -k myAwesomePassword --days 730

See code: lib/commands/booker/cert/create.js

sfdx booker:cert:decrypt --key <string> --iv <string> [--in <filepath>] [--out <filepath>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

decrypts a file given key and iv values

USAGE
  $ sfdx booker:cert:decrypt --key <string> --iv <string> [--in <filepath>] [--out <filepath>] [--json] [--loglevel 
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  --in=in                                                                           [default: assets/server.key.enc]
                                                                                    file path to decrypt

  --iv=iv                                                                           (required) iv decryption value

  --json                                                                            format output as json

  --key=key                                                                         (required) key decryption value

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

  --out=out                                                                         [default: assets/server.key] file
                                                                                    path to store the decrypted file

EXAMPLES
  $ sfdx booker:cert:decrypt --key $SECRET_KEY --iv $SECRET_IV
  $ sfdx booker:cert:decrypt --in assets/server.key.enc --out assest/server.key --key $SECRET_KEY --iv $SECRET_IV

See code: lib/commands/booker/cert/decrypt.js

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!