Skip to content

Commit 8151ea7

Browse files
committed
chore(release): 2.0.1 [skip ci]
1 parent c2f1783 commit 8151ea7

File tree

3 files changed

+232
-85
lines changed

3 files changed

+232
-85
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## [2.0.1](https://github.com/salesforcecli/plugin-dev/compare/1.3.3...2.0.1) (2023-11-21)
2+
3+
4+
### Bug Fixes
5+
6+
* dev.js ([150bee6](https://github.com/salesforcecli/plugin-dev/commit/150bee645e793acdd96f587caf5c23fe1de98b20))
7+
* esm and cjs command test templates ([dbb4678](https://github.com/salesforcecli/plugin-dev/commit/dbb4678dfdc2e57b2ad03bf5a9ab08bc67b6da80))
8+
* no windows sep in imports ([a00812c](https://github.com/salesforcecli/plugin-dev/commit/a00812c6af491420cb2c1172c11d561b7041ee1c))
9+
* remove all requires ([63c8b2b](https://github.com/salesforcecli/plugin-dev/commit/63c8b2b10781105e1f601517661bbb33d02306e4))
10+
* replace require.resolve ([00ff1cc](https://github.com/salesforcecli/plugin-dev/commit/00ff1cc0fc2b14b50848d3f3499aaba2348d5491))
11+
* use proper bin script for running schema generate on 2pp ([0195029](https://github.com/salesforcecli/plugin-dev/commit/019502922888aed1bfe93e45a850a5ec87b05f7a))
12+
* use replaceAll ([d2585f2](https://github.com/salesforcecli/plugin-dev/commit/d2585f2de6c147e4688490ffeadcec52085add60))
13+
14+
15+
116
## [1.3.3](https://github.com/salesforcecli/plugin-dev/compare/1.3.2...1.3.3) (2023-11-11)
217

318

README.md

Lines changed: 216 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -111,113 +111,266 @@ sf plugins
111111
## Commands
112112

113113
<!-- commands -->
114+
* [`sf dev audit messages`](#sf-dev-audit-messages)
115+
* [`sf dev configure repo`](#sf-dev-configure-repo)
116+
* [`sf dev configure secrets`](#sf-dev-configure-secrets)
117+
* [`sf dev convert messages`](#sf-dev-convert-messages)
118+
* [`sf dev convert script`](#sf-dev-convert-script)
119+
* [`sf dev generate command`](#sf-dev-generate-command)
120+
* [`sf dev generate flag`](#sf-dev-generate-flag)
121+
* [`sf dev generate library`](#sf-dev-generate-library)
122+
* [`sf dev generate plugin`](#sf-dev-generate-plugin)
114123

115-
- [plugin-dev](#plugin-dev)
116-
- [Install](#install)
117-
- [Usage](#usage)
118-
- [Generate a new `sf` plugin](#generate-a-new-sf-plugin)
119-
- [Generate a new `sf` command in your plugin](#generate-a-new-sf-command-in-your-plugin)
120-
- [Generate a hook that will be used for existing `sf` commands](#generate-a-hook-that-will-be-used-for-existing-sf-commands)
121-
- [Issues](#issues)
122-
- [Contributing](#contributing)
123-
- [CLA](#cla)
124-
- [Build](#build)
125-
- [Commands](#commands)
126-
- [`sf dev generate command`](#sf-dev-generate-command)
127-
- [`sf dev generate flag`](#sf-dev-generate-flag)
128-
- [`sf dev generate hook`](#sf-dev-generate-hook)
129-
- [`sf dev generate library`](#sf-dev-generate-library)
130-
- [`sf dev generate plugin`](#sf-dev-generate-plugin)
131-
- [`sf dev hook HOOK`](#sf-dev-hook-hook)
124+
## `sf dev audit messages`
132125

133-
## `sf dev generate command`
126+
Audit messages in a plugin's messages directory to locate unused messages and missing messages that have references in source code.
134127

135-
Generate a new sf command.
128+
```
129+
USAGE
130+
$ sf dev audit messages [--json] [-p <value>] [-m <value>] [-s <value>]
131+
132+
FLAGS
133+
-m, --messages-dir=<value> [default: messages] Directory that contains the plugin's message files.
134+
-p, --project-dir=<value> [default: .] Location of the project where messages are to be audited.
135+
-s, --source-dir=<value> [default: src] Directory that contains the plugin's source code.
136+
137+
GLOBAL FLAGS
138+
--json Format output as json.
139+
140+
EXAMPLES
141+
Audit messages using default directories:
142+
143+
$ sf dev audit messages
144+
145+
Audit messages in the "messages" directory in the current working directory; the plugin's source directory is in
146+
"src":
147+
148+
$ sf dev audit messages --messages-dir ./messages --source-dir ./src
149+
150+
FLAG DESCRIPTIONS
151+
-m, --messages-dir=<value> Directory that contains the plugin's message files.
152+
153+
The default is the "messages" directory in the current working directory.
154+
155+
-s, --source-dir=<value> Directory that contains the plugin's source code.
156+
157+
The default is the "src" directory in the current working directory.
158+
```
159+
160+
_See code: [src/commands/dev/audit/messages.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/audit/messages.ts)_
161+
162+
## `sf dev configure repo`
163+
164+
Configure a GitHub repo for the GitHub Actions pipeline.
136165

137166
```
138167
USAGE
139-
$ sf dev generate command -n <value> [--force] [--nuts] [--unit]
168+
$ sf dev configure repo -r <value> [--json] [-d] [-b <value>]
140169
141170
FLAGS
142-
-n, --name=<value> (required) Name of the new command. Use colons to separate the topic and command names.
143-
--force Overwrite existing files.
144-
--[no-]nuts Generate a NUT test file for the command.
145-
--[no-]unit Generate a unit test file for the command.
171+
-b, --bot=<value> [default: SF-CLI-BOT] GitHub login/username for the bot.
172+
-d, --dry-run Make no changes.
173+
-r, --repository=<value> (required) GitHub owner/repo for which you want to configure GitHub Actions.
174+
175+
GLOBAL FLAGS
176+
--json Format output as json.
146177
147178
DESCRIPTION
148-
Generate a new sf command.
179+
Configure a GitHub repo for the GitHub Actions pipeline.
149180
150-
You must run this command from within a plugin directory, such as the directory created with the "sf generate plugin"
151-
command.
181+
Sets up labels and exempts the CLI bot for branch protection and PR rules.
152182
153-
The command updates the package.json file, so if it detects conflicts with the existing file, you're prompted whether
154-
you want to overwrite the file. There are a number of package.json updates required for a new command, so we recommend
155-
you answer "y" so the command takes care of them all. If you answer "n", you must update the package.json file
156-
manually.
183+
EXAMPLES
184+
Configure the repo "testPackageRelease", with owner "salesforcecli", for GitHub Actions.
185+
186+
$ sf dev configure repo --repository salesforcecli/testPackageRelease
187+
```
157188

158-
The command generates basic source, messages (\*.md), and test files for your command. The Typescript files contain
159-
import statements for the minimum required Salesforce libraries, and scaffold some basic code. The new type names come
160-
from the value you passed to the --name flag.
189+
_See code: [src/commands/dev/configure/repo.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/configure/repo.ts)_
190+
191+
## `sf dev configure secrets`
192+
193+
Ensures a GitHub repo has correct access to secrets based on its workflows.
194+
195+
```
196+
USAGE
197+
$ sf dev configure secrets -r <value> [--json] [-d]
198+
199+
FLAGS
200+
-d, --dry-run Make no changes.
201+
-r, --repository=<value> (required) Github owner/repo.
202+
203+
GLOBAL FLAGS
204+
--json Format output as json.
205+
206+
DESCRIPTION
207+
Ensures a GitHub repo has correct access to secrets based on its workflows.
208+
209+
Inspects a repo's yaml files and verifies that secrets required are available for the repo (either set at the repo
210+
level or shared via organization-level secrets).
211+
212+
This command requires scope:admin permissions to inspect the org secrets and admin access to the repo to inspect the
213+
repo secrets.
161214
162215
EXAMPLES
163-
Generate the files for a new "sf my exciting command":
216+
Ensure secrets access for the repo "testPackageRelease", with owner "salesforcecli":
164217
165-
$ sf dev generate command --name my:exciting:command
218+
$ sf dev configure secrets --repository salesforcecli/testPackageRelease
166219
```
167220

168-
## `sf dev generate flag`
221+
_See code: [src/commands/dev/configure/secrets.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/configure/secrets.ts)_
222+
223+
## `sf dev convert messages`
169224

170-
Summary of a command.
225+
Convert a .json messages file into Markdown.
171226

172227
```
173228
USAGE
174-
$ sf dev generate flag [-d]
229+
$ sf dev convert messages -f <value> [--json] [-p <value>]
175230
176231
FLAGS
177-
-d, --dry-run Print new flag instead of adding it to the command file.
232+
-f, --file-name=<value>... (required) Filename to convert.
233+
-p, --project-dir=<value> [default: .] Location of the project whose messages are to be converted.
234+
235+
GLOBAL FLAGS
236+
--json Format output as json.
178237
179238
DESCRIPTION
180-
Summary of a command.
239+
Convert a .json messages file into Markdown.
181240
182-
Description of a command.
241+
Preserves the filename and the original messages file, then creates a new file with the Markdown extension and
242+
standard headers for the command and flag summaries, descriptions, and so on. After you review the new Markdown file,
243+
delete the old .json file.
183244
184245
EXAMPLES
185-
$ sf dev generate flag
246+
Convert the my-command.json message file into my-command.md with the standard messages headers:
247+
248+
$ sf dev convert messages --filename my-command.json
249+
250+
Similar to previous example, but specify the plugin project directory:
251+
252+
$ sf dev convert messages --project-dir ./path/to/plugin --filename my-command.json
186253
```
187254

188-
## `sf dev generate hook`
255+
_See code: [src/commands/dev/convert/messages.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/convert/messages.ts)_
189256

190-
Generate a new sf hook.
257+
## `sf dev convert script`
258+
259+
Convert a script file that contains deprecated sfdx-style commands to use the new sf-style commands instead.
191260

192261
```
193262
USAGE
194-
$ sf dev generate hook --event sf:env:list|sf:env:display|sf:deploy|sf:logout [--force]
263+
$ sf dev convert script -s <value> [--json]
195264
196265
FLAGS
197-
--event=<option> (required) Event to run hook on. Use colons to separate topic and command names of the event.
198-
<options: sf:env:list|sf:env:display|sf:deploy|sf:logout>
199-
--force Overwrite existing files.
266+
-s, --script=<value> (required) Filepath to the script you want to convert.
267+
268+
GLOBAL FLAGS
269+
--json Format output as json.
200270
201271
DESCRIPTION
202-
Generate a new sf hook.
272+
Convert a script file that contains deprecated sfdx-style commands to use the new sf-style commands instead.
203273
204-
You must run this command from within a plugin directory, such as the directory created with the "sf generate plugin"
205-
command.
274+
Important: Use this command only to get started on the sfdx->sf script migration. We don't guarantee that the new
275+
sf-style command replacements work correctly or as you expect. You must test, and probably update, the new script
276+
before putting it into production. We also don't guarantee that the JSON results are the same as before.
277+
278+
This command can convert a large part of your script, but possibly not all. There are some sfdx-style commands that
279+
don't have an obvious sf-style equivalent. In this case, this command doesn't replace the sfdx-style command but
280+
instead adds a comment to remind you that you must convert it manually. See the Salesforce CLI Command Reference for
281+
migration information about each deprecated sfdx-style command:
282+
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm.
283+
284+
This command is interactive; as it scans your script, it prompts you when it finds an sfdx-style command or flag and
285+
asks if you want to convert it to the displayed suggestion. The command doesn't update the script file directly;
286+
rather, it creates a new file whose name is the original name but with "-converted" appended to it. The script
287+
replaces all instances of "sfdx" with "sf". For each prompt you answer "y" to, the command replaces the sfdx-style
288+
names with their equivalent sf-style ones. For example, "sfdx force:apex:execute --targetusername myscratch" is
289+
replaced with "sf apex run --target-org myscratch".
290+
291+
EXAMPLES
292+
Convert the YAML file called "myScript.yml" located in the current directory; the new file that contains the
293+
replacements is called "myScript-converted.yml":
294+
295+
$ sf dev convert script --script ./myScript.yml
296+
```
297+
298+
_See code: [src/commands/dev/convert/script.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/convert/script.ts)_
299+
300+
## `sf dev generate command`
301+
302+
Generate a new sf command.
303+
304+
```
305+
USAGE
306+
$ sf dev generate command -n <value> [--force] [--nuts] [--unit]
307+
308+
FLAGS
309+
-n, --name=<value> (required) Name of the new command. Use colons to separate the topic and command names.
310+
--force Overwrite existing files.
311+
--[no-]nuts Generate a NUT test file for the command.
312+
--[no-]unit Generate a unit test file for the command.
313+
314+
DESCRIPTION
315+
Generate a new sf command.
316+
317+
You must run this command from within a plugin directory, such as the directory created with the "sf dev generate
318+
plugin" command.
319+
320+
The command generates basic source files, messages (\*.md), and test files for your new command. The Typescript files
321+
contain import statements for the minimum required Salesforce libraries, and scaffold some basic code. The new type
322+
names come from the value you passed to the --name flag.
206323
207324
The command updates the package.json file, so if it detects conflicts with the existing file, you're prompted whether
208-
you want to overwrite the file. There are a number of package.json updates required for a new hook, so we recommend
325+
you want to overwrite the file. There are a number of package.json updates required for a new command, so we recommend
209326
you answer "y" so the command takes care of them all. If you answer "n", you must update the package.json file
210327
manually.
211328
212-
The command generates a basic Typescript source file in the "src/hooks" directory to get you started. The source
213-
file's name is based on the event you're hooking into, such as envList.ts for the "sf env list" command.
329+
EXAMPLES
330+
Generate the files for a new "sf my exciting command":
331+
332+
$ sf dev generate command --name my:exciting:command
333+
```
334+
335+
_See code: [src/commands/dev/generate/command.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/generate/command.ts)_
336+
337+
## `sf dev generate flag`
338+
339+
Generate a flag for an existing command.
340+
341+
```
342+
USAGE
343+
$ sf dev generate flag [-d]
344+
345+
FLAGS
346+
-d, --dry-run Print new flag code instead of adding it to the command file.
347+
348+
DESCRIPTION
349+
Generate a flag for an existing command.
350+
351+
You must run this command from within a plugin directory, such as the directory created with the "sf dev generate
352+
plugin" command.
353+
354+
This command is interactive. It first discovers all the commands currently implemented in the plugin, and asks you
355+
which you want to create a new flag for. It then prompts for other flag properties, such as its long name, optional
356+
short name, type, whether it's required, and so on. Long flag names must be kebab-case and not camelCase. The command
357+
doesn't let you use an existing long or short flag name. When the command completes, the Typescript file for the
358+
command is updated with the code for the new flag.
359+
360+
Use the --dry-run flag to review new code for the command file without actually udpating it.
214361
215362
EXAMPLES
216-
Generate source file for a hook into the "sf env display" command:
363+
Generate a new flag and update the command file:
217364
218-
$ sf dev generate hook --event sf:env:display
365+
$ sf dev generate flag
366+
367+
Don't actually update the command file, just view the generated code:
368+
369+
$ sf dev generate flag --dry-run
219370
```
220371

372+
_See code: [src/commands/dev/generate/flag.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/generate/flag.ts)_
373+
221374
## `sf dev generate library`
222375

223376
Generate a new library.
@@ -240,6 +393,8 @@ EXAMPLES
240393
$ sf dev generate library
241394
```
242395

396+
_See code: [src/commands/dev/generate/library.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/generate/library.ts)_
397+
243398
## `sf dev generate plugin`
244399

245400
Generate a new sf plugin.
@@ -259,35 +414,12 @@ DESCRIPTION
259414
When the command completes, your new plugin contains the source, message, and test files for a sample "sf hello world"
260415
command.
261416
262-
EXAMPLES
263-
$ sf dev generate plugin
264-
```
265-
266-
## `sf dev hook HOOK`
267-
268-
Run a hook. For testing purposes only.
269-
270-
```
271-
USAGE
272-
$ sf dev hook [HOOK] [--json] [-p <value>]
273-
274-
ARGUMENTS
275-
HOOK Name of hook to execute.
276-
277-
FLAGS
278-
-p, --plugin=<value> Specific plugin from which to execute hook
279-
280-
GLOBAL FLAGS
281-
--json Format output as json.
417+
ALIASES
418+
$ sf plugins generate
282419
283420
EXAMPLES
284-
Execute a hook by name:
285-
286-
$ sf dev hook sf:env:list
287-
288-
Execute a hook by name in a specific plugin:
289-
290-
$ sf dev hook sf:env:list --plugin env
421+
$ sf dev generate plugin
291422
```
292423

424+
_See code: [src/commands/dev/generate/plugin.ts](https://github.com/salesforcecli/plugin-dev/blob/1.3.4/src/commands/dev/generate/plugin.ts)_
293425
<!-- commandsstop -->

0 commit comments

Comments
 (0)