Skip to content

Commit 3940a17

Browse files
committed
Add lwcGroupName to defaults and update documentation for Lightning Web Components grouping
1 parent 133afb2 commit 3940a17

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
153153
| `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
154154
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
155155
| `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers` | No |
156+
| `--lwcGroupName` | N/A | The name under which Lightning Web Components will be grouped in the Reference Guide | `Triggers` | No |
156157
| `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No |
157158
| `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
158159

src/cli/commands/markdown.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export const markdownOptions: Record<keyof CliConfigurableMarkdownConfig, Option
7979
default: markdownDefaults.triggersGroupName,
8080
describe: 'The name under which triggers will be grouped in the Reference Guide',
8181
},
82+
lwcGroupName: {
83+
type: 'string',
84+
default: markdownDefaults.lwcGroupName,
85+
describe: 'The name under which Lightning Web Components will be grouped in the Reference Guide',
86+
},
8287
namespace: {
8388
type: 'string',
8489
describe: 'The package namespace, if any. If provided, it will be added to the generated files.',

src/core/shared/types.d.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { LwcMetadata } from '../reflection/lwc/reflect-lwc-source';
99
export type Generators = 'markdown' | 'openapi' | 'changelog';
1010

1111
type LinkingStrategy =
12-
// Links will be generated using relative paths.
12+
// Links will be generated using relative paths.
1313
| 'relative'
1414
// No links will be generated.
1515
// If the reference is found, the display name will be used.
@@ -38,6 +38,7 @@ export type CliConfigurableMarkdownConfig = {
3838
defaultGroupName: string;
3939
customObjectsGroupName: string;
4040
triggersGroupName: string;
41+
lwcGroupName: string;
4142
sortAlphabetically: boolean;
4243
includeMetadata: boolean;
4344
linkingStrategy: LinkingStrategy;
@@ -135,10 +136,10 @@ export type UnparsedLightningComponentBundle = {
135136
filePath: string;
136137
content: string;
137138
metadataContent: string;
138-
}
139+
};
139140

140141
type MetadataTypes =
141-
'interface'
142+
| 'interface'
142143
| 'class'
143144
| 'enum'
144145
| 'customobject'
@@ -167,7 +168,7 @@ export type ExternalMetadata = {
167168
export type TopLevelType = Type | CustomObjectMetadata | TriggerMetadata | LwcMetadata;
168169

169170
export type ParsedType =
170-
Type
171+
| Type
171172
| CustomObjectMetadata
172173
| CustomFieldMetadata
173174
| CustomMetadataMetadata
@@ -176,7 +177,7 @@ export type ParsedType =
176177

177178
export type ParsedFile<
178179
T extends ParsedType =
179-
| Type
180+
| Type
180181
| CustomObjectMetadata
181182
| CustomFieldMetadata
182183
| CustomMetadataMetadata

src/core/shared/utils.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,19 @@ export function isSkip(value: unknown): value is Skip {
1919
return Object.prototype.hasOwnProperty.call(value, '_tag') && (value as Skip)._tag === 'Skip';
2020
}
2121

22-
export function isObjectType(
23-
type: ParsedType
24-
): type is CustomObjectMetadata {
22+
export function isObjectType(type: ParsedType): type is CustomObjectMetadata {
2523
return (type as CustomObjectMetadata).type_name === 'customobject';
2624
}
2725

2826
export function isApexType(type: ParsedType): type is Type {
2927
return !isObjectType(type) && !isTriggerType(type) && !isLwcType(type);
3028
}
3129

32-
function isTriggerType(
33-
type: ParsedType,
34-
): type is TriggerMetadata {
30+
function isTriggerType(type: ParsedType): type is TriggerMetadata {
3531
return type.type_name === 'trigger';
3632
}
3733

38-
export function isLwcType(
39-
type: ParsedType,
40-
): type is LwcMetadata {
34+
export function isLwcType(type: ParsedType): type is LwcMetadata {
4135
return type.type_name === 'lwc';
4236
}
4337

@@ -59,7 +53,7 @@ export function getTypeGroup(type: TopLevelType, config: MarkdownGeneratorConfig
5953
case 'trigger':
6054
return config.triggersGroupName;
6155
case 'lwc':
62-
return 'Lightning Web Components'; // TODO: Make this configurable?
56+
return config.lwcGroupName;
6357
default:
6458
return getGroup(type, config);
6559
}

src/defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const markdownDefaults = {
1414
defaultGroupName: 'Miscellaneous',
1515
customObjectsGroupName: 'Custom Objects',
1616
triggersGroupName: 'Triggers',
17+
lwcGroupName: 'Lightning Web Components',
1718
includeMetadata: false,
1819
sortAlphabetically: false,
1920
linkingStrategy: 'relative' as const,

0 commit comments

Comments
 (0)