@cparra/apexdocs 3.15.0-beta.3 → 3.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -18
- package/dist/cli/generate.js +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/{logger-BoR2Jx4z.js → logger-BPNUptnX.js} +87 -46
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -138,24 +138,25 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
|
|
|
138
138
|
|
|
139
139
|
#### Flags
|
|
140
140
|
|
|
141
|
-
| Flag | Alias | Description | Default
|
|
142
|
-
|
|
143
|
-
| `--sourceDir` | `-s` | The directory or directories where the source files are located. | N/A
|
|
144
|
-
| `--useSfdxProjectJson` | N/A | Read source directories from `sfdx-project.json` packageDirectories. Cannot be used with `--sourceDir`. | `false`
|
|
145
|
-
| `--sfdxProjectPath` | N/A | Path to directory containing `sfdx-project.json` (defaults to current directory). Only used with `--useSfdxProjectJson`. | `process.cwd()`
|
|
146
|
-
| `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs`
|
|
147
|
-
| `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `[global]`
|
|
148
|
-
| `--customObjectVisibility` | `-v` | Controls which custom objects are documented. Values should be separated by a space. | `[public]`
|
|
149
|
-
| `--defaultGroupName` | N/A | The default group name to use when a group is not specified. | `Miscellaneous`
|
|
150
|
-
| `--namespace` | N/A | The package namespace, if any. If provided, it will be added to the generated files. | N/A
|
|
151
|
-
| `--sortAlphabetically` | N/A | Sorts files appearing in the Reference Guide alphabetically, as well as the members of a class, interface or enum alphabetically. If false, the members will be displayed in the same order as the code. | `false`
|
|
152
|
-
| `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and the API version | `false`
|
|
153
|
-
| `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative`
|
|
154
|
-
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects`
|
|
155
|
-
| `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers`
|
|
156
|
-
| `--
|
|
157
|
-
| `--
|
|
158
|
-
| `--
|
|
141
|
+
| Flag | Alias | Description | Default | Required |
|
|
142
|
+
|-----------------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|----------|
|
|
143
|
+
| `--sourceDir` | `-s` | The directory or directories where the source files are located. | N/A | * |
|
|
144
|
+
| `--useSfdxProjectJson` | N/A | Read source directories from `sfdx-project.json` packageDirectories. Cannot be used with `--sourceDir`. | `false` | * |
|
|
145
|
+
| `--sfdxProjectPath` | N/A | Path to directory containing `sfdx-project.json` (defaults to current directory). Only used with `--useSfdxProjectJson`. | `process.cwd()` | No |
|
|
146
|
+
| `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
|
|
147
|
+
| `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `[global]` | No |
|
|
148
|
+
| `--customObjectVisibility` | `-v` | Controls which custom objects are documented. Values should be separated by a space. | `[public]` | No |
|
|
149
|
+
| `--defaultGroupName` | N/A | The default group name to use when a group is not specified. | `Miscellaneous` | No |
|
|
150
|
+
| `--namespace` | N/A | The package namespace, if any. If provided, it will be added to the generated files. | N/A | No |
|
|
151
|
+
| `--sortAlphabetically` | N/A | Sorts files appearing in the Reference Guide alphabetically, as well as the members of a class, interface or enum alphabetically. If false, the members will be displayed in the same order as the code. | `false` | No |
|
|
152
|
+
| `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and the API version | `false` | No |
|
|
153
|
+
| `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
|
|
154
|
+
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
|
|
155
|
+
| `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers` | No |
|
|
156
|
+
| `--experimentalLwcSupport` | N/A | Whether to document LWC files or not. | `false` | No |
|
|
157
|
+
| `--lwcGroupName` | N/A | The name under which Lightning Web Components will be grouped in the Reference Guide | `Lightning Web Components` | No |
|
|
158
|
+
| `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No |
|
|
159
|
+
| `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
|
|
159
160
|
|
|
160
161
|
> **Note:** The `*` in the Required column indicates that **one** of the source directory options must be specified:
|
|
161
162
|
> - `--sourceDir` (single directory or array of directories)
|
|
@@ -339,6 +340,9 @@ providing the subcommand, e.g `apexdocs markdown` or `apexdocs changelog`.
|
|
|
339
340
|
|
|
340
341
|
### LWC Documentation Limitations
|
|
341
342
|
|
|
343
|
+
⚠️ LWC documentation is only enabled when providing the `--experimentalLwcSupport` flag or setting the
|
|
344
|
+
`experimentalLwcSupport` property to `true` in the configuration file.
|
|
345
|
+
|
|
342
346
|
ApexDocs supports generating documentation for Lightning Web Components (LWC) as well, but please
|
|
343
347
|
be aware of the following limitations:
|
|
344
348
|
|
package/dist/cli/generate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var logger$1 = require('../logger-
|
|
4
|
+
var logger$1 = require('../logger-BPNUptnX.js');
|
|
5
5
|
var cosmiconfig = require('cosmiconfig');
|
|
6
6
|
var yargs = require('yargs');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -146,6 +146,11 @@ const markdownOptions = {
|
|
|
146
146
|
includeInlineHelpTextMetadata: {
|
|
147
147
|
type: "boolean",
|
|
148
148
|
describe: "Whether to include the inline help text for fields in the generated files."
|
|
149
|
+
},
|
|
150
|
+
experimentalLwcSupport: {
|
|
151
|
+
type: "boolean",
|
|
152
|
+
describe: "Enable experimental support for documenting Lightning Web Components (LWC).",
|
|
153
|
+
default: logger$1.markdownDefaults.experimentalLwcSupport
|
|
149
154
|
}
|
|
150
155
|
};
|
|
151
156
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1822,7 +1822,8 @@ const markdownDefaults = __spreadProps$j(__spreadValues$k({}, markdownAndChangel
|
|
|
1822
1822
|
referenceGuideTitle: "Reference Guide",
|
|
1823
1823
|
excludeTags: [],
|
|
1824
1824
|
includeFieldSecurityMetadata: false,
|
|
1825
|
-
includeInlineHelpTextMetadata: false
|
|
1825
|
+
includeInlineHelpTextMetadata: false,
|
|
1826
|
+
experimentalLwcSupport: false
|
|
1826
1827
|
});
|
|
1827
1828
|
const openApiDefaults = __spreadProps$j(__spreadValues$k({}, commonDefaults), {
|
|
1828
1829
|
fileName: "openapi",
|
|
@@ -3110,6 +3111,9 @@ function generateDocs(unparsedBundles, config) {
|
|
|
3110
3111
|
);
|
|
3111
3112
|
}),
|
|
3112
3113
|
TE__namespace.chain((parsedFiles) => {
|
|
3114
|
+
if (!config.experimentalLwcSupport) {
|
|
3115
|
+
return TE__namespace.right(parsedFiles);
|
|
3116
|
+
}
|
|
3113
3117
|
return _function.pipe(
|
|
3114
3118
|
reflectLwcSource(filterLwcFiles(unparsedBundles)),
|
|
3115
3119
|
TE__namespace.map((parsedFiles2) => parsedFiles2.filter((file) => file.type.isExposed)),
|
|
@@ -5163,18 +5167,19 @@ function getLightningComponentBundleSourceComponents(sourceComponents) {
|
|
|
5163
5167
|
}
|
|
5164
5168
|
function toUnparsedApexBundle(fileSystem, apexSourceComponents) {
|
|
5165
5169
|
return apexSourceComponents.map((component) => {
|
|
5166
|
-
const
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5171
|
+
if (content === null) {
|
|
5172
|
+
return null;
|
|
5173
|
+
}
|
|
5174
|
+
const metadataContent = component.xmlPath ? fileSystem.readFile(component.xmlPath) : null;
|
|
5170
5175
|
return {
|
|
5171
5176
|
type: "apex",
|
|
5172
5177
|
name: component.name,
|
|
5173
5178
|
filePath: component.contentPath,
|
|
5174
|
-
content
|
|
5175
|
-
metadataContent
|
|
5179
|
+
content,
|
|
5180
|
+
metadataContent
|
|
5176
5181
|
};
|
|
5177
|
-
});
|
|
5182
|
+
}).filter((bundle) => bundle !== null);
|
|
5178
5183
|
}
|
|
5179
5184
|
function getTriggerSourceComponents(sourceComponents) {
|
|
5180
5185
|
return sourceComponents.filter((component) => component.type.name === "ApexTrigger").map((component) => ({
|
|
@@ -5184,12 +5189,18 @@ function getTriggerSourceComponents(sourceComponents) {
|
|
|
5184
5189
|
}));
|
|
5185
5190
|
}
|
|
5186
5191
|
function toUnparsedTriggerBundle(fileSystem, triggerSourceComponents) {
|
|
5187
|
-
return triggerSourceComponents.map((component) =>
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5192
|
+
return triggerSourceComponents.map((component) => {
|
|
5193
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5194
|
+
if (content === null) {
|
|
5195
|
+
return null;
|
|
5196
|
+
}
|
|
5197
|
+
return {
|
|
5198
|
+
type: "trigger",
|
|
5199
|
+
name: component.name,
|
|
5200
|
+
filePath: component.contentPath,
|
|
5201
|
+
content
|
|
5202
|
+
};
|
|
5203
|
+
}).filter((bundle) => bundle !== null);
|
|
5193
5204
|
}
|
|
5194
5205
|
function getCustomObjectSourceComponents(sourceComponents) {
|
|
5195
5206
|
return sourceComponents.filter((component) => component.type.name === "CustomObject").map((component) => ({
|
|
@@ -5200,13 +5211,17 @@ function getCustomObjectSourceComponents(sourceComponents) {
|
|
|
5200
5211
|
}
|
|
5201
5212
|
function toUnparsedSObjectBundle(fileSystem, customObjectSourceComponents) {
|
|
5202
5213
|
return customObjectSourceComponents.map((component) => {
|
|
5214
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5215
|
+
if (content === null) {
|
|
5216
|
+
return null;
|
|
5217
|
+
}
|
|
5203
5218
|
return {
|
|
5204
5219
|
type: "customobject",
|
|
5205
5220
|
name: component.name,
|
|
5206
5221
|
filePath: component.contentPath,
|
|
5207
|
-
content
|
|
5222
|
+
content
|
|
5208
5223
|
};
|
|
5209
|
-
});
|
|
5224
|
+
}).filter((bundle) => bundle !== null);
|
|
5210
5225
|
}
|
|
5211
5226
|
function getCustomFieldSourceComponents(sourceComponents) {
|
|
5212
5227
|
return sourceComponents.filter((component) => component.type.name === "CustomField").map((component) => ({
|
|
@@ -5217,13 +5232,19 @@ function getCustomFieldSourceComponents(sourceComponents) {
|
|
|
5217
5232
|
}));
|
|
5218
5233
|
}
|
|
5219
5234
|
function toUnparsedCustomFieldBundle(fileSystem, customFieldSourceComponents) {
|
|
5220
|
-
return customFieldSourceComponents.map((component) =>
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5235
|
+
return customFieldSourceComponents.map((component) => {
|
|
5236
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5237
|
+
if (content === null) {
|
|
5238
|
+
return null;
|
|
5239
|
+
}
|
|
5240
|
+
return {
|
|
5241
|
+
type: "customfield",
|
|
5242
|
+
name: component.name,
|
|
5243
|
+
filePath: component.contentPath,
|
|
5244
|
+
content,
|
|
5245
|
+
parentName: component.parentName
|
|
5246
|
+
};
|
|
5247
|
+
}).filter((bundle) => bundle !== null);
|
|
5227
5248
|
}
|
|
5228
5249
|
function getCustomMetadataSourceComponents(sourceComponents) {
|
|
5229
5250
|
function getParentAndNamePair(component) {
|
|
@@ -5239,25 +5260,38 @@ function getCustomMetadataSourceComponents(sourceComponents) {
|
|
|
5239
5260
|
}));
|
|
5240
5261
|
}
|
|
5241
5262
|
function toUnparsedCustomMetadataBundle(fileSystem, customMetadataSourceComponents) {
|
|
5242
|
-
return customMetadataSourceComponents.map((component) =>
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5263
|
+
return customMetadataSourceComponents.map((component) => {
|
|
5264
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5265
|
+
if (content === null) {
|
|
5266
|
+
return null;
|
|
5267
|
+
}
|
|
5268
|
+
return {
|
|
5269
|
+
apiName: component.apiName,
|
|
5270
|
+
type: "custommetadata",
|
|
5271
|
+
name: component.name,
|
|
5272
|
+
filePath: component.contentPath,
|
|
5273
|
+
content,
|
|
5274
|
+
parentName: component.parentName
|
|
5275
|
+
};
|
|
5276
|
+
}).filter((bundle) => bundle !== null);
|
|
5250
5277
|
}
|
|
5251
5278
|
function toUnparsedLWCBundle(fileSystem, lwcSourceComponents) {
|
|
5252
|
-
return lwcSourceComponents.map((component) =>
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5279
|
+
return lwcSourceComponents.map((component) => {
|
|
5280
|
+
const content = fileSystem.readFile(component.contentPath);
|
|
5281
|
+
const metadataContent = fileSystem.readFile(component.xmlPath);
|
|
5282
|
+
if (content === null || metadataContent === null) {
|
|
5283
|
+
return null;
|
|
5284
|
+
}
|
|
5285
|
+
return {
|
|
5286
|
+
type: "lwc",
|
|
5287
|
+
name: component.name,
|
|
5288
|
+
filePath: component.contentPath,
|
|
5289
|
+
content,
|
|
5290
|
+
metadataContent
|
|
5291
|
+
};
|
|
5292
|
+
}).filter((bundle) => bundle !== null);
|
|
5259
5293
|
}
|
|
5260
|
-
function processFiles(fileSystem) {
|
|
5294
|
+
function processFiles(fileSystem, config) {
|
|
5261
5295
|
return (componentTypesToRetrieve, options = { includeMetadata: false }) => {
|
|
5262
5296
|
const converters = {
|
|
5263
5297
|
ApexClass: _function.flow(
|
|
@@ -5281,7 +5315,7 @@ function processFiles(fileSystem) {
|
|
|
5281
5315
|
(triggerSourceComponents) => toUnparsedTriggerBundle(fileSystem, triggerSourceComponents)
|
|
5282
5316
|
),
|
|
5283
5317
|
LightningComponentBundle: _function.flow(
|
|
5284
|
-
getLightningComponentBundleSourceComponents,
|
|
5318
|
+
config.experimentalLwcSupport ? getLightningComponentBundleSourceComponents : () => [],
|
|
5285
5319
|
(lwcSourceComponents) => toUnparsedLWCBundle(fileSystem, lwcSourceComponents)
|
|
5286
5320
|
)
|
|
5287
5321
|
};
|
|
@@ -5332,7 +5366,11 @@ class DefaultFileSystem {
|
|
|
5332
5366
|
return [...components, ...fieldComponents];
|
|
5333
5367
|
}
|
|
5334
5368
|
readFile(pathToRead) {
|
|
5335
|
-
|
|
5369
|
+
try {
|
|
5370
|
+
return fs__namespace.readFileSync(pathToRead, "utf8");
|
|
5371
|
+
} catch (error) {
|
|
5372
|
+
return null;
|
|
5373
|
+
}
|
|
5336
5374
|
}
|
|
5337
5375
|
}
|
|
5338
5376
|
|
|
@@ -5505,7 +5543,7 @@ class Apexdocs {
|
|
|
5505
5543
|
});
|
|
5506
5544
|
}
|
|
5507
5545
|
}
|
|
5508
|
-
const readFiles = processFiles
|
|
5546
|
+
const readFiles = apply(processFiles, new DefaultFileSystem());
|
|
5509
5547
|
function processMarkdown(config) {
|
|
5510
5548
|
return __async(this, null, function* () {
|
|
5511
5549
|
return _function.pipe(
|
|
@@ -5513,7 +5551,7 @@ function processMarkdown(config) {
|
|
|
5513
5551
|
E__namespace.mapLeft((error) => new FileReadingError(`Failed to resolve source directories: ${error.message}`, error)),
|
|
5514
5552
|
E__namespace.flatMap(
|
|
5515
5553
|
(sourceDirs) => E__namespace.tryCatch(
|
|
5516
|
-
() => readFiles(allComponentTypes, {
|
|
5554
|
+
() => readFiles({ experimentalLwcSupport: config.experimentalLwcSupport })(allComponentTypes, {
|
|
5517
5555
|
includeMetadata: config.includeMetadata
|
|
5518
5556
|
})(sourceDirs, config.exclude),
|
|
5519
5557
|
(e) => new FileReadingError("An error occurred while reading files.", e)
|
|
@@ -5535,7 +5573,10 @@ function processOpenApi(config, logger) {
|
|
|
5535
5573
|
TE__namespace.flatMap(
|
|
5536
5574
|
(sourceDirs) => TE__namespace.tryCatch(
|
|
5537
5575
|
() => {
|
|
5538
|
-
const fileBodies = readFiles(["ApexClass"])(
|
|
5576
|
+
const fileBodies = readFiles({ experimentalLwcSupport: false })(["ApexClass"])(
|
|
5577
|
+
sourceDirs,
|
|
5578
|
+
config.exclude
|
|
5579
|
+
);
|
|
5539
5580
|
return openApi(logger, fileBodies, config);
|
|
5540
5581
|
},
|
|
5541
5582
|
(e) => new FileReadingError("An error occurred while generating OpenAPI documentation.", e)
|
|
@@ -5574,8 +5615,8 @@ function processChangeLog(config) {
|
|
|
5574
5615
|
)
|
|
5575
5616
|
),
|
|
5576
5617
|
E__namespace.map(({ previousVersionDirs, currentVersionDirs }) => [
|
|
5577
|
-
readFiles(allComponentTypes)(previousVersionDirs, config.exclude),
|
|
5578
|
-
readFiles(allComponentTypes)(currentVersionDirs, config.exclude)
|
|
5618
|
+
readFiles({ experimentalLwcSupport: false })(allComponentTypes)(previousVersionDirs, config.exclude),
|
|
5619
|
+
readFiles({ experimentalLwcSupport: false })(allComponentTypes)(currentVersionDirs, config.exclude)
|
|
5579
5620
|
])
|
|
5580
5621
|
);
|
|
5581
5622
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.1",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
|
-
"@cparra/apex-reflection": "2.
|
|
95
|
+
"@cparra/apex-reflection": "2.21.1",
|
|
96
96
|
"@salesforce/source-deploy-retrieve": "^12.20.1",
|
|
97
97
|
"@types/js-yaml": "^4.0.9",
|
|
98
98
|
"@types/yargs": "^17.0.32",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"fast-xml-parser": "^4.4.0",
|
|
103
103
|
"fp-ts": "^2.16.8",
|
|
104
104
|
"handlebars": "^4.7.8",
|
|
105
|
-
"js-yaml": "
|
|
105
|
+
"js-yaml": "4.1.1",
|
|
106
106
|
"minimatch": "^10.0.1",
|
|
107
107
|
"yargs": "^17.7.2"
|
|
108
108
|
},
|