@arnaples/pplib
v1.3.0
Published
A variety of tools leveraged by the pacific point team
Downloads
769
Maintainers
Readme
pplib
Using the template
This repository provides a template for creating a plugin for the Salesforce CLI. To convert this template to a working plugin:
Please get in touch with the Platform CLI team. We want to help you develop your plugin.
Generate your plugin:
sf plugins install dev sf dev generate plugin git init -b main git add . && git commit -m "chore: initial commit"
Create your plugin's repo in the salesforcecli github org
When you're ready, replace the contents of this README with the information you want.
Learn about sf
plugins
Salesforce CLI plugins are based on the oclif plugin framework. Read the plugin developer guide to learn about Salesforce CLI plugin development.
This repository contains a lot of additional scripts and tools to help with general Salesforce node development and enforce coding standards. You should familiarize yourself with some of the node developer packages used by Salesforce.
Additionally, there are some additional tests that the Salesforce CLI will enforce if this plugin is ever bundled with the CLI. These test are included by default under the posttest
script and it is required to keep these tests active in your plugin if you plan to have it bundled.
Tooling
- @salesforce/core
- @salesforce/kit
- @salesforce/sf-plugins-core
- @salesforce/ts-types
- @salesforce/ts-sinon
- @salesforce/dev-config
- @salesforce/dev-scripts
Hooks
For cross clouds commands, e.g. sf env list
, we utilize oclif hooks to get the relevant information from installed plugins.
This plugin includes sample hooks in the src/hooks directory. You'll just need to add the appropriate logic. You can also delete any of the hooks if they aren't required for your plugin.
Everything past here is only a suggestion as to what should be in your specific plugin's description
This plugin is bundled with the Salesforce CLI. For more information on the CLI, read the getting started guide.
We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.
Install
sf plugins install [email protected]
Issues
Please report any issues at https://github.com/forcedotcom/cli/issues
Contributing
- Please read our Code of Conduct
- Create a new issue before starting your project so that we can keep track of what you are trying to add/fix. That way, we can also offer suggestions or let you know if there is already an effort in progress.
- Fork this repository.
- Build the plugin locally
- Create a topic branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
- Edit the code in your fork.
- Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
- Sign CLA (see CLA below).
- Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
CLA
External contributors will be required to sign a Contributor's License Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
Build
To build the plugin locally, make sure to have yarn installed and run the following commands:
# Clone the repository
git clone [email protected]:salesforcecli/pplib
# Install the dependencies and compile
yarn && yarn build
To use your plugin, run using the local ./bin/dev
or ./bin/dev.cmd
file.
# 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.
# Link your plugin to the sf cli
sf plugins link .
# To verify
sf plugins
Commands
sf pplib generate documentation data-dictionary
sf pplib generate domain
sf pplib generate handler
sf pplib generate permissionset
sf pplib generate selector
sf pplib generate service
sf pplib generate test
sf pplib manifest build
sf pplib manifest merge
sf pplib generate documentation data-dictionary
Summary of a command.
USAGE
$ sf pplib generate documentation data-dictionary [--json] [--flags-dir <value>] [-n <value>] [-d <value>] [-t csv]
[--ignore-standard-fields]
FLAGS
-d, --output-directory=<value> [default: documentation/] The output directory to store the data dictionary.
-n, --name=<value> [default: data-dictionary] Description of a flag.
-t, --type=<option> [default: csv] Specify the type of output file
<options: csv>
--ignore-standard-fields if specified, will not add standard fields to the data dictionary
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Summary of a command.
More information about a command. Don't repeat the summary.
EXAMPLES
$ sf pplib generate documentation data-dictionary
FLAG DESCRIPTIONS
-d, --output-directory=<value> The output directory to store the data dictionary.
The directory to store the output data dictionary upon completion.
-n, --name=<value> Description of a flag.
More information about a flag. Don't repeat the summary.
-t, --type=csv Specify the type of output file
Specifies the type of output file; Currently, only option is csv. reserved for future use
sf pplib generate domain
Generates a new domain class using the fflibe_Application implementation for a given sobject.
USAGE
$ sf pplib generate domain -s <value> [--json] [--flags-dir <value>] [-d <value>] [--ignore-errors]
FLAGS
-d, --output-dir=<value> [default: force-app] The output directory of the items. List only the top level directory.
i.e. force-app
-s, --sobject=<value> (required) The SObjectType of the sobject to create
--ignore-errors Ignore errors outputted by the script.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generates a new domain class using the fflibe_Application implementation for a given sobject.
Description of a command.
EXAMPLES
$ sf pplib generate domain
sf pplib generate handler
Generates a new handler file for a give sobject type.
USAGE
$ sf pplib generate handler -s <value> [--json] [--flags-dir <value>] [-d <value>] [--ignore-errors]
FLAGS
-d, --output-dir=<value> [default: force-app] The output directory of the items. List only the top level directory.
i.e. force-app
-s, --sobject=<value> (required) API Name of the SObject.
--ignore-errors Ignore errors outputted by the script.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generates a new handler file for a give sobject type.
Description of a command.
EXAMPLES
$ sf pplib generate handler
sf pplib generate permissionset
Creates a permission set for a given object.
USAGE
$ sf pplib generate permissionset -s <value> [--json] [--flags-dir <value>] [-t readonly|readwrite] [-d <value>] [--delete]
[--edit] [--create] [--view-all] [--modify-all]
FLAGS
-d, --output-dir=<value> [default: force-app/main/default/permissionsets] The output directory to store the
permission set.
-s, --sobject=<value> (required) The SObject type of the permission set to create.
-t, --type=<option> [default: readonly] The type of permission set to create.
<options: readonly|readwrite>
OBJECT PERMISSIONS FLAGS
--[no-]create Grants create permissions to the object if the type is readwrite.
--delete Grants delete permission to the object.
--[no-]edit Grants edit permissions to the object if the type is readwrite.
--modify-all Grants modify all permission to the object if the type is readwrite.
--view-all Grants view all permission to the object.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Creates a permission set for a given object.
Given a type and sobject, will create a permission set with the necessary permissions.
EXAMPLES
$ sf pplib generate permissionset
FLAG DESCRIPTIONS
-d, --output-dir=<value> The output directory to store the permission set.
The directory to store the output permission set upon completion.
-s, --sobject=<value> The SObject type of the permission set to create.
The SObject to use to create the permission set.
-t, --type=readonly|readwrite The type of permission set to create.
If readonly will create a permissionset with readonly to every custom field that isn't required. If readwrite will
grant edit access to every field that isn't required or a formula field.
sf pplib generate selector
Generates a selector using the fflibe design pattern with necessary supporting files
USAGE
$ sf pplib generate selector -s <value> [--json] [--flags-dir <value>] [-d <value>] [--ignore-errors]
FLAGS
-d, --output-dir=<value> [default: force-app] The output directory of the items. List only the top level directory.
i.e. force-app
-s, --sobject=<value> (required) The SObjectType of the sobject to create
--ignore-errors Ignore errors outputted by the script.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Generates a selector using the fflibe design pattern with necessary supporting files
Generates a selector class implementing the fflibe_selector class. Will also generate the metadata and field set
necessary to support the base implementation
EXAMPLES
$ sf pplib generate selector --sobject Account
$ sf pplib generate selector --sobject Account --output-dir force-app
sf pplib generate service
Create a new Service class in the style of fflib-extensions.
USAGE
$ sf pplib generate service -s <value> [--json] [--flags-dir <value>] [-d <value>] [--ignore-errors]
FLAGS
-d, --output-dir=<value> [default: force-app] Description of a flag.
-s, --sobject=<value> (required) Description of a flag.
--ignore-errors Ignore errors outputted by the script.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Create a new Service class in the style of fflib-extensions.
Description of a command.
EXAMPLES
$ sf pplib generate service
sf pplib generate test
Summary of a command.
USAGE
$ sf pplib generate test [--json] [--flags-dir <value>] [-n <value>]
FLAGS
-n, --name=<value> Description of a flag.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Summary of a command.
More information about a command. Don't repeat the summary.
EXAMPLES
$ sf pplib generate test
FLAG DESCRIPTIONS
-n, --name=<value> Description of a flag.
More information about a flag. Don't repeat the summary.
sf pplib manifest build
Create a manifest file from the difference in commit hashes or from the working directory
USAGE
$ sf pplib manifest build -d <value> -n <value> [--json] [--flags-dir <value>] [-f <value> [-c <value> | -W]]
FLAGS
-W, --include-working-directory If declared, will generate a manifest of items in the staged and changed indexes.
-c, --to-commit=<value> [default: HEAD] The git object of the upper bound of changes.
-d, --output-dir=<value> (required) The directory to write the generated manifest.
-f, --from-commit=<value> The git object of the lower bound of changes.
-n, --name=<value> (required) The name or iteration of the generated manifest.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Create a manifest file from the difference in commit hashes or from the working directory
Assuming your project leverages git, this command will create a manifest file at the location that you provide. The
manifest can be generated from the difference between to commit hashes (if the `--to-commit` is omitted, `HEAD` will
be used instead). Alternatively, declaring the `--include-working-directory` will build a manifest from your staged
and changed items.
EXAMPLES
$ sf manifest build -W --iteration=tempWorkingFiles --output-dir=manifest/workingManifests
$ sf manifest build --from-commit 737a5ee --to-commit=HEAD --iteration=release1 --output-dir=manifest/releases
sf pplib manifest merge
Combine one or more manifests into a single manifest file.
USAGE
$ sf pplib manifest merge -f <value> [--json] [--flags-dir <value>] [-m <value>... | -d <value>]
FLAGS
-d, --manifest-directory=<value> The absolute or relative filepath of a directory containing one or more manifest to
merge into the source manifest.
-f, --source-manifest=<value> (required) The absolute or relative filepath of the manifest that other manifests
will be merged into.
-m, --manifests=<value>... The absolute or relative filepath of a manifest to merge into the source manifest.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Combine one or more manifests into a single manifest file.
Will combine individual declared manifests using the `--manifests` flag or all manifests located in a directory using
the `--manifest-directory` flag
EXAMPLES
$ sf manifest merge --source-manifest=manifest/package.xml --manifests=manifest/cases/00123.xml --manifests=manifest/cases/000456.xml
$ sf manifest merge --source-manifest=manifest/package.xml --manifest-directory=manifest/releases