@cparra/apexdocs 1.13.4 → 2.0.0-alpha.14
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/.eslintrc.js +12 -0
- package/.prettierrc.js +7 -0
- package/README.md +344 -277
- package/ROADMAP.md +18 -0
- package/docs/Gemfile.lock +1 -1
- package/docs/Sample-Classes/SampleClass.md +138 -30
- package/docs/Sample-Interfaces/SampleInterface.md +21 -4
- package/docs/index.md +1 -9
- package/examples/apex/SampleClass.cls +31 -6
- package/examples/apex/SampleInterface.cls +3 -2
- package/lib/application/Apexdocs.d.ts +11 -0
- package/lib/application/Apexdocs.js +41 -0
- package/lib/application/Apexdocs.js.map +1 -0
- package/lib/cli/generate.js +17 -21
- package/lib/cli/generate.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -0
- package/lib/model/file.d.ts +10 -0
- package/lib/model/file.js +23 -0
- package/lib/model/file.js.map +1 -0
- package/lib/model/manifest.d.ts +22 -0
- package/lib/model/manifest.js +41 -0
- package/lib/model/manifest.js.map +1 -0
- package/lib/model/markdown-file.d.ts +10 -0
- package/lib/model/markdown-file.js +52 -0
- package/lib/model/markdown-file.js.map +1 -0
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +3 -0
- package/lib/model/markdown-generation-util/field-declaration-util.js +33 -0
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -0
- package/lib/model/markdown-generation-util/index.d.ts +3 -0
- package/lib/model/markdown-generation-util/index.js +9 -0
- package/lib/model/markdown-generation-util/index.js.map +1 -0
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +3 -0
- package/lib/model/markdown-generation-util/method-declaration-util.js +97 -0
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -0
- package/lib/model/markdown-generation-util/type-declaration-util.d.ts +3 -0
- package/lib/model/markdown-generation-util/type-declaration-util.js +25 -0
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -0
- package/lib/model/markdown-home-file.d.ts +11 -0
- package/lib/model/markdown-home-file.js +50 -0
- package/lib/model/markdown-home-file.js.map +1 -0
- package/lib/model/markdown-type-file.d.ts +17 -0
- package/lib/model/markdown-type-file.js +62 -0
- package/lib/model/markdown-type-file.js.map +1 -0
- package/lib/service/apex-file-reader.d.ts +13 -0
- package/lib/service/apex-file-reader.js +39 -0
- package/lib/service/apex-file-reader.js.map +1 -0
- package/lib/service/file-system.d.ts +12 -0
- package/lib/service/file-system.js +21 -0
- package/lib/service/file-system.js.map +1 -0
- package/lib/service/file-writer.d.ts +4 -0
- package/lib/service/file-writer.js +25 -0
- package/lib/service/file-writer.js.map +1 -0
- package/lib/service/manifest-factory.d.ts +9 -0
- package/lib/service/manifest-factory.js +13 -0
- package/lib/service/manifest-factory.js.map +1 -0
- package/lib/service/parser.d.ts +9 -0
- package/lib/service/parser.js +17 -0
- package/lib/service/parser.js.map +1 -0
- package/lib/service/walkers/class-walker.d.ts +4 -0
- package/lib/service/walkers/class-walker.js +32 -0
- package/lib/service/walkers/class-walker.js.map +1 -0
- package/lib/service/walkers/enum-walker.d.ts +4 -0
- package/lib/service/walkers/enum-walker.js +10 -0
- package/lib/service/walkers/enum-walker.js.map +1 -0
- package/lib/service/walkers/interface-walker.d.ts +4 -0
- package/lib/service/walkers/interface-walker.js +14 -0
- package/lib/service/walkers/interface-walker.js.map +1 -0
- package/lib/service/walkers/walker-factory.d.ts +5 -0
- package/lib/service/walkers/walker-factory.js +19 -0
- package/lib/service/walkers/walker-factory.js.map +1 -0
- package/lib/service/walkers/walker.d.ts +16 -0
- package/lib/service/walkers/walker.js +9 -0
- package/lib/service/walkers/walker.js.map +1 -0
- package/lib/settings.d.ts +21 -0
- package/lib/settings.js +42 -0
- package/lib/settings.js.map +1 -0
- package/lib/transpiler/file-container.d.ts +6 -0
- package/lib/transpiler/file-container.js +15 -0
- package/lib/transpiler/file-container.js.map +1 -0
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +6 -0
- package/lib/transpiler/markdown/class-file-generatorHelper.js +17 -0
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -0
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +4 -0
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +10 -0
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +1 -0
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +8 -0
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +24 -0
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -0
- package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +11 -0
- package/lib/transpiler/markdown/markdown-transpiler-base.js +23 -0
- package/lib/transpiler/markdown/markdown-transpiler-base.js.map +1 -0
- package/lib/transpiler/processor-type-transpiler.d.ts +8 -0
- package/lib/transpiler/processor-type-transpiler.js +6 -0
- package/lib/transpiler/processor-type-transpiler.js.map +1 -0
- package/lib/transpiler/transpiler.d.ts +5 -0
- package/lib/transpiler/transpiler.js +21 -0
- package/lib/transpiler/transpiler.js.map +1 -0
- package/lib/util/logger.d.ts +18 -0
- package/lib/util/logger.js +32 -0
- package/lib/util/logger.js.map +1 -0
- package/package.json +22 -11
- package/src/application/Apexdocs.ts +41 -0
- package/src/cli/generate.ts +52 -64
- package/src/index.ts +1 -1
- package/src/model/__tests__/manifest.spec.ts +15 -0
- package/src/model/file.ts +23 -0
- package/src/model/manifest.ts +60 -0
- package/src/model/markdown-file.ts +56 -0
- package/src/model/markdown-generation-util/field-declaration-util.ts +42 -0
- package/src/model/markdown-generation-util/index.ts +3 -0
- package/src/model/markdown-generation-util/method-declaration-util.ts +128 -0
- package/src/model/markdown-generation-util/type-declaration-util.ts +29 -0
- package/src/model/markdown-home-file.ts +48 -0
- package/src/model/markdown-type-file.ts +75 -0
- package/src/service/__tests__/apex-file-reader.spec.ts +79 -0
- package/src/service/__tests__/manifest-factory.spec.ts +16 -0
- package/src/service/apex-file-reader.ts +45 -0
- package/src/service/file-system.ts +28 -0
- package/src/service/file-writer.ts +25 -0
- package/src/service/manifest-factory.ts +12 -0
- package/src/service/parser.ts +18 -0
- package/src/service/walkers/class-walker.ts +31 -0
- package/src/service/walkers/enum-walker.ts +8 -0
- package/src/service/walkers/interface-walker.ts +12 -0
- package/src/service/walkers/walker-factory.ts +18 -0
- package/src/service/walkers/walker.ts +35 -0
- package/src/settings.ts +57 -0
- package/src/transpiler/file-container.ts +13 -0
- package/src/transpiler/markdown/class-file-generatorHelper.ts +16 -0
- package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +7 -0
- package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +22 -0
- package/src/transpiler/markdown/markdown-transpiler-base.ts +28 -0
- package/src/transpiler/processor-type-transpiler.ts +12 -0
- package/src/transpiler/transpiler.ts +18 -0
- package/src/util/logger.ts +31 -0
- package/tsconfig.json +9 -3
- package/.prettierrc +0 -5
- package/examples/config/config.json +0 -5
- package/lib/AsJsDocsProcessor.d.ts +0 -9
- package/lib/AsJsDocsProcessor.js +0 -61
- package/lib/ClassFileGeneratorHelper.d.ts +0 -5
- package/lib/ClassFileGeneratorHelper.js +0 -25
- package/lib/ClassFileGeneratorHelper.test.d.ts +0 -1
- package/lib/ClassFileGeneratorHelper.test.js +0 -32
- package/lib/Configuration.d.ts +0 -34
- package/lib/Configuration.js +0 -37
- package/lib/DocsProcessor.d.ts +0 -6
- package/lib/DocsProcessor.js +0 -9
- package/lib/DocsifyDocsProcessor.d.ts +0 -4
- package/lib/DocsifyDocsProcessor.js +0 -9
- package/lib/DocsifyDocsProcessor.test.d.ts +0 -1
- package/lib/DocsifyDocsProcessor.test.js +0 -7
- package/lib/FileManager.d.ts +0 -6
- package/lib/FileManager.js +0 -28
- package/lib/JekyllDocsProcessor.d.ts +0 -8
- package/lib/JekyllDocsProcessor.js +0 -20
- package/lib/JekyllDocsProcessor.test.d.ts +0 -1
- package/lib/JekyllDocsProcessor.test.js +0 -21
- package/lib/JsHelper.d.ts +0 -12
- package/lib/JsHelper.js +0 -72
- package/lib/MarkdownDocsProcessor.d.ts +0 -22
- package/lib/MarkdownDocsProcessor.js +0 -358
- package/lib/MarkdownHelper.d.ts +0 -13
- package/lib/MarkdownHelper.js +0 -78
- package/lib/Settings.d.ts +0 -22
- package/lib/Settings.js +0 -51
- package/lib/Settings.test.d.ts +0 -1
- package/lib/Settings.test.js +0 -38
- package/lib/command/Generate.d.ts +0 -2
- package/lib/command/Generate.js +0 -54
- package/lib/command/__test__/Generte.test.d.ts +0 -1
- package/lib/command/__test__/Generte.test.js +0 -30
- package/lib/model/ApexModel.d.ts +0 -30
- package/lib/model/ApexModel.js +0 -85
- package/lib/model/ClassModel.d.ts +0 -39
- package/lib/model/ClassModel.js +0 -125
- package/lib/model/EnumModel.d.ts +0 -6
- package/lib/model/EnumModel.js +0 -28
- package/lib/model/MethodModel.d.ts +0 -18
- package/lib/model/MethodModel.js +0 -74
- package/lib/model/PropertyModel.d.ts +0 -6
- package/lib/model/PropertyModel.js +0 -40
- package/lib/model/__test__/ClassModel.test.d.ts +0 -1
- package/lib/model/__test__/ClassModel.test.js +0 -79
- package/lib/model/__test__/MethodModel.test.d.ts +0 -1
- package/lib/model/__test__/MethodModel.test.js +0 -55
- package/lib/model/__test__/PropertyModel.test.d.ts +0 -1
- package/lib/model/__test__/PropertyModel.test.js +0 -25
- package/lib/parser/ClassParser.d.ts +0 -5
- package/lib/parser/ClassParser.js +0 -79
- package/lib/parser/EnumParser.d.ts +0 -5
- package/lib/parser/EnumParser.js +0 -45
- package/lib/parser/FileParser.d.ts +0 -8
- package/lib/parser/FileParser.js +0 -210
- package/lib/parser/MethodParser.d.ts +0 -5
- package/lib/parser/MethodParser.js +0 -109
- package/lib/parser/PropertyParser.d.ts +0 -5
- package/lib/parser/PropertyParser.js +0 -46
- package/lib/parser/__test__/ClassParser.test.d.ts +0 -1
- package/lib/parser/__test__/ClassParser.test.js +0 -52
- package/lib/parser/__test__/FileParser.test.d.ts +0 -1
- package/lib/parser/__test__/FileParser.test.js +0 -12
- package/lib/parser/__test__/MethodParser.test.d.ts +0 -1
- package/lib/parser/__test__/MethodParser.test.js +0 -69
- package/lib/parser/__test__/PropertyParser.test.d.ts +0 -1
- package/lib/parser/__test__/PropertyParser.test.js +0 -14
- package/lib/parser/__test__/testFileContents.d.ts +0 -1
- package/lib/parser/__test__/testFileContents.js +0 -82
- package/lib/utils.d.ts +0 -12
- package/lib/utils.js +0 -49
- package/lib/utils.test.d.ts +0 -1
- package/lib/utils.test.js +0 -35
- package/src/AsJsDocsProcessor.ts +0 -67
- package/src/ClassFileGeneratorHelper.test.ts +0 -44
- package/src/ClassFileGeneratorHelper.ts +0 -26
- package/src/Configuration.ts +0 -69
- package/src/DocsProcessor.ts +0 -9
- package/src/DocsifyDocsProcessor.test.ts +0 -6
- package/src/DocsifyDocsProcessor.ts +0 -7
- package/src/FileManager.ts +0 -32
- package/src/JekyllDocsProcessor.test.ts +0 -28
- package/src/JekyllDocsProcessor.ts +0 -22
- package/src/JsHelper.ts +0 -78
- package/src/MarkdownDocsProcessor.ts +0 -420
- package/src/MarkdownHelper.ts +0 -91
- package/src/Settings.test.ts +0 -54
- package/src/Settings.ts +0 -65
- package/src/command/Generate.ts +0 -69
- package/src/command/__test__/Generte.test.ts +0 -39
- package/src/model/ApexModel.ts +0 -102
- package/src/model/ClassModel.ts +0 -140
- package/src/model/EnumModel.ts +0 -27
- package/src/model/MethodModel.ts +0 -80
- package/src/model/PropertyModel.ts +0 -37
- package/src/model/__test__/ClassModel.test.ts +0 -100
- package/src/model/__test__/MethodModel.test.ts +0 -70
- package/src/model/__test__/PropertyModel.test.ts +0 -34
- package/src/parser/ClassParser.ts +0 -83
- package/src/parser/EnumParser.ts +0 -47
- package/src/parser/FileParser.ts +0 -250
- package/src/parser/MethodParser.ts +0 -119
- package/src/parser/PropertyParser.ts +0 -46
- package/src/parser/__test__/ClassParser.test.ts +0 -70
- package/src/parser/__test__/FileParser.test.ts +0 -14
- package/src/parser/__test__/MethodParser.test.ts +0 -90
- package/src/parser/__test__/PropertyParser.test.ts +0 -18
- package/src/parser/__test__/testFileContents.ts +0 -81
- package/src/utils.test.ts +0 -40
- package/src/utils.ts +0 -52
package/.eslintrc.js
ADDED
package/.prettierrc.js
ADDED
package/README.md
CHANGED
|
@@ -1,277 +1,344 @@
|
|
|
1
|
-
# ApexDocs
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<b>ApexDocs is a Node.js library with CLI capabilities to
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
[](https://github.com/cesarParra/apexdocs/blob/master/LICENSE)
|
|
8
|
-
|
|
9
|
-
## Description
|
|
10
|
-
|
|
11
|
-
ApexDocs was built as an alternative to
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
The
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
`
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
* @
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
1
|
+
# ApexDocs
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<b>ApexDocs is a Node.js library with CLI capabilities to docGenerator documentation for Salesforce Apex classes.</b>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[](https://github.com/cesarParra/apexdocs/blob/master/LICENSE)
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
ApexDocs was originally built as an alternative to
|
|
12
|
+
the [Java based ApexDoc tool](https://github.com/SalesforceFoundation/ApexDoc) originally created by Aslam Bari and
|
|
13
|
+
later maintained by Salesforce.org, as that tool is no longer being maintained.
|
|
14
|
+
|
|
15
|
+
ApexDocs is a Node.js library built on Typescript and hosted on [npm](https://www.npmjs.com/package/@cparra/apexdocs).
|
|
16
|
+
It offers CLI capabilities to automatically docGenerator a set of files that fully document each one of you classes.
|
|
17
|
+
Additionally, it can be imported and consumed directly by your JavaScript code.
|
|
18
|
+
|
|
19
|
+
There are some key differences between ApexDocs and the Java based ApexDoc tool:
|
|
20
|
+
|
|
21
|
+
- **Recursive file search through your module directory structure**. In an `sfdx` based project, all of your classes
|
|
22
|
+
will be documented by specifying the top-most directory where file search should begin.
|
|
23
|
+
- **Unopinionated documentation site generation**. Instead of creating HTML files, ApexDocs generates a Markdown (.md)
|
|
24
|
+
file per Apex class being documented. This means you can host your files in static web hosting services that parse
|
|
25
|
+
Markdown like Github Pages or Netlify, and use site generators like Jekyll or Gatsby. This gives you the freedom to
|
|
26
|
+
decide how to style your site to match your needs.
|
|
27
|
+
|
|
28
|
+
## Version 2.X
|
|
29
|
+
|
|
30
|
+
Version shares almost* all the same functionality (and more) of 1.X , but is a rewrite from the ground up of the tool,
|
|
31
|
+
so please be aware if migrating from a 1.X version.
|
|
32
|
+
|
|
33
|
+
The Apex code parsing logic for the 1.X codebase was almost a one-to-one translation of the Java based ApexDoc tool to
|
|
34
|
+
Javascript. With 2.X the parsing logic has been improved and extracted out of this codebase, and into its own standalone
|
|
35
|
+
NPM module which is solely focused on Apex code reflection: https://www.npmjs.com/package/@cparra/apex-reflection
|
|
36
|
+
|
|
37
|
+
This allows for an improved code quality of both code bases and an increased ease of introducing future improvements and
|
|
38
|
+
fixing issues.
|
|
39
|
+
|
|
40
|
+
But please be aware: migration to 2.X is not recommended at this time for production until a GA release.
|
|
41
|
+
|
|
42
|
+
### Differences between the versions
|
|
43
|
+
|
|
44
|
+
When migrating from 1.X please be aware of these changes between the major versions:
|
|
45
|
+
|
|
46
|
+
#### Deprecated features
|
|
47
|
+
|
|
48
|
+
* The `--group` CLI parameter has been deprecated. All files are grouped by default.
|
|
49
|
+
|
|
50
|
+
#### Features not yet migrated to 2.X
|
|
51
|
+
|
|
52
|
+
* The `--configPath` CLI parameter has been temporarily deprecated. We are planning on reintroducing it but the config
|
|
53
|
+
file will use a different format.
|
|
54
|
+
* Internal linking between files using the `@see` annotation and {@link FileName} and <<FileName>> syntax has not been
|
|
55
|
+
implemented.
|
|
56
|
+
|
|
57
|
+
#### New features
|
|
58
|
+
|
|
59
|
+
* All Apex annotations are now supported through the `--scope` CLI parameter, not just `namespaceaccessible`. This means
|
|
60
|
+
that scopes like `auraenabled`, `invocablemethod`, `invocablevariable`, `remoteaction`, and all other valid Apex
|
|
61
|
+
annotations are supported.
|
|
62
|
+
* Just like Javadoc, both `@throws` and `@exception` are supported when referencing an exception thrown by a method or
|
|
63
|
+
constructor.
|
|
64
|
+
* Any custom annotation defined in the Apexdoc is at the class level are supported, for example the following will be
|
|
65
|
+
output to the resulting markdown file:
|
|
66
|
+
|
|
67
|
+
```apex
|
|
68
|
+
/**
|
|
69
|
+
* @MyCustomAnnotation This is a custom annotation
|
|
70
|
+
*/
|
|
71
|
+
public class MyClass {
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Demo
|
|
76
|
+
|
|
77
|
+
ApexDocs currently supports generating markdown files for Jekyll and Docsify sites.
|
|
78
|
+
|
|
79
|
+
### In the wild
|
|
80
|
+
|
|
81
|
+
- [Nimble AMS Docs](https://nimbleuser.github.io/nams-api-docs/#/api-reference/)
|
|
82
|
+
- [Yet Another Salesforce Logger](https://cesarparra.github.io/yet-another-salesforce-logger/#/)
|
|
83
|
+
|
|
84
|
+
### [Docsify](https://docsify.js.org/)
|
|
85
|
+
|
|
86
|
+
Demo
|
|
87
|
+
|
|
88
|
+
- [Docsify](https://cesarparra.github.io/apexdocs-docsify-example/)
|
|
89
|
+
|
|
90
|
+
### [Jekyll](https://jekyllrb.com/)
|
|
91
|
+
|
|
92
|
+
Demo
|
|
93
|
+
|
|
94
|
+
- [Jekyll](https://cesarparra.github.io/apexdocs/)
|
|
95
|
+
|
|
96
|
+
## Installation
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm i -g @cparra/apexdocs
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
### CLI
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
apexdocs-generate
|
|
108
|
+
-s src
|
|
109
|
+
-t docs
|
|
110
|
+
-p global
|
|
111
|
+
-g docsify
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The CLI supports the following parameters:
|
|
115
|
+
|
|
116
|
+
| Parameter | Alias | Description | Default | Required |
|
|
117
|
+
| ----------------- | ----- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------- | -------- |
|
|
118
|
+
| --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
|
|
119
|
+
| --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
|
|
120
|
+
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
|
|
121
|
+
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private | `global namespaceaccessible public` | No |
|
|
122
|
+
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports jekyll and docsify. | `jekyll` | No |
|
|
123
|
+
| --configPath | -c | The path to the JSON configuration file that defines the structure of the documents to docGenerator. | N/A | No |
|
|
124
|
+
| --group | -o | Define whether the generated files should be grouped by the @group tag on the top level classes. | `true` | No |
|
|
125
|
+
|
|
126
|
+
#### Configuration File
|
|
127
|
+
|
|
128
|
+
You can optionally specify the path to a configuration JSON file through the `--configPath` parameter. This let's you
|
|
129
|
+
have some additional control over the content outputs.
|
|
130
|
+
|
|
131
|
+
The configuration file allows you to specify the following:
|
|
132
|
+
|
|
133
|
+
_Note_: Everything in the configuration file is optional. When something is not specified, the default will be used.
|
|
134
|
+
|
|
135
|
+
`root` (String)
|
|
136
|
+
|
|
137
|
+
Default: None
|
|
138
|
+
|
|
139
|
+
Allows you to specify the root directory for where the files are being generated. This can be helpful when embedding the
|
|
140
|
+
generated docs into an existing site so that the links are generated correctly.
|
|
141
|
+
|
|
142
|
+
`defaultGroupName`
|
|
143
|
+
|
|
144
|
+
Default: Miscellaneous
|
|
145
|
+
|
|
146
|
+
Defines the `@group` name to be used when a file does not specify it.
|
|
147
|
+
|
|
148
|
+
`sourceLanguage`
|
|
149
|
+
|
|
150
|
+
Default: None
|
|
151
|
+
|
|
152
|
+
Defines the name of the language that will be used when generating `@example` blocks. Use this when you are interested
|
|
153
|
+
in using syntax highlighting for your project.
|
|
154
|
+
|
|
155
|
+
Even though the source code material for which documentation is generated is always `Apex`, generally you will be able
|
|
156
|
+
to use a syntax highlighter that recognizes `java` source code, so set this value to `java` in those cases.
|
|
157
|
+
|
|
158
|
+
`home` (Object)
|
|
159
|
+
|
|
160
|
+
Gives you control over the home page.
|
|
161
|
+
|
|
162
|
+
`home.header` (String)
|
|
163
|
+
|
|
164
|
+
Default: None
|
|
165
|
+
|
|
166
|
+
Allows you to embed custom content into your home page by using the `header` property to point to the file which
|
|
167
|
+
contents will be added to the top of the generated home page.
|
|
168
|
+
|
|
169
|
+
Specify the path with the content that you want to embed.
|
|
170
|
+
|
|
171
|
+
`content` (Object)
|
|
172
|
+
|
|
173
|
+
Gives you control over the content pages.
|
|
174
|
+
|
|
175
|
+
`content.includeAuthor` (Boolean)
|
|
176
|
+
|
|
177
|
+
Default: false
|
|
178
|
+
|
|
179
|
+
Whether the `@author` tag should be used to add the file's author to the page.
|
|
180
|
+
|
|
181
|
+
`content.includeDate` (Boolean)
|
|
182
|
+
|
|
183
|
+
Default: false
|
|
184
|
+
|
|
185
|
+
Whether the `@date` tag should be used to add the file's date to the page.
|
|
186
|
+
|
|
187
|
+
`content.startingHeadingLevel` (Number)
|
|
188
|
+
|
|
189
|
+
Default: 1
|
|
190
|
+
|
|
191
|
+
The starting H tag level for the document. Each title will use this as the starting point to docGenerator the
|
|
192
|
+
appropriate `<h#>` tag. For example, if set to 1, the class' file name at the top of the file will use an `<h1>` tag,
|
|
193
|
+
the `Properties` title will be `<h2>`, each property name will be an `<h3>`, etc.
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
{
|
|
197
|
+
"root": "root-directory",
|
|
198
|
+
"defaultGrouName": "api",
|
|
199
|
+
"sourceLanguage": "java",
|
|
200
|
+
"home": {
|
|
201
|
+
"header": "./examples/includes/header.md"
|
|
202
|
+
},
|
|
203
|
+
"content": {
|
|
204
|
+
"startingHeadingLevel": 1,
|
|
205
|
+
"includeAuthor": true,
|
|
206
|
+
"includeDate": true
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Importing to your project
|
|
212
|
+
|
|
213
|
+
If you are just interested in the documentation parsing capabilities, you can import ApexDocs into your own project.
|
|
214
|
+
|
|
215
|
+
Use the `docGenerator` function to create a list of `ClassModel` that includes all the parsed information from your .cls
|
|
216
|
+
files.
|
|
217
|
+
|
|
218
|
+
`docGenerator(sourceDirectory[,recursive][,scope][,outputDir])`
|
|
219
|
+
|
|
220
|
+
- `sourceDirectory` \<string>
|
|
221
|
+
- `recursive` \<boolean>
|
|
222
|
+
- `scope` \<string[]>
|
|
223
|
+
- `outpurDir` \<string>
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
var { docGenerator } = require('@cparra/apexdocs');
|
|
227
|
+
|
|
228
|
+
let documentedClasses = docGenerator('src', true, ['global'], 'docs');
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Documentation Format
|
|
232
|
+
|
|
233
|
+
ApexDocs picks up blocks of comments throughout your `.cls` files. The block must begin with `/**` and span through
|
|
234
|
+
multiple lines, ending with `*/`.
|
|
235
|
+
|
|
236
|
+
### Documenting Classes
|
|
237
|
+
|
|
238
|
+
The following tags are supported on the class level:
|
|
239
|
+
|
|
240
|
+
| Tag | Description |
|
|
241
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
242
|
+
| `@description` | One or more lines describing the class. |
|
|
243
|
+
| `@see` | The name of a related class. |
|
|
244
|
+
| `@group` | The group to which the class belongs to. |
|
|
245
|
+
| `@author` | The author of the class. Note that this only gets added if it is explicitly defined through the configuration class that it should. |
|
|
246
|
+
| `@date` | The date the class was created. Note that this only gets added if it is explicitly defined through the configuration class that it should. |
|
|
247
|
+
|
|
248
|
+
**Example**
|
|
249
|
+
|
|
250
|
+
```apex
|
|
251
|
+
/**
|
|
252
|
+
* @description This is my class description.
|
|
253
|
+
*/
|
|
254
|
+
public with sharing class TestClass {
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Documenting Enums
|
|
259
|
+
|
|
260
|
+
The following tags are supported on the enum level:
|
|
261
|
+
|
|
262
|
+
| Tag | Description |
|
|
263
|
+
| -------------- | -------------------------------------- |
|
|
264
|
+
| `@description` | One or more lines describing the enum. |
|
|
265
|
+
|
|
266
|
+
**Example**
|
|
267
|
+
|
|
268
|
+
```apex
|
|
269
|
+
/**
|
|
270
|
+
* @description This is my enum description.
|
|
271
|
+
*/
|
|
272
|
+
public Enum ExampleEnum {
|
|
273
|
+
VALUE_1, VALUE_2
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Documenting Properties
|
|
278
|
+
|
|
279
|
+
The following tags are supported on the property level:
|
|
280
|
+
|
|
281
|
+
| Tag | Description |
|
|
282
|
+
| -------------- | ------------------------------------------ |
|
|
283
|
+
| `@description` | One or more lines describing the property. |
|
|
284
|
+
|
|
285
|
+
**Example**
|
|
286
|
+
|
|
287
|
+
```apex
|
|
288
|
+
/**
|
|
289
|
+
* @description This is my property description.
|
|
290
|
+
*/
|
|
291
|
+
public String ExampleProperty { get; set; }
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Documenting Methods and Constructors
|
|
295
|
+
|
|
296
|
+
Methods and constructors support the same tags.
|
|
297
|
+
|
|
298
|
+
The following tags are supported on the method level:
|
|
299
|
+
|
|
300
|
+
| Tag | Description |
|
|
301
|
+
| ------------------------- | ------------------------------------------------- |
|
|
302
|
+
| `@description` | One or more lines describing the method. |
|
|
303
|
+
| `@param` _paramName_ | Description of a single parameter. |
|
|
304
|
+
| `@return` | Description of the return value of the method. |
|
|
305
|
+
| `@example` | Example of how the code can be used or called. |
|
|
306
|
+
| `@throws` _ExceptionName_ | Description of an exception thrown by the method. |
|
|
307
|
+
|
|
308
|
+
**Example**
|
|
309
|
+
|
|
310
|
+
```apex
|
|
311
|
+
/**
|
|
312
|
+
* @description This is my method description.
|
|
313
|
+
* @param action The action to execute.
|
|
314
|
+
* @return The result of the operation.
|
|
315
|
+
* @example
|
|
316
|
+
* Object result = SampleClass.call('exampleAction');
|
|
317
|
+
*/
|
|
318
|
+
public static Object call(String action) {
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Inline linking
|
|
322
|
+
|
|
323
|
+
Apexdocs allows you to reference other classes from anywhere in your docs, and automatically creates a link to that
|
|
324
|
+
class file for easy navigation.
|
|
325
|
+
|
|
326
|
+
Apexdocs recognizes 2 different syntax when linking files:
|
|
327
|
+
|
|
328
|
+
- Javadoc's `{@link FileName}` syntax
|
|
329
|
+
- A class name wrapped in between `<<` `>>`.
|
|
330
|
+
|
|
331
|
+
**Example**
|
|
332
|
+
|
|
333
|
+
```apex
|
|
334
|
+
/**
|
|
335
|
+
* @description This is my method description. This method receives an <<ExampleClass>>.
|
|
336
|
+
* @param param1 An <<ExampleClass>> instance. Can also do {@link ExampleClass}
|
|
337
|
+
* @return The result of the operation.
|
|
338
|
+
*/
|
|
339
|
+
public static Object class(ExampleClass param1) {
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Typescript
|
|
343
|
+
|
|
344
|
+
ApexDocs provides all necessary type definitions.
|