npm package: @pacificpoint/pplib
Description: A variety of helpful dev tools for the pacific point team
Author: Naples, Andrew
Latest version: 1.0.4

# pplib

[![NPM](https://img.shields.io/npm/v/pplib.svg?label=pplib)](https://www.npmjs.com/package/pplib) [![Downloads/week](https://img.shields.io/npm/dw/pplib.svg)](https://npmjs.org/package/pplib) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/pplib/main/LICENSE.txt)

## 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

```bash
sf plugins install pplib@x.y.z
```

## Issues

Please report any issues at https://github.com/forcedotcom/cli/issues

## Contributing

1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
2. 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.
3. Fork this repository.
4. [Build the plugin locally](#build)
5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
6. Edit the code in your fork.
7. 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.
8. Sign CLA (see [CLA](#cla) below).
9. 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:

```bash
# Clone the repository
git clone git@github.com: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.

```bash
# 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.

```bash
# Link your plugin to the sf cli
sf plugins link .
# To verify
sf plugins
```

## Commands

<!-- commands -->

- [`sf pplib generate`](#sf-pplib-generate)
- [`sf pplib generate domain`](#sf-pplib-generate-domain)
- [`sf pplib generate handler`](#sf-pplib-generate-handler)
- [`sf pplib generate selector`](#sf-pplib-generate-selector)
- [`sf pplib generate service`](#sf-pplib-generate-service)
- [`sf pplib manifest build`](#sf-pplib-manifest-build)
- [`sf pplib manifest merge`](#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
```

<!-- commandsstop -->