@cparra/apexdocs 3.3.2 → 3.4.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 +81 -56
- package/dist/cli/generate.js +8 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -1
- package/dist/{logger-Bujq_eT5.js → logger-BJXlA0YD.js} +725 -401
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -9,10 +9,64 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
ApexDocs is a non-opinionated documentation generator for Salesforce Apex classes.
|
|
12
|
-
It can output documentation in Markdown
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
It can output documentation in Markdown format, which allows you to use the Static Site Generator of your choice to
|
|
13
|
+
create a documentation site that fits your needs, hosted in any static web hosting service.
|
|
14
|
+
|
|
15
|
+
## 👀 Examples
|
|
16
|
+
|
|
17
|
+
ApexDocs generates Markdown files, which can be integrated into any Static Site Generation (SSG) engine,
|
|
18
|
+
(e.g. Jekyll, Vitepress, Hugo, Docosaurus, etc.) to create a documentation site that fits your needs.
|
|
19
|
+
|
|
20
|
+
This gives you the flexibility to create beautiful leveraging your preferred SSG engine, which
|
|
21
|
+
usually provides a wide range of themes, dark mode support, and other features out of the box.
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
<img src="imgs/vitepress-light.png" alt="Vitepress Light" width="45%" />
|
|
25
|
+
<img src="imgs/vitepress-dark.png" alt="Vitepress Dark" width="45%" />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
*These are examples of documentation sites generated using Vitepress.
|
|
29
|
+
Head over to the `examples/vitepress` folder to see the code.*
|
|
30
|
+
|
|
31
|
+
The extra flexibility also lets you integrate the output documentation with your existing documentation site,
|
|
32
|
+
allowing you to match the look and feel of your existing site.
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
<img src="imgs/integration.png" alt="Integration" width="70%" />
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
OpenApi REST definitions can be visualized using a tool like ReDoc, Swagger UI, or any other OpenApi viewer.
|
|
39
|
+
|
|
40
|
+
<div align="center">
|
|
41
|
+
<img src="imgs/redocly.png" alt="OpenApi" width="70%" />
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
This repo contains several other example implementations in the `examples` directory, showcasing how to integrate
|
|
45
|
+
with different tools.
|
|
46
|
+
|
|
47
|
+
* [Examples](./examples)
|
|
48
|
+
|
|
49
|
+
### In the wild
|
|
50
|
+
|
|
51
|
+
Here are some live projects using ApexDocs:
|
|
52
|
+
|
|
53
|
+
- [Trailhead Apex Recipes](https://github.com/trailheadapps/apex-recipes)
|
|
54
|
+
- [Salesforce Commerce Apex Reference](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/cart-reference.html)
|
|
55
|
+
- [Expression (API)](https://cesarparra.github.io/expression/)
|
|
56
|
+
- [Nimble AMS Docs](https://nimbleuser.github.io/nams-api-docs/#/api-reference/)
|
|
57
|
+
|
|
58
|
+
## 🚀 Features
|
|
59
|
+
|
|
60
|
+
* Generate documentation for Salesforce Apex classes as Markdown files
|
|
61
|
+
* Generate an OpenApi REST specification based on `@RestResource` classes
|
|
62
|
+
* Generate a changelog based on the differences between two versions of your Salesforce Apex classes
|
|
63
|
+
* Support for grouping blocks of related code within a class
|
|
64
|
+
* Support for ignoring files and members from being documented
|
|
65
|
+
* Namespace support
|
|
66
|
+
* Configuration file support
|
|
67
|
+
* Single line ApexDoc Blocks
|
|
68
|
+
* Custom tag support
|
|
69
|
+
* And much, much more!
|
|
16
70
|
|
|
17
71
|
## 💿 Installation
|
|
18
72
|
|
|
@@ -26,7 +80,7 @@ npm i -g @cparra/apexdocs
|
|
|
26
80
|
|
|
27
81
|
#### Markdown
|
|
28
82
|
|
|
29
|
-
Run the following command to generate markdown files for your global Salesforce Apex classes:
|
|
83
|
+
Run the following command to generate markdown files for your global Salesforce Apex classes and custom objects:
|
|
30
84
|
|
|
31
85
|
```bash
|
|
32
86
|
apexdocs markdown -s force-app
|
|
@@ -49,38 +103,6 @@ Run the following command to generate a changelog for your Salesforce Apex class
|
|
|
49
103
|
apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir force-app
|
|
50
104
|
```
|
|
51
105
|
|
|
52
|
-
## 🚀 Features
|
|
53
|
-
|
|
54
|
-
* Generate documentation for Salesforce Apex classes as Markdown files
|
|
55
|
-
* Generate an OpenApi REST specification based on `@RestResource` classes
|
|
56
|
-
* Generate a changelog based on the differences between two versions of your Salesforce Apex classes
|
|
57
|
-
* Support for grouping blocks of related code within a class
|
|
58
|
-
* Support for ignoring files and members from being documented
|
|
59
|
-
* Namespace support
|
|
60
|
-
* Configuration file support
|
|
61
|
-
* Single line ApexDoc Blocks
|
|
62
|
-
* Custom tag support
|
|
63
|
-
* And much, much more!
|
|
64
|
-
|
|
65
|
-
## 👀 Demo
|
|
66
|
-
|
|
67
|
-
ApexDocs generates Markdown files, which can be integrated into any Static Site Generation engine,
|
|
68
|
-
(e.g. Jekyll, Vitepress, Hugo, Docosaurus, etc.) to create a documentation site that fits your needs.
|
|
69
|
-
|
|
70
|
-
This repo contains several example implementations in the `examples` directory, showcasing how to integrate
|
|
71
|
-
with some of these tools.
|
|
72
|
-
|
|
73
|
-
* [Examples](./examples)
|
|
74
|
-
|
|
75
|
-
### In the wild
|
|
76
|
-
|
|
77
|
-
Here are some live projects using ApexDocs:
|
|
78
|
-
|
|
79
|
-
- [Trailhead Apex Recipes](https://github.com/trailheadapps/apex-recipes)
|
|
80
|
-
- [Salesforce Commerce Apex Reference](https://developer.salesforce.com/docs/commerce/salesforce-commerce/references/comm-apex-reference/cart-reference.html)
|
|
81
|
-
- [Expression (API)](https://cesarparra.github.io/expression/)
|
|
82
|
-
- [Nimble AMS Docs](https://nimbleuser.github.io/nams-api-docs/#/api-reference/)
|
|
83
|
-
|
|
84
106
|
## ▶️ Available Commands
|
|
85
107
|
|
|
86
108
|
### Markdown
|
|
@@ -89,16 +111,17 @@ Here are some live projects using ApexDocs:
|
|
|
89
111
|
|
|
90
112
|
#### Flags
|
|
91
113
|
|
|
92
|
-
| Flag
|
|
93
|
-
|
|
94
|
-
| `--sourceDir`
|
|
95
|
-
| `--targetDir`
|
|
96
|
-
| `--scope`
|
|
97
|
-
| `--defaultGroupName`
|
|
98
|
-
| `--namespace`
|
|
99
|
-
| `--sortAlphabetically`
|
|
100
|
-
| `--includeMetadata `
|
|
101
|
-
| `--linkingStrategy`
|
|
114
|
+
| Flag | Alias | Description | Default | Required |
|
|
115
|
+
|----------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|----------|
|
|
116
|
+
| `--sourceDir` | `-s` | The directory where the source files are located. | N/A | Yes |
|
|
117
|
+
| `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
|
|
118
|
+
| `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `global` | No |
|
|
119
|
+
| `--defaultGroupName` | N/A | The default group name to use when a group is not specified. | `Miscellaneous` | No |
|
|
120
|
+
| `--namespace` | N/A | The package namespace, if any. If provided, it will be added to the generated files. | N/A | No |
|
|
121
|
+
| `--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 |
|
|
122
|
+
| `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | `false` | No |
|
|
123
|
+
| `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
|
|
124
|
+
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
|
|
102
125
|
|
|
103
126
|
##### Linking Strategy
|
|
104
127
|
|
|
@@ -267,12 +290,12 @@ Then you only need to run the top level `apexdocs` command, and it will generate
|
|
|
267
290
|
Note that you can still run the individual commands if you only want to generate one type of documentation by
|
|
268
291
|
providing the subcommand, e.g `apexdocs markdown` or `apexdocs changelog`.
|
|
269
292
|
|
|
270
|
-
### Excluding
|
|
293
|
+
### Excluding Files from Being Documented
|
|
271
294
|
|
|
272
|
-
|
|
295
|
+
Any pattern included in the `.forceignore` file will be excluded from the documentation.
|
|
273
296
|
|
|
274
|
-
|
|
275
|
-
|
|
297
|
+
Additionally, you can exclude one or multiple files from being documented by providing a list of glob patterns to
|
|
298
|
+
the `exclude` property in the configuration file.
|
|
276
299
|
|
|
277
300
|
```typescript
|
|
278
301
|
import { defineMarkdownConfig } from "@cparra/apexdocs";
|
|
@@ -281,15 +304,17 @@ export default defineMarkdownConfig({
|
|
|
281
304
|
sourceDir: 'force-app',
|
|
282
305
|
targetDir: 'docs',
|
|
283
306
|
scope: ['global', 'public'],
|
|
284
|
-
|
|
307
|
+
exclude: ['**/MyClass.cls', '**/MyOtherClass.cls'],
|
|
285
308
|
...
|
|
286
309
|
});
|
|
287
310
|
```
|
|
288
311
|
|
|
289
|
-
### Excluding
|
|
312
|
+
### Excluding Tags from Appearing in the Documentation
|
|
290
313
|
|
|
291
|
-
|
|
292
|
-
|
|
314
|
+
Note: Only works for Markdown documentation.
|
|
315
|
+
|
|
316
|
+
You can exclude tags from appearing in the documentation by using the `excludeTags` property in the configuration file,
|
|
317
|
+
which allow you to pass a list of tags that you want to exclude from the documentation.
|
|
293
318
|
|
|
294
319
|
```typescript
|
|
295
320
|
import { defineMarkdownConfig } from "@cparra/apexdocs";
|
|
@@ -298,7 +323,7 @@ export default defineMarkdownConfig({
|
|
|
298
323
|
sourceDir: 'force-app',
|
|
299
324
|
targetDir: 'docs',
|
|
300
325
|
scope: ['global', 'public'],
|
|
301
|
-
|
|
326
|
+
excludeTags: ['internal', 'ignore'],
|
|
302
327
|
...
|
|
303
328
|
});
|
|
304
329
|
```
|
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-BJXlA0YD.js');
|
|
5
5
|
var module$1 = require('module');
|
|
6
6
|
var cosmiconfig = require('cosmiconfig');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -17,9 +17,11 @@ require('fp-ts/Option');
|
|
|
17
17
|
require('fast-xml-parser');
|
|
18
18
|
require('handlebars');
|
|
19
19
|
require('fp-ts/boolean');
|
|
20
|
+
require('fp-ts/Array');
|
|
20
21
|
require('fs');
|
|
21
22
|
require('fp-ts/lib/TaskEither');
|
|
22
23
|
require('minimatch');
|
|
24
|
+
require('@salesforce/source-deploy-retrieve');
|
|
23
25
|
require('chalk');
|
|
24
26
|
|
|
25
27
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -73,6 +75,11 @@ const markdownOptions = {
|
|
|
73
75
|
default: logger$1.markdownDefaults.defaultGroupName,
|
|
74
76
|
describe: "Defines the @group name to be used when a file does not specify it."
|
|
75
77
|
},
|
|
78
|
+
customObjectsGroupName: {
|
|
79
|
+
type: "string",
|
|
80
|
+
default: logger$1.markdownDefaults.customObjectsGroupName,
|
|
81
|
+
describe: "The name under which custom objects will be grouped in the Reference Guide"
|
|
82
|
+
},
|
|
76
83
|
namespace: {
|
|
77
84
|
type: "string",
|
|
78
85
|
describe: "The package namespace, if any. If provided, it will be added to the generated files."
|
|
@@ -285,7 +292,6 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
285
292
|
return _function.pipe(
|
|
286
293
|
extractMultiCommandConfig(extractFromProcessFn, "markdown", generatorConfig),
|
|
287
294
|
E__namespace.map((cliArgs) => {
|
|
288
|
-
console.log("markdown", cliArgs);
|
|
289
295
|
return cliArgs;
|
|
290
296
|
}),
|
|
291
297
|
E__namespace.map((cliArgs) => __spreadValues(__spreadValues(__spreadValues({}, configOnlyMarkdownDefaults), generatorConfig), cliArgs))
|
|
@@ -299,7 +305,6 @@ function extractArgsForCommandsProvidedInConfig(extractFromProcessFn, config) {
|
|
|
299
305
|
return _function.pipe(
|
|
300
306
|
extractMultiCommandConfig(extractFromProcessFn, "changelog", generatorConfig),
|
|
301
307
|
E__namespace.map((cliArgs) => {
|
|
302
|
-
console.log("changelog", cliArgs);
|
|
303
308
|
return cliArgs;
|
|
304
309
|
}),
|
|
305
310
|
E__namespace.map((cliArgs) => __spreadValues(__spreadValues(__spreadValues({}, configOnlyChangelogDefaults), generatorConfig), cliArgs))
|
|
@@ -355,7 +360,6 @@ function extractMultiCommandConfig(extractFromProcessFn, command, config) {
|
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
const options = getOptions(command);
|
|
358
|
-
console.log("config", config);
|
|
359
363
|
return E__namespace.tryCatch(() => {
|
|
360
364
|
return yargs(extractFromProcessFn()).config(config).options(options).fail((msg) => {
|
|
361
365
|
throw new Error(`Invalid configuration for command "${command}": ${msg}`);
|
package/dist/index.d.ts
CHANGED
|
@@ -18,11 +18,13 @@ type UserDefinedMarkdownConfig = {
|
|
|
18
18
|
scope: string[];
|
|
19
19
|
namespace?: string;
|
|
20
20
|
defaultGroupName: string;
|
|
21
|
+
customObjectsGroupName: string;
|
|
21
22
|
sortAlphabetically: boolean;
|
|
22
23
|
includeMetadata: boolean;
|
|
23
24
|
linkingStrategy: LinkingStrategy;
|
|
24
25
|
excludeTags: string[];
|
|
25
26
|
referenceGuideTitle: string;
|
|
27
|
+
/** Glob patterns to exclude files from the documentation. */
|
|
26
28
|
exclude: string[];
|
|
27
29
|
} & Partial<ConfigurableHooks>;
|
|
28
30
|
|
|
@@ -53,7 +55,7 @@ type UserDefinedConfig = UserDefinedMarkdownConfig | UserDefinedOpenApiConfig |
|
|
|
53
55
|
type SourceFileMetadata = {
|
|
54
56
|
filePath: string;
|
|
55
57
|
name: string;
|
|
56
|
-
type: 'interface' | 'class' | 'enum';
|
|
58
|
+
type: 'interface' | 'class' | 'enum' | 'customobject' | 'customfield';
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
type DocPageReference = {
|
|
@@ -84,6 +86,7 @@ type DocPageData = {
|
|
|
84
86
|
outputDocPath: string;
|
|
85
87
|
frontmatter: Frontmatter;
|
|
86
88
|
content: string;
|
|
89
|
+
type: 'class' | 'interface' | 'enum' | 'customobject';
|
|
87
90
|
};
|
|
88
91
|
|
|
89
92
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var logger = require('./logger-
|
|
3
|
+
var logger = require('./logger-BJXlA0YD.js');
|
|
4
4
|
var E = require('fp-ts/Either');
|
|
5
5
|
require('fp-ts/function');
|
|
6
6
|
require('fp-ts/TaskEither');
|
|
@@ -13,9 +13,11 @@ require('fp-ts/Option');
|
|
|
13
13
|
require('fast-xml-parser');
|
|
14
14
|
require('handlebars');
|
|
15
15
|
require('fp-ts/boolean');
|
|
16
|
+
require('fp-ts/Array');
|
|
16
17
|
require('fs');
|
|
17
18
|
require('fp-ts/lib/TaskEither');
|
|
18
19
|
require('minimatch');
|
|
20
|
+
require('@salesforce/source-deploy-retrieve');
|
|
19
21
|
require('chalk');
|
|
20
22
|
|
|
21
23
|
function _interopNamespaceDefault(e) {
|