@salesforce/sf-plugins-core
TypeScript icon, indicating that this package has built-in type declarations

12.0.13 • Public • Published

NPM

Description

The @salesforce/sf-plugins-core provides utilities for writing sf plugins.

Docs: https://salesforcecli.github.io/sf-plugins-core

SfCommand Abstract Class

The SfCommand abstract class extends @oclif/core's Command class for examples of how to build a definition. ) class and adds useful extensions to ease the development of commands for use in the Salesforce Unified CLI.

  • SfCommand takes a generic type that defines the success JSON result
  • Enable the json flag support by default
  • Provides functions that help place success messages, warnings and errors into the correct location in JSON results
  • Enables additional help sections to the standard oclif command help output
  • Provides access to the cli-ux cli actions. This avoids having to import that interface from cli-ux and manually handling the --json flag.
  • Provides simple, stubbable prompts for confirmation and secrets

Flags

Flags is a convenience reference to @oclif/core#Flags

Specialty Flags

These flags can be imported into a command and used like any other flag. See code examples in the links

  • orgApiVersionFlag
    • specifies a Salesforce API version.
    • reads from Config (if available)
    • validates version is still active
    • warns if version if deprecated
  • requiredOrgFlag
    • accepts a username or alias
    • aware of configuration defaults
    • throws if org or default doesn't exist or can't be found
  • optionalOrgFlag
    • accepts a username or alias
    • aware of configuration defaults
    • might be undefined if an org isn't found
  • requiredHubFlag
    • accepts a username or alias
    • aware of configuration defaults
    • throws if org or default doesn't exist or can't be found
    • throws if an org is found but is not a dev hub
  • durationFlag
    • specify a unit
    • optionally specify a min, max, and defaultValue
    • returns a Duration
    • can be undefined if you don't set the default
  • salesforceIdFlag
    • validates that IDs are valid salesforce ID
    • optionally restrict to 15/18 char
    • optionally require it to be begin with a certain prefix

Unit Test Helpers

Want to verify SfCommand Ux behavior (warnings, tables, spinners, prompts)? Check out the functions in `stubUx``.

Readme

Keywords

none

Package Sidebar

Install

npm i @salesforce/sf-plugins-core

Weekly Downloads

1,295,194

Version

12.0.13

License

BSD-3-Clause

Unpacked Size

188 kB

Total Files

47

Last publish

Collaborators

  • lwc-admin
  • dme722
  • nolanlawson
  • ire-npm-team-user
  • jburnie
  • abirchfieldsfdc
  • dlouvton
  • mobify
  • jmsjtu
  • jasonschroeder-sfdc
  • packagellama
  • maward
  • danielshox
  • duane.chew
  • dferro
  • jcourtner
  • jye-sf
  • adirasanam
  • hkii
  • iamaziz
  • dbreese-salesforce
  • ashokrudraraju
  • dhersam
  • demianbrecht
  • mbettio
  • damilareolowoniyi
  • mmadialagan
  • mjrust
  • salesforce-releases
  • kevinv11n
  • byao
  • pmdartus
  • ekashida
  • ravi.jayaramappa
  • apapko
  • jleen-sfdc
  • jqian
  • cwallsf
  • dhagberg-sf
  • khawkins
  • amphro
  • jodarove
  • sfdctaka
  • fernomac
  • jimjag
  • ivarley
  • jbartolotta-sfdc