@cparra/apexdocs 3.9.0 → 3.11.0
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 +55 -2
- package/dist/cli/generate.js +6 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +1 -1
- package/dist/{logger-Cr61RvjC.js → logger-C1Ezw_pW.js} +578 -317
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,6 +123,7 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
|
|
|
123
123
|
| `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | `false` | No |
|
|
124
124
|
| `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
|
|
125
125
|
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
|
|
126
|
+
| `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers` | No |
|
|
126
127
|
|
|
127
128
|
##### Linking Strategy
|
|
128
129
|
|
|
@@ -350,10 +351,62 @@ There are hooks for both Markdown and Changelog operations (but not for OpenApi)
|
|
|
350
351
|
|
|
351
352
|
#### Markdown Hooks
|
|
352
353
|
|
|
354
|
+
##### **macros**
|
|
355
|
+
|
|
356
|
+
Allows defining custom macros that can be used in the documentation.
|
|
357
|
+
|
|
358
|
+
Macros are reusable pieces of text that can be injected into the documentation,
|
|
359
|
+
allowing you to define common pieces of text that you can use across multiple files.
|
|
360
|
+
|
|
361
|
+
A common use case is injecting copyright or license information, without
|
|
362
|
+
having to copy-paste the same text across multiple classes, polluting your
|
|
363
|
+
source code.
|
|
364
|
+
|
|
365
|
+
A macro can be defined in your documentation using the `{{macro_name}}` syntax.
|
|
366
|
+
In the configuration file, you can then define the macro behavior as a key-value pair, where the key is the name of the macro, and the value is a function that returns the text to inject in place of the macro.
|
|
367
|
+
|
|
368
|
+
**Type**
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
type MacroSourceMetadata = {
|
|
372
|
+
type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
|
|
373
|
+
name: string;
|
|
374
|
+
filePath: string;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
type MacroFunction = (metadata: MacroSourceMetadata) => string;
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
Notice that the `metadata` object contains information about the source of the file for which the macro is being injected. This allows you to optionally
|
|
381
|
+
return different text based on the source of the file.
|
|
382
|
+
|
|
383
|
+
Example: Injecting a copyright notice
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
//...
|
|
387
|
+
macros: {
|
|
388
|
+
copyright: () => {
|
|
389
|
+
return `Copyright (c) ${new Date().getFullYear()} My Name`;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
//...
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
And then in your source code, you can use the macro like this:
|
|
396
|
+
|
|
397
|
+
```apex
|
|
398
|
+
/**
|
|
399
|
+
* {{copyright}}
|
|
400
|
+
* @description This is a class
|
|
401
|
+
*/
|
|
402
|
+
public class MyClass {
|
|
403
|
+
//...
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
353
407
|
##### **transformReferenceGuide**
|
|
354
408
|
|
|
355
|
-
Allows changing the
|
|
356
|
-
guide page should be skipped.
|
|
409
|
+
Allows changing the frontmatter and content of the reference guide, or if creating a reference guide page altogether should be skipped.
|
|
357
410
|
|
|
358
411
|
**Type**
|
|
359
412
|
|
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-C1Ezw_pW.js');
|
|
5
5
|
var module$1 = require('module');
|
|
6
6
|
var cosmiconfig = require('cosmiconfig');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -88,6 +88,11 @@ const markdownOptions = {
|
|
|
88
88
|
default: logger$1.markdownDefaults.customObjectsGroupName,
|
|
89
89
|
describe: "The name under which custom objects will be grouped in the Reference Guide"
|
|
90
90
|
},
|
|
91
|
+
triggersGroupName: {
|
|
92
|
+
type: "string",
|
|
93
|
+
default: logger$1.markdownDefaults.triggersGroupName,
|
|
94
|
+
describe: "The name under which triggers will be grouped in the Reference Guide"
|
|
95
|
+
},
|
|
91
96
|
namespace: {
|
|
92
97
|
type: "string",
|
|
93
98
|
describe: "The package namespace, if any. If provided, it will be added to the generated files."
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ type LinkingStrategy =
|
|
|
11
11
|
// No logic will be applied, the reference path will be used as is.
|
|
12
12
|
| 'none';
|
|
13
13
|
|
|
14
|
+
type MacroSourceMetadata = {
|
|
15
|
+
type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
|
|
16
|
+
name: string;
|
|
17
|
+
filePath: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type MacroFunction = (metadata: MacroSourceMetadata) => string;
|
|
21
|
+
|
|
14
22
|
type CliConfigurableMarkdownConfig = {
|
|
15
23
|
sourceDir: string;
|
|
16
24
|
targetDir: string;
|
|
@@ -19,6 +27,7 @@ type CliConfigurableMarkdownConfig = {
|
|
|
19
27
|
namespace?: string;
|
|
20
28
|
defaultGroupName: string;
|
|
21
29
|
customObjectsGroupName: string;
|
|
30
|
+
triggersGroupName: string;
|
|
22
31
|
sortAlphabetically: boolean;
|
|
23
32
|
includeMetadata: boolean;
|
|
24
33
|
linkingStrategy: LinkingStrategy;
|
|
@@ -57,7 +66,7 @@ type UserDefinedChangelogConfig = {
|
|
|
57
66
|
|
|
58
67
|
type UserDefinedConfig = UserDefinedMarkdownConfig | UserDefinedOpenApiConfig | UserDefinedChangelogConfig;
|
|
59
68
|
|
|
60
|
-
type MetadataTypes = 'interface' | 'class' | 'enum' | 'customobject' | 'customfield' | 'custommetadata';
|
|
69
|
+
type MetadataTypes = 'interface' | 'class' | 'enum' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
|
|
61
70
|
|
|
62
71
|
type SourceFileMetadata = {
|
|
63
72
|
filePath: string;
|
|
@@ -104,7 +113,7 @@ type DocPageData = {
|
|
|
104
113
|
outputDocPath: string;
|
|
105
114
|
frontmatter: Frontmatter;
|
|
106
115
|
content: string;
|
|
107
|
-
type: 'class' | 'interface' | 'enum' | 'customobject';
|
|
116
|
+
type: 'class' | 'interface' | 'enum' | 'customobject' | 'trigger';
|
|
108
117
|
};
|
|
109
118
|
|
|
110
119
|
type FileChange = {
|
|
@@ -151,6 +160,7 @@ type Skip = {
|
|
|
151
160
|
* The configurable hooks that can be used to modify the output of the Markdown generator.
|
|
152
161
|
*/
|
|
153
162
|
type MarkdownConfigurableHooks = {
|
|
163
|
+
macros: Record<string, MacroFunction>;
|
|
154
164
|
transformReferenceGuide: TransformReferenceGuide;
|
|
155
165
|
transformDocs: TransformDocs;
|
|
156
166
|
transformDocPage: TransformDocPage;
|
|
@@ -231,4 +241,4 @@ type ConfigurableChangelogConfig = Omit<Partial<UserDefinedChangelogConfig>, 'ta
|
|
|
231
241
|
*/
|
|
232
242
|
declare function defineChangelogConfig(config: ConfigurableChangelogConfig): Partial<UserDefinedChangelogConfig>;
|
|
233
243
|
|
|
234
|
-
export { type ChangeLogPageData, type ChangelogConfigurableHooks, type ConfigurableChangelogConfig, type ConfigurableDocPageData, type ConfigurableDocPageReference, type ConfigurableMarkdownConfig, type ConfigurableOpenApiConfig, type DocPageData, type DocPageReference, type MarkdownConfigurableHooks, type ReferenceGuidePageData, type Skip, type SourceChangelog, type TransformChangelogPage, type TransformDocPage, type TransformDocs, type TransformReference, type TransformReferenceGuide, defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip };
|
|
244
|
+
export { type ChangeLogPageData, type ChangelogConfigurableHooks, type ConfigurableChangelogConfig, type ConfigurableDocPageData, type ConfigurableDocPageReference, type ConfigurableMarkdownConfig, type ConfigurableOpenApiConfig, type DocPageData, type DocPageReference, type MacroFunction, type MacroSourceMetadata, type MarkdownConfigurableHooks, type ReferenceGuidePageData, type Skip, type SourceChangelog, type TransformChangelogPage, type TransformDocPage, type TransformDocs, type TransformReference, type TransformReferenceGuide, defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip };
|