@pacificpoint/pplib
v1.0.4
Published
A variety of helpful dev tools for the pacific point team
Downloads
42
Maintainers
Readme
pplib
Usage
The pplib commands deliver an easy way to produce some basic files used in Pacific Point's extension of the fflib library (fflibe).
In addition, there are two commands for building and combining manifest files.
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
sf pplib generate domain
sf pplib generate handler
sf pplib generate selector
sf pplib generate service
sf pplib manifest build
sf pplib manifest merge
sf pplib generate
Generates the full suite of class files for a new sobject type.
USAGE
$ sf pplib generate -s <value> [--json] [-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
--json Format output as json.
DESCRIPTION
Generates the full suite of class files for a new sobject type.
Generates the full suite of class files for a new sobject type.
EXAMPLES
$ sf pplib generate
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] [-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
--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] [-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
--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 selector
Generates a selector using the fflibe design pattern with necessary supporting files
USAGE
$ sf pplib generate selector -s <value> [--json] [-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
--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] [-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
--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 manifest build
Create a manifest file from the difference in commit hashes or from the working directory
USAGE
$ sf pplib manifest build -p <value> -i <value> [--json] [-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.
-f, --from-commit=<value> The git object of the lower bound of changes.
-i, --iteration=<value> (required) The name or iteration of the generated manifest.
-p, --filepath=<value> (required) The directory to write the generated manifest.
GLOBAL FLAGS
--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] [-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
--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