@cparra/apexdocs 3.13.0 โ†’ 3.14.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 CHANGED
@@ -12,6 +12,26 @@ ApexDocs is a non-opinionated documentation generator for Salesforce Apex classe
12
12
  It can output documentation in Markdown format, which allows you to use the Static Site Generator of your choice to
13
13
  create a documentation site that fits your needs, hosted in any static web hosting service.
14
14
 
15
+ ## Table of Contents
16
+
17
+ - [๐Ÿ‘€ Examples](#-examples)
18
+ - [๐Ÿš€ Features](#-features)
19
+ - [๐Ÿ’ฟ Installation](#-installation)
20
+ - [โšก Quick Start](#-quick-start)
21
+ - [CLI](#cli)
22
+ - [Markdown](#markdown)
23
+ - [OpenApi](#openapi)
24
+ - [Changelog](#changelog)
25
+ - [โ–ถ๏ธ Available Commands](#๏ธ-available-commands)
26
+ - [Markdown](#markdown-1)
27
+ - [OpenApi](#openapi-1)
28
+ - [Changelog](#changelog-1)
29
+ - [๐Ÿ”ฌ Defining a configuration file](#-defining-a-configuration-file)
30
+ - [๐ŸŒ Translation](#-translation)
31
+ - [โคต๏ธŽ Importing to your project](#๏ธŽ-importing-to-your-project)
32
+ - [๐Ÿ“– Documentation Guide](#-documentation-guide)
33
+ - [๐Ÿ“„ Generating OpenApi REST Definitions](#-generating-openapi-rest-definitions)
34
+
15
35
  ## ๐Ÿ‘€ Examples
16
36
 
17
37
  ApexDocs generates Markdown files, which can be integrated into any Static Site Generation (SSG) engine,
@@ -64,6 +84,7 @@ Here are some live projects using ApexDocs:
64
84
  * Support for ignoring files and members from being documented
65
85
  * Namespace support
66
86
  * Configuration file support
87
+ * Translation support for different languages and custom terminology
67
88
  * Single line ApexDoc Blocks
68
89
  * Custom tag support
69
90
  * And much, much more!
@@ -89,7 +110,7 @@ apexdocs markdown -s force-app
89
110
  apexdocs markdown --useSfdxProjectJson
90
111
 
91
112
  # Specify multiple source directories
92
- apexdocs markdown --sourceDirs force-app force-lwc force-utils
113
+ apexdocs markdown --sourceDir force-app force-lwc force-utils
93
114
  ```
94
115
 
95
116
  #### OpenApi
@@ -119,9 +140,8 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
119
140
 
120
141
  | Flag | Alias | Description | Default | Required |
121
142
  |-----------------------------------|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|----------|
122
- | `--sourceDir` | `-s` | The directory where the source files are located. | N/A | * |
123
- | `--sourceDirs` | N/A | Multiple source directories (space-separated). Cannot be used with `--sourceDir` or `--useSfdxProjectJson`. | N/A | * |
124
- | `--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` | * |
125
145
  | `--sfdxProjectPath` | N/A | Path to directory containing `sfdx-project.json` (defaults to current directory). Only used with `--useSfdxProjectJson`. | `process.cwd()` | No |
126
146
  | `--targetDir` | `-t` | The directory where the generated files will be placed. | `docs` | No |
127
147
  | `--scope` | `-p` | A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. | `[global]` | No |
@@ -137,8 +157,7 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
137
157
  | `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
138
158
 
139
159
  > **Note:** The `*` in the Required column indicates that **one** of the source directory options must be specified:
140
- > - `--sourceDir` (single directory)
141
- > - `--sourceDirs` (multiple directories)
160
+ > - `--sourceDir` (single directory or array of directories)
142
161
  > - `--useSfdxProjectJson` (read from sfdx-project.json)
143
162
  >
144
163
  > These options are mutually exclusive - you cannot use more than one at the same time.
@@ -274,6 +293,12 @@ export default defineMarkdownConfig({
274
293
  sourceDir: 'force-app',
275
294
  targetDir: 'docs',
276
295
  scope: ['global', 'public'],
296
+ translations: {
297
+ sections: {
298
+ methods: 'Methods',
299
+ properties: 'Properties',
300
+ },
301
+ },
277
302
  ...
278
303
  });
279
304
  ```
@@ -369,61 +394,6 @@ There are hooks for both Markdown and Changelog operations (but not for OpenApi)
369
394
 
370
395
  #### Markdown Hooks
371
396
 
372
- ##### **macros**
373
-
374
- Allows defining custom macros that can be used in the documentation.
375
-
376
- Macros are reusable pieces of text that can be injected into the documentation,
377
- allowing you to define common pieces of text that you can use across multiple files.
378
-
379
- A common use case is injecting copyright or license information, without
380
- having to copy-paste the same text across multiple classes, polluting your
381
- source code.
382
-
383
- A macro can be defined in your documentation using the `{{macro_name}}` syntax.
384
- In the configuration file, you can then define the macro behavior as a key-value pair, where the key is the name of the
385
- macro, and the value is a function that returns the text to inject in place of the macro.
386
-
387
- **Type**
388
-
389
- ```typescript
390
- type MacroSourceMetadata = {
391
- type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
392
- name: string;
393
- filePath: string;
394
- };
395
-
396
- type MacroFunction = (metadata: MacroSourceMetadata) => string;
397
- ```
398
-
399
- Notice that the `metadata` object contains information about the source of the file for which the macro is being
400
- injected. This allows you to optionally
401
- return different text based on the source of the file.
402
-
403
- Example: Injecting a copyright notice
404
-
405
- ```typescript
406
- //...
407
- macros: {
408
- copyright: () => {
409
- return `@copyright Copyright (c) ${new Date().getFullYear()} My Name`;
410
- }
411
- }
412
- //...
413
- ```
414
-
415
- And then in your source code, you can use the macro like this:
416
-
417
- ```apex
418
- /**
419
- * {{copyright}}
420
- * @description This is a class
421
- */
422
- public class MyClass {
423
- //...
424
- }
425
- ```
426
-
427
397
  ##### **transformReferenceGuide**
428
398
 
429
399
  Allows changing the frontmatter and content of the reference guide, or if creating a reference guide page altogether
@@ -536,6 +506,61 @@ export default {
536
506
  };
537
507
  ```
538
508
 
509
+ ##### **macros**
510
+
511
+ Allows defining custom macros that can be used in the documentation.
512
+
513
+ Macros are reusable pieces of text that can be injected into the documentation,
514
+ allowing you to define common pieces of text that you can use across multiple files.
515
+
516
+ A common use case is injecting copyright or license information, without
517
+ having to copy-paste the same text across multiple classes, polluting your
518
+ source code.
519
+
520
+ A macro can be defined in your documentation using the `{{macro_name}}` syntax.
521
+ In the configuration file, you can then define the macro behavior as a key-value pair, where the key is the name of the
522
+ macro, and the value is a function that returns the text to inject in place of the macro.
523
+
524
+ **Type**
525
+
526
+ ```typescript
527
+ type MacroSourceMetadata = {
528
+ type: 'apex' | 'customobject' | 'customfield' | 'custommetadata' | 'trigger';
529
+ name: string;
530
+ filePath: string;
531
+ };
532
+
533
+ type MacroFunction = (metadata: MacroSourceMetadata) => string;
534
+ ```
535
+
536
+ Notice that the `metadata` object contains information about the source of the file for which the macro is being
537
+ injected. This allows you to optionally
538
+ return different text based on the source of the file.
539
+
540
+ Example: Injecting a copyright notice
541
+
542
+ ```typescript
543
+ //...
544
+ macros: {
545
+ copyright: () => {
546
+ return `@copyright Copyright (c) ${new Date().getFullYear()} My Name`;
547
+ }
548
+ }
549
+ //...
550
+ ```
551
+
552
+ And then in your source code, you can use the macro like this:
553
+
554
+ ```apex
555
+ /**
556
+ * {{copyright}}
557
+ * @description This is a class
558
+ */
559
+ public class MyClass {
560
+ //...
561
+ }
562
+ ```
563
+
539
564
  #### Changelog Hooks
540
565
 
541
566
  ##### **transformChangeLogPage**
@@ -595,6 +620,74 @@ export default {
595
620
  };
596
621
  ```
597
622
 
623
+ ## ๐ŸŒ Translation
624
+
625
+ ApexDocs supports translations to customize the language and terminology used in the generated documentation.
626
+ This feature allows you to:
627
+
628
+ - **Translate documentation to different languages** (Spanish, French, etc.)
629
+ - **Use custom business terminology** (e.g., "Business Operations" instead of "Methods")
630
+ - **Partially override specific terms** while keeping the rest in English
631
+
632
+ ### How It Works
633
+
634
+ The translation system uses:
635
+
636
+ - **Default English translations** built into the system
637
+ - **User-provided overrides** that can be partial or complete
638
+
639
+ ### Configuration
640
+
641
+ Add a `translations` property to your ApexDocs configuration (JS or TS file) and pass
642
+ the appropriate translation object, depending on the generator you're using:
643
+
644
+ ```javascript
645
+ import { defineMarkdownConfig } from '@cparra/apexdocs';
646
+
647
+ export default defineMarkdownConfig({
648
+ sourceDir: 'src',
649
+ targetDir: 'docs',
650
+ scope: ['public', 'global'],
651
+ translations: {
652
+ sections: {
653
+ methods: 'Mรฉtodos',
654
+ properties: 'Propiedades',
655
+ fields: 'Campos',
656
+ },
657
+ },
658
+ });
659
+ ```
660
+
661
+ ### TypeScript Support
662
+
663
+ For TypeScript projects, import the translation types for better autocomplete and type safety:
664
+
665
+ ```typescript
666
+ import { defineMarkdownConfig } from '@cparra/apexdocs';
667
+ import type { UserTranslations } from '@cparra/apexdocs';
668
+
669
+ const markdownTranslations: UserTranslations['markdown'] = {
670
+ sections: {
671
+ methods: 'Functions',
672
+ },
673
+ // ...other translation keys as needed
674
+ };
675
+
676
+ export default defineMarkdownConfig({
677
+ sourceDir: 'src',
678
+ targetDir: 'docs',
679
+ scope: ['public', 'global'],
680
+ translations: markdownTranslations,
681
+ });
682
+ ```
683
+
684
+ ### Notes
685
+
686
+ - Only the **markdown** and **changelog** generators support translations
687
+ - All translations are optional - anything not specified uses the English default
688
+
689
+ For a complete example, see the [translation example](examples/translation/) in this repository.
690
+
598
691
  ## โคต๏ธŽ Importing to your project
599
692
 
600
693
  ### Reflection
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var logger$1 = require('../logger-BiPQ_i9-.js');
4
+ var logger$1 = require('../logger-D4Q3KA6D.js');
5
5
  var require$$0 = require('yargs');
6
6
  var cosmiconfig = require('cosmiconfig');
7
7
  var E = require('fp-ts/Either');
package/dist/index.d.ts CHANGED
@@ -1,3 +1,140 @@
1
+ /**
2
+ * Default English translations for ApexDocs.
3
+ * These can be overridden by users in their configuration.
4
+ */
5
+ type Translations = {
6
+ changelog: {
7
+ title: string;
8
+ newClasses: {
9
+ heading: string;
10
+ description: string;
11
+ };
12
+ newInterfaces: {
13
+ heading: string;
14
+ description: string;
15
+ };
16
+ newEnums: {
17
+ heading: string;
18
+ description: string;
19
+ };
20
+ newCustomObjects: {
21
+ heading: string;
22
+ description: string;
23
+ };
24
+ newTriggers: {
25
+ heading: string;
26
+ description: string;
27
+ };
28
+ removedTypes: {
29
+ heading: string;
30
+ description: string;
31
+ };
32
+ removedCustomObjects: {
33
+ heading: string;
34
+ description: string;
35
+ };
36
+ removedTriggers: {
37
+ heading: string;
38
+ description: string;
39
+ };
40
+ newOrModifiedMembers: {
41
+ heading: string;
42
+ description: string;
43
+ };
44
+ newOrRemovedCustomFields: {
45
+ heading: string;
46
+ description: string;
47
+ };
48
+ newOrRemovedCustomMetadataTypeRecords: {
49
+ heading: string;
50
+ description: string;
51
+ };
52
+ memberModifications: {
53
+ newEnumValue: string;
54
+ removedEnumValue: string;
55
+ newMethod: string;
56
+ removedMethod: string;
57
+ newProperty: string;
58
+ removedProperty: string;
59
+ newField: string;
60
+ removedField: string;
61
+ newType: string;
62
+ removedType: string;
63
+ newCustomMetadataRecord: string;
64
+ removedCustomMetadataRecord: string;
65
+ newTrigger: string;
66
+ removedTrigger: string;
67
+ };
68
+ };
69
+ markdown: {
70
+ sections: {
71
+ methods: string;
72
+ properties: string;
73
+ fields: string;
74
+ constructors: string;
75
+ values: string;
76
+ classes: string;
77
+ enums: string;
78
+ interfaces: string;
79
+ namespace: string;
80
+ records: string;
81
+ publishBehavior: string;
82
+ };
83
+ details: {
84
+ type: string;
85
+ signature: string;
86
+ group: string;
87
+ author: string;
88
+ date: string;
89
+ see: string;
90
+ possibleValues: string;
91
+ parameters: string;
92
+ throws: string;
93
+ returnType: string;
94
+ apiName: string;
95
+ required: string;
96
+ inlineHelpText: string;
97
+ complianceGroup: string;
98
+ securityClassification: string;
99
+ protected: string;
100
+ };
101
+ typeSuffixes: {
102
+ class: string;
103
+ interface: string;
104
+ enum: string;
105
+ trigger: string;
106
+ };
107
+ triggerEvents: {
108
+ beforeInsert: string;
109
+ beforeUpdate: string;
110
+ beforeDelete: string;
111
+ afterInsert: string;
112
+ afterUpdate: string;
113
+ afterDelete: string;
114
+ afterUndelete: string;
115
+ };
116
+ publishBehaviors: {
117
+ publishImmediately: string;
118
+ publishAfterCommit: string;
119
+ };
120
+ inheritance: {
121
+ inheritance: string;
122
+ implements: string;
123
+ };
124
+ };
125
+ };
126
+
127
+ /**
128
+ * User-provided partial translations that can override the defaults.
129
+ */
130
+ type UserTranslations = DeepPartial<Translations>;
131
+ /**
132
+ * Utility type to make all properties in T optional recursively.
133
+ */
134
+ type DeepPartial<T> = {
135
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
136
+ };
137
+
1
138
  type Generators = 'markdown' | 'openapi' | 'changelog';
2
139
 
3
140
  type LinkingStrategy =
@@ -42,6 +179,7 @@ type UserDefinedMarkdownConfig = {
42
179
  targetGenerator: 'markdown';
43
180
  excludeTags: string[];
44
181
  exclude: string[];
182
+ translations?: UserTranslations['markdown'];
45
183
  } & CliConfigurableMarkdownConfig &
46
184
  Partial<MarkdownConfigurableHooks>;
47
185
 
@@ -68,6 +206,7 @@ type UserDefinedChangelogConfig = {
68
206
  customObjectVisibility: string[];
69
207
  exclude: string[];
70
208
  skipIfNoChanges: boolean;
209
+ translations?: UserTranslations['changelog'];
71
210
  } & Partial<ChangelogConfigurableHooks>;
72
211
 
73
212
  type UserDefinedConfig = UserDefinedMarkdownConfig | UserDefinedOpenApiConfig | UserDefinedChangelogConfig;
@@ -247,4 +386,4 @@ type ConfigurableChangelogConfig = Omit<Partial<UserDefinedChangelogConfig>, 'ta
247
386
  */
248
387
  declare function defineChangelogConfig(config: ConfigurableChangelogConfig): Partial<UserDefinedChangelogConfig>;
249
388
 
250
- 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 };
389
+ 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 };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var logger = require('./logger-BiPQ_i9-.js');
3
+ var logger = require('./logger-D4Q3KA6D.js');
4
4
  var E = require('fp-ts/Either');
5
5
  require('fp-ts/function');
6
6
  require('fp-ts/TaskEither');