Skip to content

Commit acae404

Browse files
mshanemcpeternhale
andauthored
fix: don't overwrite commands with equivalent topics in other plugins
* chore: better progress * chore: wip * refactor: narrower types and stronger type checking @W-13138789@ * chore: fix tests after merge * chore: reapply stash * chore: wireit updates * test: e2e tests generate test files first * refactor: typeguard in place of assertion * fix: binary is on commandMeta, not command * fix: merge subtopics, use maps * fix: config replacements in descriptions * fix: use the correct ensureArray * docs: readme * refactor: reduce ts workarounds * chore: remove unused code * fix: missing commands where there was a topic collision * chore: gitignore for my output files * refactor: remove unused --------- Co-authored-by: Peter Hale <peter.hale@salesforce.com>
1 parent 42ad640 commit acae404

28 files changed

Lines changed: 1598 additions & 1983 deletions

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
module.exports = {
8-
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
8+
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
99
rules: {
1010
'@typescript-eslint/restrict-template-expressions': 'off',
1111
'@typescript-eslint/explicit-function-return-type': 'off',

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ coverage
2424

2525
# generated docs
2626
docs
27+
output*
2728

2829
# -- CLEAN ALL
30+
.eslintcache
31+
.wireit
2932
node_modules
3033

3134
# --

.sfdevrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,24 @@
22
"test": {
33
"testsPath": "test/**/*.test.ts"
44
},
5+
"wireit": {
6+
"test:command-reference": {
7+
"command": "\"./bin/dev\" commandreference:generate --plugins auth --outputdir test/tmp",
8+
"files": ["src/**/*.ts", "messages/**", "package.json"],
9+
"output": ["test/tmp"]
10+
},
11+
"test": {
12+
"dependencies": ["test:compile", "test:only", "lint"]
13+
},
14+
"test:only": {
15+
"command": "nyc mocha \"test/**/*.test.ts\"",
16+
"env": {
17+
"FORCE_COLOR": "2"
18+
},
19+
"files": ["test/**/*.ts", "src/**/*.ts", "**/tsconfig.json", ".mocha*", "!*.nut.ts", ".nycrc"],
20+
"output": [],
21+
"dependencies": ["test:command-reference"]
22+
}
23+
},
524
"exclude-scripts": ["pretest"]
625
}

CHANGELOG.md

Lines changed: 77 additions & 276 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ Generate the [Salesforce CLI command reference guide](https://developer.salesfor
99

1010
First install the plugin.
1111

12-
```sh-session
13-
$ sfdx plugins:install @salesforce/plugin-command-reference
12+
```bash
13+
$ sf plugins install @salesforce/plugin-command-reference
1414
```
1515

1616
Ensure any plugins are installed that you with to generate documentation for.
1717

18-
```sh-session
19-
$ sfdx plugins:install salesforcedx@latest-rc
18+
```bash
19+
$ sf plugins:install salesforce@plugin-auth
2020
```
2121

2222
Now we can generate the documentation for the `latest-rc` tag.
2323

24-
```sh-session
25-
$ sfdx commandreference --plugins salesforcedx
24+
```bash
25+
# notice we can use the oclif shorthand for the plugin name. @salesforce/plugin-foo => foo
26+
$ sf commandreference --plugins auth
2627
```
2728

2829
**Note:** Warnings will occur for missing properties in plugins. Those have to be fixed in the plugin itself.
@@ -50,23 +51,37 @@ Then you can run this in your plugin's CI.
5051
If you need to make changes to this repository, the easiest thing to do is to link it to your Salesforce CLI. After you cloned this plugin, run the following from this plugin directory:
5152

5253
```sh-session
53-
sfdx plugins:link .
54+
sf plugins link .
5455
```
5556

56-
Now, you can install any plugins you want and run the command reference generation on them.
57+
## Testing
5758

58-
```sh-session
59-
sfdx plugins:install salesforcedx
60-
sfdx plugins:install config
61-
sfdx plugins:install alias
62-
sfdx plugins:install auth
63-
sfdx commandreference --plugins salesforcedx,alias,config,auth
59+
How do you know if the output is correct, given your change?
60+
61+
```bash
62+
# Install the current version of the plugin (use `@sf` until the plugin is publishing the sf version as main)
63+
sf plugins install @salesforce/plugin-command-reference@sf
64+
# installs all JIT plugins (if you intend to produce ditamaps for them)
65+
sf jit install
66+
# run using a relatively current version of plugins, saving the output as a "gold file"
67+
sf commandreference generate --plugins login env deploy-retrieve settings functions info sobject limits schema custom-metadata data community signups user org packaging templates apex auth dev @salesforce/sfdx-plugin-lwc-test -d outputGold
6468
```
6569

70+
While working on your branch
71+
72+
```bash
73+
sf plugins link .
74+
# run the same command from above, but with your new version of the plugin, writing to a new output file
75+
sf commandreference generate --plugins login env deploy-retrieve settings functions info sobject limits schema custom-metadata data community signups user org packaging templates apex auth dev @salesforce/sfdx-plugin-lwc-test -d outputNew
76+
```
77+
78+
Now diff the output. Changes should be intentional!
79+
6680
## Commands
6781

6882
<!-- commands -->
69-
* [`sf commandreference generate`](#sf-commandreference-generate)
83+
84+
- [`sf commandreference generate`](#sf-commandreference-generate)
7085

7186
## `sf commandreference generate`
7287

@@ -91,4 +106,5 @@ GLOBAL FLAGS
91106
DESCRIPTION
92107
generate the command reference guide located
93108
```
109+
94110
<!-- commandsstop -->

messages/main.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

messages/main.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# commandSummary
2+
3+
generate the command reference guide located
4+
5+
# commandDescription
6+
7+
generate the command reference guide located
8+
9+
# pluginFlagSummary
10+
11+
comma separated list of plugin names to be part of the generation. Defaults to the oclif plugin in the current working directory
12+
13+
# allFlagSummary
14+
15+
include all relevant plugins in the generation
16+
17+
# hiddenFlagSummary
18+
19+
show hidden commands
20+
21+
# outputdirFlagSummary
22+
23+
output directory to put generated files
24+
25+
# erroronwarningFlagSummary
26+
27+
fail the command if there are any warnings
28+
29+
# ditamapSuffixFlagSummary
30+
31+
unique suffix to append to generated ditamap
32+
33+
# configPathFlagSummary
34+
35+
A path to the directory containing a plugin or cli
36+
37+
# examples
38+
39+
- Generate the command reference guide
40+
41+
<%= config.bin %> <%= command.id %>
42+
43+
- Generate the command reference for a set of plugins
44+
45+
<%= config.bin %> <%= command.id %> --plugins pluginA,pluginB
46+
47+
- Generate the command reference for all plugins
48+
49+
<%= config.bin %> <%= command.id %> --all --output-dir ./docs
50+
51+
- Generate the command reference for all plugins in a directory
52+
53+
<%= config.bin %> <%= command.id %> --all --config-path /path/to/plugin --output-dir ./docs

0 commit comments

Comments
 (0)