@cparra/apexdocs 3.15.0-alpha.0 โ†’ 3.15.0-beta.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 CHANGED
@@ -18,14 +18,14 @@ create a documentation site that fits your needs, hosted in any static web hosti
18
18
  - [๐Ÿš€ Features](#-features)
19
19
  - [๐Ÿ’ฟ Installation](#-installation)
20
20
  - [โšก Quick Start](#-quick-start)
21
- - [CLI](#cli)
22
- - [Markdown](#markdown)
23
- - [OpenApi](#openapi)
24
- - [Changelog](#changelog)
21
+ - [CLI](#cli)
22
+ - [Markdown](#markdown)
23
+ - [OpenApi](#openapi)
24
+ - [Changelog](#changelog)
25
25
  - [โ–ถ๏ธ Available Commands](#๏ธ-available-commands)
26
- - [Markdown](#markdown-1)
27
- - [OpenApi](#openapi-1)
28
- - [Changelog](#changelog-1)
26
+ - [Markdown](#markdown-1)
27
+ - [OpenApi](#openapi-1)
28
+ - [Changelog](#changelog-1)
29
29
  - [๐Ÿ”ฌ Defining a configuration file](#-defining-a-configuration-file)
30
30
  - [๐ŸŒ Translation](#-translation)
31
31
  - [โคต๏ธŽ Importing to your project](#๏ธŽ-importing-to-your-project)
@@ -77,7 +77,7 @@ Here are some live projects using ApexDocs:
77
77
 
78
78
  ## ๐Ÿš€ Features
79
79
 
80
- * Generate documentation for Salesforce Apex classes as Markdown files
80
+ * Generate documentation for Salesforce code (Apex, triggers, custom objects, LWCs) as Markdown files
81
81
  * Generate an OpenApi REST specification based on `@RestResource` classes
82
82
  * Generate a changelog based on the differences between two versions of your Salesforce Apex classes
83
83
  * Support for grouping blocks of related code within a class
@@ -110,7 +110,7 @@ apexdocs markdown -s force-app
110
110
  apexdocs markdown --useSfdxProjectJson
111
111
 
112
112
  # Specify multiple source directories
113
- apexdocs markdown --sourceDirs force-app force-lwc force-utils
113
+ apexdocs markdown --sourceDir force-app force-lwc force-utils
114
114
  ```
115
115
 
116
116
  #### OpenApi
@@ -140,9 +140,8 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
140
140
 
141
141
  | Flag | Alias | Description | Default | Required |
142
142
  |-----------------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|----------|
143
- | `--sourceDir` | `-s` | The directory where the source files are located. | N/A | * |
144
- | `--sourceDirs` | N/A | Multiple source directories (space-separated). Cannot be used with `--sourceDir` or `--useSfdxProjectJson`. | N/A | * |
145
- | `--useSfdxProjectJson` | N/A | Read source directories from `sfdx-project.json` packageDirectories. Cannot be used with `--sourceDir` or `--sourceDirs`. | `false` | * |
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` | * |
146
145
  | `--sfdxProjectPath` | N/A | Path to directory containing `sfdx-project.json` (defaults to current directory). Only used with `--useSfdxProjectJson`. | `process.cwd()` | No |
147
146
  | `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
148
147
  | `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `[global]` | No |
@@ -150,18 +149,16 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
150
149
  | `--defaultGroupName` | N/A | The default group name to use when a group is not specified. | `Miscellaneous` | No |
151
150
  | `--namespace` | N/A | The package namespace, if any. If provided, it will be added to the generated files. | N/A | No |
152
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 |
153
- | `--includeMetadata ` | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | `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 |
154
153
  | `--linkingStrategy` | N/A | The strategy to use when linking to other classes. Possible values are `relative`, `no-link`, and `none` | `relative` | No |
155
154
  | `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
156
155
  | `--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 |
157
157
  | `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No |
158
- || `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
159
- || `--parallelProcessing` | N/A | Whether to use parallel processing for reflection operations. | `true` | No |
160
- || `--workerThreads` | N/A | Number of worker threads to use for parallel processing (defaults to number of CPU cores). | CPU cores | No |
158
+ | `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
161
159
 
162
160
  > **Note:** The `*` in the Required column indicates that **one** of the source directory options must be specified:
163
- > - `--sourceDir` (single directory)
164
- > - `--sourceDirs` (multiple directories)
161
+ > - `--sourceDir` (single directory or array of directories)
165
162
  > - `--useSfdxProjectJson` (read from sfdx-project.json)
166
163
  >
167
164
  > These options are mutually exclusive - you cannot use more than one at the same time.
@@ -235,9 +232,7 @@ apexdocs openapi -s force-app -t docs -n MyNamespace --title "My Custom OpenApi
235
232
  | `--fileName` | N/A | The name of the changelog file to be generated. | `changelog` | No |
236
233
  | `--scope` | N/A | The list of scope to respect when generating the changelog. | ['global'] | No |
237
234
  | `--customObjectVisibility` | `-v` | Controls which custom objects are documented. Values should be separated by a space. | ['public'] | No |
238
- || `--skipIfNoChanges` | N/A | Whether to skip generating the changelog if there are no changes. | `true` | No |
239
- || `--parallelProcessing` | N/A | Whether to use parallel processing for reflection operations. | `true` | No |
240
- || `--workerThreads` | N/A | Number of worker threads to use for parallel processing (defaults to number of CPU cores). | CPU cores | No |
235
+ | `--skipIfNoChanges` | N/A | Whether to skip generating the changelog if there are no changes. | `true` | No |
241
236
 
242
237
  #### Sample Usage
243
238
 
@@ -247,62 +242,6 @@ apexdocs changelog -p force-app-previous -t force-app
247
242
 
248
243
  ---
249
244
 
250
- ## โšก Parallel Processing
251
-
252
- ApexDocs supports parallel processing for reflection operations, significantly improving performance when processing large numbers of Apex files. This feature uses Node.js Worker Threads to process files in parallel while maintaining full compatibility with existing configurations.
253
-
254
- ### Key Features
255
-
256
- - **Automatic**: Enabled by default in production environments
257
- - **Adaptive**: Automatically chooses between parallel and sequential processing based on file count and environment
258
- - **Configurable**: Control the number of worker threads used
259
- - **Safe**: Automatically disabled during tests to prevent interference
260
-
261
- ### Configuration
262
-
263
- ```typescript
264
- import { defineMarkdownConfig } from '@cparra/apexdocs';
265
-
266
- export default defineMarkdownConfig({
267
- sourceDir: 'force-app',
268
- targetDir: 'docs',
269
-
270
- // Enable/disable parallel processing (default: true in production)
271
- parallelProcessing: true,
272
-
273
- // Set number of worker threads (default: CPU cores)
274
- workerThreads: 4,
275
- });
276
- ```
277
-
278
- ### CLI Usage
279
-
280
- ```bash
281
- # Use parallel processing (default)
282
- apexdocs markdown -s force-app
283
-
284
- # Disable parallel processing
285
- apexdocs markdown -s force-app --parallelProcessing false
286
-
287
- # Set custom worker thread count
288
- apexdocs markdown -s force-app --workerThreads 8
289
- ```
290
-
291
- ### Performance Benefits
292
-
293
- - **Large codebases**: Significant performance improvements for projects with many files
294
- - **Multi-core systems**: Better utilization of available CPU cores
295
- - **CI/CD pipelines**: Faster documentation generation in automated environments
296
-
297
- ### When It's Used
298
-
299
- - **Parallel**: Multiple files + production environment + parallel enabled
300
- - **Sequential**: Single file OR test environment OR parallel disabled
301
-
302
- For more detailed information, see [PARALLEL_PROCESSING.md](PARALLEL_PROCESSING.md).
303
-
304
- ---
305
-
306
245
  ## ๐Ÿ”ฌ Defining a configuration file
307
246
 
308
247
  You can also use a configuration file to define the parameters that will be used when generating the documentation.
@@ -398,6 +337,15 @@ Then you only need to run the top level `apexdocs` command, and it will generate
398
337
  Note that you can still run the individual commands if you only want to generate one type of documentation by
399
338
  providing the subcommand, e.g `apexdocs markdown` or `apexdocs changelog`.
400
339
 
340
+ ### LWC Documentation Limitations
341
+
342
+ ApexDocs supports generating documentation for Lightning Web Components (LWC) as well, but please
343
+ be aware of the following limitations:
344
+
345
+ * Only components marked as `isExposed=true` in the component's meta.xml file will be documented.
346
+ * At the moment, any JSDoc comments are ignored, documentation is based solely on the component's metadata.
347
+ * Changelog generation does not include changes to LWCs.
348
+
401
349
  ### Excluding Files from Being Documented
402
350
 
403
351
  Any pattern included in the `.forceignore` file will be excluded from the documentation.
@@ -456,61 +404,6 @@ There are hooks for both Markdown and Changelog operations (but not for OpenApi)
456
404
 
457
405
  #### Markdown Hooks
458
406
 
459
- ##### **macros**
460
-
461
- Allows defining custom macros that can be used in the documentation.
462
-
463
- Macros are reusable pieces of text that can be injected into the documentation,
464
- allowing you to define common pieces of text that you can use across multiple files.
465
-
466
- A common use case is injecting copyright or license information, without
467
- having to copy-paste the same text across multiple classes, polluting your
468
- source code.
469
-
470
- A macro can be defined in your documentation using the `{{macro_name}}` syntax.
471
- In the configuration file, you can then define the macro behavior as a key-value pair, where the key is the name of the
472
- macro, and the value is a function that returns the text to inject in place of the macro.
473
-
474
- **Type**
475
-
476
- ```typescript
477
- type MacroSourceMetadata = {
478
- type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
479
- name: string;
480
- filePath: string;
481
- };
482
-
483
- type MacroFunction = (metadata: MacroSourceMetadata) => string;
484
- ```
485
-
486
- Notice that the `metadata` object contains information about the source of the file for which the macro is being
487
- injected. This allows you to optionally
488
- return different text based on the source of the file.
489
-
490
- Example: Injecting a copyright notice
491
-
492
- ```typescript
493
- //...
494
- macros: {
495
- copyright: () => {
496
- return `@copyright Copyright (c) ${new Date().getFullYear()} My Name`;
497
- }
498
- }
499
- //...
500
- ```
501
-
502
- And then in your source code, you can use the macro like this:
503
-
504
- ```apex
505
- /**
506
- * {{copyright}}
507
- * @description This is a class
508
- */
509
- public class MyClass {
510
- //...
511
- }
512
- ```
513
-
514
407
  ##### **transformReferenceGuide**
515
408
 
516
409
  Allows changing the frontmatter and content of the reference guide, or if creating a reference guide page altogether
@@ -623,6 +516,61 @@ export default {
623
516
  };
624
517
  ```
625
518
 
519
+ ##### **macros**
520
+
521
+ Allows defining custom macros that can be used in the documentation.
522
+
523
+ Macros are reusable pieces of text that can be injected into the documentation,
524
+ allowing you to define common pieces of text that you can use across multiple files.
525
+
526
+ A common use case is injecting copyright or license information, without
527
+ having to copy-paste the same text across multiple classes, polluting your
528
+ source code.
529
+
530
+ A macro can be defined in your documentation using the `{{macro_name}}` syntax.
531
+ In the configuration file, you can then define the macro behavior as a key-value pair, where the key is the name of the
532
+ macro, and the value is a function that returns the text to inject in place of the macro.
533
+
534
+ **Type**
535
+
536
+ ```typescript
537
+ type MacroSourceMetadata = {
538
+ type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger' | 'lwc';
539
+ name: string;
540
+ filePath: string;
541
+ };
542
+
543
+ type MacroFunction = (metadata: MacroSourceMetadata) => string;
544
+ ```
545
+
546
+ Notice that the `metadata` object contains information about the source of the file for which the macro is being
547
+ injected. This allows you to optionally
548
+ return different text based on the source of the file.
549
+
550
+ Example: Injecting a copyright notice
551
+
552
+ ```typescript
553
+ //...
554
+ macros: {
555
+ copyright: () => {
556
+ return `@copyright Copyright (c) ${new Date().getFullYear()} My Name`;
557
+ }
558
+ }
559
+ //...
560
+ ```
561
+
562
+ And then in your source code, you can use the macro like this:
563
+
564
+ ```apex
565
+ /**
566
+ * {{copyright}}
567
+ * @description This is a class
568
+ */
569
+ public class MyClass {
570
+ //...
571
+ }
572
+ ```
573
+
626
574
  #### Changelog Hooks
627
575
 
628
576
  ##### **transformChangeLogPage**
@@ -1,26 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var logger$1 = require('../logger-BbAtfln6.js');
5
- var require$$0 = require('yargs');
4
+ var logger$1 = require('../logger-DaV___bL.js');
6
5
  var cosmiconfig = require('cosmiconfig');
6
+ var yargs = require('yargs');
7
7
  var E = require('fp-ts/Either');
8
8
  var cosmiconfigTypescriptLoader = require('cosmiconfig-typescript-loader');
9
9
  var _function = require('fp-ts/function');
10
10
  require('fp-ts/TaskEither');
11
11
  require('js-yaml');
12
12
  require('path');
13
+ require('fp-ts/Task');
14
+ require('fp-ts/lib/Array');
15
+ require('@cparra/apex-reflection');
13
16
  require('fp-ts/Option');
17
+ require('fast-xml-parser');
14
18
  require('handlebars');
15
19
  require('fp-ts/boolean');
16
- require('fast-xml-parser');
17
- require('fp-ts/Task');
18
20
  require('fp-ts/Array');
19
- require('worker_threads');
20
- require('os');
21
- require('fp-ts/lib/Array');
22
- require('@cparra/apex-reflection');
23
- require('uuid');
24
21
  require('fs');
25
22
  require('fp-ts/lib/TaskEither');
26
23
  require('minimatch');
@@ -111,6 +108,11 @@ const markdownOptions = {
111
108
  default: logger$1.markdownDefaults.triggersGroupName,
112
109
  describe: "The name under which triggers will be grouped in the Reference Guide"
113
110
  },
111
+ lwcGroupName: {
112
+ type: "string",
113
+ default: logger$1.markdownDefaults.lwcGroupName,
114
+ describe: "The name under which Lightning Web Components will be grouped in the Reference Guide"
115
+ },
114
116
  namespace: {
115
117
  type: "string",
116
118
  describe: "The package namespace, if any. If provided, it will be added to the generated files."
@@ -144,15 +146,6 @@ const markdownOptions = {
144
146
  includeInlineHelpTextMetadata: {
145
147
  type: "boolean",
146
148
  describe: "Whether to include the inline help text for fields in the generated files."
147
- },
148
- parallelProcessing: {
149
- type: "boolean",
150
- describe: "Whether to use parallel processing for reflection operations.",
151
- default: logger$1.markdownDefaults.parallelProcessing
152
- },
153
- workerThreads: {
154
- type: "number",
155
- describe: "Number of worker threads to use for parallel processing (defaults to number of CPU cores)."
156
149
  }
157
150
  };
158
151
 
@@ -268,15 +261,6 @@ const changeLogOptions = {
268
261
  type: "boolean",
269
262
  default: logger$1.changeLogDefaults.skipIfNoChanges,
270
263
  describe: "Skip the changelog generation if there are no changes between the previous and current version."
271
- },
272
- parallelProcessing: {
273
- type: "boolean",
274
- describe: "Whether to use parallel processing for reflection operations.",
275
- default: logger$1.changeLogDefaults.parallelProcessing
276
- },
277
- workerThreads: {
278
- type: "number",
279
- describe: "Number of worker threads to use for parallel processing (defaults to number of CPU cores)."
280
264
  }
281
265
  };
282
266
 
@@ -319,7 +303,6 @@ var __async$1 = (__this, __arguments, generator) => {
319
303
  step((generator = generator.apply(__this, __arguments)).next());
320
304
  });
321
305
  };
322
- const yargs = require$$0;
323
306
  const configOnlyMarkdownDefaults = {
324
307
  targetGenerator: "markdown",
325
308
  excludeTags: [],
package/dist/index.d.ts CHANGED
@@ -121,6 +121,12 @@ type Translations = {
121
121
  inheritance: string;
122
122
  implements: string;
123
123
  };
124
+ lwc: {
125
+ exposed: string;
126
+ targets: string;
127
+ targetConfigs: string;
128
+ properties: string;
129
+ };
124
130
  };
125
131
  };
126
132
 
@@ -149,7 +155,7 @@ type LinkingStrategy =
149
155
  | 'none';
150
156
 
151
157
  type MacroSourceMetadata = {
152
- type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
158
+ type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger' | 'lwc';
153
159
  name: string;
154
160
  filePath: string;
155
161
  };
@@ -167,14 +173,13 @@ type CliConfigurableMarkdownConfig = {
167
173
  defaultGroupName: string;
168
174
  customObjectsGroupName: string;
169
175
  triggersGroupName: string;
176
+ lwcGroupName: string;
170
177
  sortAlphabetically: boolean;
171
178
  includeMetadata: boolean;
172
179
  linkingStrategy: LinkingStrategy;
173
180
  referenceGuideTitle: string;
174
181
  includeFieldSecurityMetadata: boolean;
175
182
  includeInlineHelpTextMetadata: boolean;
176
- parallelProcessing?: boolean;
177
- workerThreads?: number;
178
183
  };
179
184
 
180
185
  type UserDefinedMarkdownConfig = {
@@ -209,13 +214,19 @@ type UserDefinedChangelogConfig = {
209
214
  exclude: string[];
210
215
  skipIfNoChanges: boolean;
211
216
  translations?: UserTranslations['changelog'];
212
- parallelProcessing?: boolean;
213
- workerThreads?: number;
214
217
  } & Partial<ChangelogConfigurableHooks>;
215
218
 
216
219
  type UserDefinedConfig = UserDefinedMarkdownConfig | UserDefinedOpenApiConfig | UserDefinedChangelogConfig;
217
220
 
218
- type MetadataTypes = 'interface' | 'class' | 'enum' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
221
+ type MetadataTypes =
222
+ | 'interface'
223
+ | 'class'
224
+ | 'enum'
225
+ | 'customobject'
226
+ | 'customfield'
227
+ | 'custommetadata'
228
+ | 'trigger'
229
+ | 'lwc';
219
230
 
220
231
  type SourceFileMetadata = {
221
232
  filePath: string;
@@ -262,7 +273,7 @@ type DocPageData = {
262
273
  outputDocPath: string;
263
274
  frontmatter: Frontmatter;
264
275
  content: string;
265
- type: 'class' | 'interface' | 'enum' | 'customobject' | 'trigger';
276
+ type: 'class' | 'interface' | 'enum' | 'customobject' | 'trigger' | 'lwc';
266
277
  };
267
278
 
268
279
  type FileChange = {
@@ -390,4 +401,5 @@ type ConfigurableChangelogConfig = Omit<Partial<UserDefinedChangelogConfig>, 'ta
390
401
  */
391
402
  declare function defineChangelogConfig(config: ConfigurableChangelogConfig): Partial<UserDefinedChangelogConfig>;
392
403
 
393
- 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, type Translations, type UserTranslations, defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip };
404
+ export { defineChangelogConfig, defineMarkdownConfig, defineOpenApiConfig, process, skip };
405
+ export type { ChangeLogPageData, ChangelogConfigurableHooks, ConfigurableChangelogConfig, ConfigurableDocPageData, ConfigurableDocPageReference, ConfigurableMarkdownConfig, ConfigurableOpenApiConfig, DocPageData, DocPageReference, MacroFunction, MacroSourceMetadata, MarkdownConfigurableHooks, ReferenceGuidePageData, Skip, SourceChangelog, TransformChangelogPage, TransformDocPage, TransformDocs, TransformReference, TransformReferenceGuide, Translations, UserTranslations };
package/dist/index.js CHANGED
@@ -1,22 +1,20 @@
1
+ #!/usr/bin/env node
1
2
  'use strict';
2
3
 
3
- var logger = require('./logger-BbAtfln6.js');
4
+ var logger = require('./logger-DaV___bL.js');
4
5
  var E = require('fp-ts/Either');
5
6
  require('fp-ts/function');
6
7
  require('fp-ts/TaskEither');
7
8
  require('js-yaml');
8
9
  require('path');
10
+ require('fp-ts/Task');
11
+ require('fp-ts/lib/Array');
12
+ require('@cparra/apex-reflection');
9
13
  require('fp-ts/Option');
14
+ require('fast-xml-parser');
10
15
  require('handlebars');
11
16
  require('fp-ts/boolean');
12
- require('fast-xml-parser');
13
- require('fp-ts/Task');
14
17
  require('fp-ts/Array');
15
- require('worker_threads');
16
- require('os');
17
- require('fp-ts/lib/Array');
18
- require('@cparra/apex-reflection');
19
- require('uuid');
20
18
  require('fs');
21
19
  require('fp-ts/lib/TaskEither');
22
20
  require('minimatch');