|
| 1 | +# sf-plugin-metadata-coverage |
| 2 | + |
| 3 | +> sf plugin to check the metadata coverage report for the given source |
| 4 | +
|
| 5 | +[Metadata Coverage Report](https://developer.salesforce.com/docs/success/metadata-coverage-report/references/coverage-report/metadata-coverage-report.html) |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +```shell |
| 10 | +sf plugins install sf-plugin-metadata-coverage |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +```sh-session |
| 16 | +$ sf metadata-coverage check --source-dir force-app --2gp-unlocked |
| 17 | +Checking 38 metadata type for unlockedPackagingWithoutNamespace using API version 64.0. |
| 18 | +All metadata types are supported. |
| 19 | +``` |
| 20 | + |
| 21 | +The command prints metadata types that are not supported and exits with an error code. |
| 22 | + |
| 23 | +```sh-session |
| 24 | +$ sf metadata-coverage check --source-dir force-app --2gp-managed |
| 25 | +Checking 38 metadata types for managedPackaging using API version 64.0. |
| 26 | +=== Unsupported Metadata Types |
| 27 | + |
| 28 | +┌───────────────────────┬───────────────────┬───────────────────────┐ |
| 29 | +│ Type │ Managed Packaging │ Members │ |
| 30 | +├───────────────────────┼───────────────────┼───────────────────────┤ |
| 31 | +│ CustomHelpMenuSection │ false │ CustomHelpMenuSection │ |
| 32 | +└───────────────────────┴───────────────────┴───────────────────────┘ |
| 33 | + |
| 34 | +Error (2): Some metadata types are not supported. |
| 35 | +``` |
| 36 | + |
| 37 | +<!-- commands --> |
| 38 | +* [`sf metadata-coverage check`](#sf-metadata-coverage-check) |
| 39 | +* [`sf metadata-coverage download`](#sf-metadata-coverage-download) |
| 40 | + |
| 41 | +## `sf metadata-coverage check` |
| 42 | + |
| 43 | +Check the Metadata Coverage for the given source directory, metadata type or package.xml. |
| 44 | + |
| 45 | +``` |
| 46 | +USAGE |
| 47 | + $ sf metadata-coverage check [--json] [--flags-dir <value>] [--api-version <value>] [-d <value>...] [-x <value>] [-m |
| 48 | + <value>...] [--1gp-managed] [--1gp-unmanaged] [--2gp-managed] [--2gp-unlocked] [--2gp-unlocked-with-namespace] |
| 49 | + [--source-tracking] [--tooling-api] [--metadata-api] [--apex-metadata-api] [--changesets] |
| 50 | +
|
| 51 | +FLAGS |
| 52 | + --api-version=<value> The API version of the Metadata Coverage Report to use. |
| 53 | +
|
| 54 | +SOURCES FLAGS |
| 55 | + -d, --source-dir=<value>... File paths for source to check. |
| 56 | + -m, --metadata=<value>... Metadata component names to check. |
| 57 | + -x, --manifest=<value> File path for the manifest (package.xml) that specifies the components to check. |
| 58 | +
|
| 59 | +METADATA COVERAGE CHANNELS FLAGS |
| 60 | + --1gp-managed |
| 61 | + --1gp-unmanaged |
| 62 | + --2gp-managed |
| 63 | + --2gp-unlocked |
| 64 | + --2gp-unlocked-with-namespace |
| 65 | + --apex-metadata-api |
| 66 | + --changesets |
| 67 | + --metadata-api |
| 68 | + --source-tracking |
| 69 | + --tooling-api |
| 70 | +
|
| 71 | +GLOBAL FLAGS |
| 72 | + --flags-dir=<value> Import flag values from a directory. |
| 73 | + --json Format output as json. |
| 74 | +
|
| 75 | +EXAMPLES |
| 76 | + $ sf metadata-coverage check --source-dir force-app --2gp-unlocked |
| 77 | +
|
| 78 | + $ sf metadata-coverage check --manifest src/package.xml --1gp-managed |
| 79 | +
|
| 80 | + $ sf metadata-coverage check --metadata CustomHelpMenuSection --2gp-unlocked |
| 81 | +
|
| 82 | + $ sf metadata-coverage check --metadata CustomHelpMenuSection --2gp-unlocked --2gp-managed |
| 83 | +
|
| 84 | + $ sf metadata-coverage check --metadata CustomHelpMenuSection --2gp-managed --api-version 65.0 |
| 85 | +``` |
| 86 | + |
| 87 | +_See code: [lib/commands/metadata-coverage/check.js](https://github.com/amtrack/sf-plugin-metadata-coverage/blob/main/lib/commands/metadata-coverage/check.js)_ |
| 88 | + |
| 89 | +## `sf metadata-coverage download` |
| 90 | + |
| 91 | +Explicitly download a Metadata Coverage Report. |
| 92 | + |
| 93 | +``` |
| 94 | +USAGE |
| 95 | + $ sf metadata-coverage download [--json] [--flags-dir <value>] [--api-version <value>] |
| 96 | +
|
| 97 | +FLAGS |
| 98 | + --api-version=<value> The API version of the Metadata Coverage Report to use. |
| 99 | +
|
| 100 | +GLOBAL FLAGS |
| 101 | + --flags-dir=<value> Import flag values from a directory. |
| 102 | + --json Format output as json. |
| 103 | +
|
| 104 | +DESCRIPTION |
| 105 | + Explicitly download a Metadata Coverage Report. |
| 106 | +
|
| 107 | + By default it downloads the Metadata Coverage Report for the version of the sfdx-project.json > sourceApiVersion. |
| 108 | +
|
| 109 | +EXAMPLES |
| 110 | + $ sf metadata-coverage download |
| 111 | +
|
| 112 | + $ sf metadata-coverage download --api-version 65.0 |
| 113 | +``` |
| 114 | + |
| 115 | +_See code: [lib/commands/metadata-coverage/download.js](https://github.com/amtrack/sf-plugin-metadata-coverage/blob/main/lib/commands/metadata-coverage/download.js)_ |
| 116 | +<!-- commandsstop --> |
| 117 | + |
| 118 | +### Example Use Cases |
| 119 | + |
| 120 | +Is the Metadata Type "CustomHelpMenuSection" supported for a 2GP Managed Package? |
| 121 | + |
| 122 | +```shell |
| 123 | +sf metadata-coverage check -m CustomHelpMenuSection --2gp-managed |
| 124 | +``` |
| 125 | + |
| 126 | +... or maybe in the upcoming release? |
| 127 | + |
| 128 | +```shell |
| 129 | +sf metadata-coverage check -m CustomHelpMenuSection --2gp-managed --api-version 65.0 |
| 130 | +``` |
| 131 | + |
| 132 | +Can I create an Unlocked Package from my source directory? |
| 133 | + |
| 134 | +```shell |
| 135 | +sf metadata-coverage check --source-dir force-app --2gp-unlocked |
| 136 | +``` |
| 137 | + |
| 138 | +Can I convert my 1GP Managed Package to a 2GP Managed Package? |
| 139 | + |
| 140 | +```shell |
| 141 | +sf project retrieve start --package-name MyPkg --target-metadata-dir src --unzip --target-org my-pkg-org |
| 142 | +sf metadata-coverage check --manifest src/unpackaged/package.xml --2gp-managed |
| 143 | +``` |
| 144 | + |
| 145 | +## Development |
| 146 | + |
| 147 | +After cloning this repository, install the dependencies: |
| 148 | + |
| 149 | +```shell |
| 150 | +npm ci |
| 151 | +``` |
| 152 | + |
| 153 | +Use `bin/dev.js` to run the plugin while development |
| 154 | + |
| 155 | +```shell |
| 156 | +./bin/dev.js metadata-coverage check -h |
| 157 | +``` |
| 158 | + |
| 159 | +or link it with sfdx |
| 160 | + |
| 161 | +```shell |
| 162 | +sf plugins link |
| 163 | +sf which metadata-coverage check |
| 164 | +sf metadata-coverage check -h |
| 165 | +``` |
| 166 | + |
| 167 | +## Testing |
| 168 | + |
| 169 | +```shell |
| 170 | +npm run test |
| 171 | +``` |
0 commit comments