@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.
Files changed (251) hide show
  1. package/.eslintrc.js +12 -0
  2. package/.prettierrc.js +7 -0
  3. package/README.md +344 -277
  4. package/ROADMAP.md +18 -0
  5. package/docs/Gemfile.lock +1 -1
  6. package/docs/Sample-Classes/SampleClass.md +138 -30
  7. package/docs/Sample-Interfaces/SampleInterface.md +21 -4
  8. package/docs/index.md +1 -9
  9. package/examples/apex/SampleClass.cls +31 -6
  10. package/examples/apex/SampleInterface.cls +3 -2
  11. package/lib/application/Apexdocs.d.ts +11 -0
  12. package/lib/application/Apexdocs.js +41 -0
  13. package/lib/application/Apexdocs.js.map +1 -0
  14. package/lib/cli/generate.js +17 -21
  15. package/lib/cli/generate.js.map +1 -0
  16. package/lib/index.d.ts +1 -1
  17. package/lib/index.js +2 -1
  18. package/lib/index.js.map +1 -0
  19. package/lib/model/file.d.ts +10 -0
  20. package/lib/model/file.js +23 -0
  21. package/lib/model/file.js.map +1 -0
  22. package/lib/model/manifest.d.ts +22 -0
  23. package/lib/model/manifest.js +41 -0
  24. package/lib/model/manifest.js.map +1 -0
  25. package/lib/model/markdown-file.d.ts +10 -0
  26. package/lib/model/markdown-file.js +52 -0
  27. package/lib/model/markdown-file.js.map +1 -0
  28. package/lib/model/markdown-generation-util/field-declaration-util.d.ts +3 -0
  29. package/lib/model/markdown-generation-util/field-declaration-util.js +33 -0
  30. package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -0
  31. package/lib/model/markdown-generation-util/index.d.ts +3 -0
  32. package/lib/model/markdown-generation-util/index.js +9 -0
  33. package/lib/model/markdown-generation-util/index.js.map +1 -0
  34. package/lib/model/markdown-generation-util/method-declaration-util.d.ts +3 -0
  35. package/lib/model/markdown-generation-util/method-declaration-util.js +97 -0
  36. package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -0
  37. package/lib/model/markdown-generation-util/type-declaration-util.d.ts +3 -0
  38. package/lib/model/markdown-generation-util/type-declaration-util.js +25 -0
  39. package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -0
  40. package/lib/model/markdown-home-file.d.ts +11 -0
  41. package/lib/model/markdown-home-file.js +50 -0
  42. package/lib/model/markdown-home-file.js.map +1 -0
  43. package/lib/model/markdown-type-file.d.ts +17 -0
  44. package/lib/model/markdown-type-file.js +62 -0
  45. package/lib/model/markdown-type-file.js.map +1 -0
  46. package/lib/service/apex-file-reader.d.ts +13 -0
  47. package/lib/service/apex-file-reader.js +39 -0
  48. package/lib/service/apex-file-reader.js.map +1 -0
  49. package/lib/service/file-system.d.ts +12 -0
  50. package/lib/service/file-system.js +21 -0
  51. package/lib/service/file-system.js.map +1 -0
  52. package/lib/service/file-writer.d.ts +4 -0
  53. package/lib/service/file-writer.js +25 -0
  54. package/lib/service/file-writer.js.map +1 -0
  55. package/lib/service/manifest-factory.d.ts +9 -0
  56. package/lib/service/manifest-factory.js +13 -0
  57. package/lib/service/manifest-factory.js.map +1 -0
  58. package/lib/service/parser.d.ts +9 -0
  59. package/lib/service/parser.js +17 -0
  60. package/lib/service/parser.js.map +1 -0
  61. package/lib/service/walkers/class-walker.d.ts +4 -0
  62. package/lib/service/walkers/class-walker.js +32 -0
  63. package/lib/service/walkers/class-walker.js.map +1 -0
  64. package/lib/service/walkers/enum-walker.d.ts +4 -0
  65. package/lib/service/walkers/enum-walker.js +10 -0
  66. package/lib/service/walkers/enum-walker.js.map +1 -0
  67. package/lib/service/walkers/interface-walker.d.ts +4 -0
  68. package/lib/service/walkers/interface-walker.js +14 -0
  69. package/lib/service/walkers/interface-walker.js.map +1 -0
  70. package/lib/service/walkers/walker-factory.d.ts +5 -0
  71. package/lib/service/walkers/walker-factory.js +19 -0
  72. package/lib/service/walkers/walker-factory.js.map +1 -0
  73. package/lib/service/walkers/walker.d.ts +16 -0
  74. package/lib/service/walkers/walker.js +9 -0
  75. package/lib/service/walkers/walker.js.map +1 -0
  76. package/lib/settings.d.ts +21 -0
  77. package/lib/settings.js +42 -0
  78. package/lib/settings.js.map +1 -0
  79. package/lib/transpiler/file-container.d.ts +6 -0
  80. package/lib/transpiler/file-container.js +15 -0
  81. package/lib/transpiler/file-container.js.map +1 -0
  82. package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +6 -0
  83. package/lib/transpiler/markdown/class-file-generatorHelper.js +17 -0
  84. package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -0
  85. package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +4 -0
  86. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +10 -0
  87. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +1 -0
  88. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +8 -0
  89. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +24 -0
  90. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -0
  91. package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +11 -0
  92. package/lib/transpiler/markdown/markdown-transpiler-base.js +23 -0
  93. package/lib/transpiler/markdown/markdown-transpiler-base.js.map +1 -0
  94. package/lib/transpiler/processor-type-transpiler.d.ts +8 -0
  95. package/lib/transpiler/processor-type-transpiler.js +6 -0
  96. package/lib/transpiler/processor-type-transpiler.js.map +1 -0
  97. package/lib/transpiler/transpiler.d.ts +5 -0
  98. package/lib/transpiler/transpiler.js +21 -0
  99. package/lib/transpiler/transpiler.js.map +1 -0
  100. package/lib/util/logger.d.ts +18 -0
  101. package/lib/util/logger.js +32 -0
  102. package/lib/util/logger.js.map +1 -0
  103. package/package.json +22 -11
  104. package/src/application/Apexdocs.ts +41 -0
  105. package/src/cli/generate.ts +52 -64
  106. package/src/index.ts +1 -1
  107. package/src/model/__tests__/manifest.spec.ts +15 -0
  108. package/src/model/file.ts +23 -0
  109. package/src/model/manifest.ts +60 -0
  110. package/src/model/markdown-file.ts +56 -0
  111. package/src/model/markdown-generation-util/field-declaration-util.ts +42 -0
  112. package/src/model/markdown-generation-util/index.ts +3 -0
  113. package/src/model/markdown-generation-util/method-declaration-util.ts +128 -0
  114. package/src/model/markdown-generation-util/type-declaration-util.ts +29 -0
  115. package/src/model/markdown-home-file.ts +48 -0
  116. package/src/model/markdown-type-file.ts +75 -0
  117. package/src/service/__tests__/apex-file-reader.spec.ts +79 -0
  118. package/src/service/__tests__/manifest-factory.spec.ts +16 -0
  119. package/src/service/apex-file-reader.ts +45 -0
  120. package/src/service/file-system.ts +28 -0
  121. package/src/service/file-writer.ts +25 -0
  122. package/src/service/manifest-factory.ts +12 -0
  123. package/src/service/parser.ts +18 -0
  124. package/src/service/walkers/class-walker.ts +31 -0
  125. package/src/service/walkers/enum-walker.ts +8 -0
  126. package/src/service/walkers/interface-walker.ts +12 -0
  127. package/src/service/walkers/walker-factory.ts +18 -0
  128. package/src/service/walkers/walker.ts +35 -0
  129. package/src/settings.ts +57 -0
  130. package/src/transpiler/file-container.ts +13 -0
  131. package/src/transpiler/markdown/class-file-generatorHelper.ts +16 -0
  132. package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +7 -0
  133. package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +22 -0
  134. package/src/transpiler/markdown/markdown-transpiler-base.ts +28 -0
  135. package/src/transpiler/processor-type-transpiler.ts +12 -0
  136. package/src/transpiler/transpiler.ts +18 -0
  137. package/src/util/logger.ts +31 -0
  138. package/tsconfig.json +9 -3
  139. package/.prettierrc +0 -5
  140. package/examples/config/config.json +0 -5
  141. package/lib/AsJsDocsProcessor.d.ts +0 -9
  142. package/lib/AsJsDocsProcessor.js +0 -61
  143. package/lib/ClassFileGeneratorHelper.d.ts +0 -5
  144. package/lib/ClassFileGeneratorHelper.js +0 -25
  145. package/lib/ClassFileGeneratorHelper.test.d.ts +0 -1
  146. package/lib/ClassFileGeneratorHelper.test.js +0 -32
  147. package/lib/Configuration.d.ts +0 -34
  148. package/lib/Configuration.js +0 -37
  149. package/lib/DocsProcessor.d.ts +0 -6
  150. package/lib/DocsProcessor.js +0 -9
  151. package/lib/DocsifyDocsProcessor.d.ts +0 -4
  152. package/lib/DocsifyDocsProcessor.js +0 -9
  153. package/lib/DocsifyDocsProcessor.test.d.ts +0 -1
  154. package/lib/DocsifyDocsProcessor.test.js +0 -7
  155. package/lib/FileManager.d.ts +0 -6
  156. package/lib/FileManager.js +0 -28
  157. package/lib/JekyllDocsProcessor.d.ts +0 -8
  158. package/lib/JekyllDocsProcessor.js +0 -20
  159. package/lib/JekyllDocsProcessor.test.d.ts +0 -1
  160. package/lib/JekyllDocsProcessor.test.js +0 -21
  161. package/lib/JsHelper.d.ts +0 -12
  162. package/lib/JsHelper.js +0 -72
  163. package/lib/MarkdownDocsProcessor.d.ts +0 -22
  164. package/lib/MarkdownDocsProcessor.js +0 -358
  165. package/lib/MarkdownHelper.d.ts +0 -13
  166. package/lib/MarkdownHelper.js +0 -78
  167. package/lib/Settings.d.ts +0 -22
  168. package/lib/Settings.js +0 -51
  169. package/lib/Settings.test.d.ts +0 -1
  170. package/lib/Settings.test.js +0 -38
  171. package/lib/command/Generate.d.ts +0 -2
  172. package/lib/command/Generate.js +0 -54
  173. package/lib/command/__test__/Generte.test.d.ts +0 -1
  174. package/lib/command/__test__/Generte.test.js +0 -30
  175. package/lib/model/ApexModel.d.ts +0 -30
  176. package/lib/model/ApexModel.js +0 -85
  177. package/lib/model/ClassModel.d.ts +0 -39
  178. package/lib/model/ClassModel.js +0 -125
  179. package/lib/model/EnumModel.d.ts +0 -6
  180. package/lib/model/EnumModel.js +0 -28
  181. package/lib/model/MethodModel.d.ts +0 -18
  182. package/lib/model/MethodModel.js +0 -74
  183. package/lib/model/PropertyModel.d.ts +0 -6
  184. package/lib/model/PropertyModel.js +0 -40
  185. package/lib/model/__test__/ClassModel.test.d.ts +0 -1
  186. package/lib/model/__test__/ClassModel.test.js +0 -79
  187. package/lib/model/__test__/MethodModel.test.d.ts +0 -1
  188. package/lib/model/__test__/MethodModel.test.js +0 -55
  189. package/lib/model/__test__/PropertyModel.test.d.ts +0 -1
  190. package/lib/model/__test__/PropertyModel.test.js +0 -25
  191. package/lib/parser/ClassParser.d.ts +0 -5
  192. package/lib/parser/ClassParser.js +0 -79
  193. package/lib/parser/EnumParser.d.ts +0 -5
  194. package/lib/parser/EnumParser.js +0 -45
  195. package/lib/parser/FileParser.d.ts +0 -8
  196. package/lib/parser/FileParser.js +0 -210
  197. package/lib/parser/MethodParser.d.ts +0 -5
  198. package/lib/parser/MethodParser.js +0 -109
  199. package/lib/parser/PropertyParser.d.ts +0 -5
  200. package/lib/parser/PropertyParser.js +0 -46
  201. package/lib/parser/__test__/ClassParser.test.d.ts +0 -1
  202. package/lib/parser/__test__/ClassParser.test.js +0 -52
  203. package/lib/parser/__test__/FileParser.test.d.ts +0 -1
  204. package/lib/parser/__test__/FileParser.test.js +0 -12
  205. package/lib/parser/__test__/MethodParser.test.d.ts +0 -1
  206. package/lib/parser/__test__/MethodParser.test.js +0 -69
  207. package/lib/parser/__test__/PropertyParser.test.d.ts +0 -1
  208. package/lib/parser/__test__/PropertyParser.test.js +0 -14
  209. package/lib/parser/__test__/testFileContents.d.ts +0 -1
  210. package/lib/parser/__test__/testFileContents.js +0 -82
  211. package/lib/utils.d.ts +0 -12
  212. package/lib/utils.js +0 -49
  213. package/lib/utils.test.d.ts +0 -1
  214. package/lib/utils.test.js +0 -35
  215. package/src/AsJsDocsProcessor.ts +0 -67
  216. package/src/ClassFileGeneratorHelper.test.ts +0 -44
  217. package/src/ClassFileGeneratorHelper.ts +0 -26
  218. package/src/Configuration.ts +0 -69
  219. package/src/DocsProcessor.ts +0 -9
  220. package/src/DocsifyDocsProcessor.test.ts +0 -6
  221. package/src/DocsifyDocsProcessor.ts +0 -7
  222. package/src/FileManager.ts +0 -32
  223. package/src/JekyllDocsProcessor.test.ts +0 -28
  224. package/src/JekyllDocsProcessor.ts +0 -22
  225. package/src/JsHelper.ts +0 -78
  226. package/src/MarkdownDocsProcessor.ts +0 -420
  227. package/src/MarkdownHelper.ts +0 -91
  228. package/src/Settings.test.ts +0 -54
  229. package/src/Settings.ts +0 -65
  230. package/src/command/Generate.ts +0 -69
  231. package/src/command/__test__/Generte.test.ts +0 -39
  232. package/src/model/ApexModel.ts +0 -102
  233. package/src/model/ClassModel.ts +0 -140
  234. package/src/model/EnumModel.ts +0 -27
  235. package/src/model/MethodModel.ts +0 -80
  236. package/src/model/PropertyModel.ts +0 -37
  237. package/src/model/__test__/ClassModel.test.ts +0 -100
  238. package/src/model/__test__/MethodModel.test.ts +0 -70
  239. package/src/model/__test__/PropertyModel.test.ts +0 -34
  240. package/src/parser/ClassParser.ts +0 -83
  241. package/src/parser/EnumParser.ts +0 -47
  242. package/src/parser/FileParser.ts +0 -250
  243. package/src/parser/MethodParser.ts +0 -119
  244. package/src/parser/PropertyParser.ts +0 -46
  245. package/src/parser/__test__/ClassParser.test.ts +0 -70
  246. package/src/parser/__test__/FileParser.test.ts +0 -14
  247. package/src/parser/__test__/MethodParser.test.ts +0 -90
  248. package/src/parser/__test__/PropertyParser.test.ts +0 -18
  249. package/src/parser/__test__/testFileContents.ts +0 -81
  250. package/src/utils.test.ts +0 -40
  251. package/src/utils.ts +0 -52
package/ROADMAP.md ADDED
@@ -0,0 +1,18 @@
1
+ [] Automatic Resolution of links (@see and {@link FileName})
2
+
3
+ [] Respect access modifiers where the properties/methods are different from the class declaration. For example,
4
+ AuraEnabled properties do not live in an AuraEnabled class, so there's no way to just generate docs to showcase the
5
+ AuraEnabled properties of a class without some sort of combination of also exposing other public/globals
6
+
7
+ [] Versioning capabilities. When creating the doc you specify a version number, and a new directory is created for the
8
+ files, instead of just overriding
9
+
10
+ [] New generatortype: To JsDocs from AuraEnabled
11
+
12
+ [] More unit tests
13
+
14
+ [] config.js support to allow for injections, home header, etc.
15
+
16
+ [] Add configuration setting that allows someone to set the "namespace"
17
+
18
+ [] Homepage support similar to what docsify does
package/docs/Gemfile.lock CHANGED
@@ -4,7 +4,7 @@ GEM
4
4
  activesupport (3.2.22.5)
5
5
  i18n (~> 0.6, >= 0.6.4)
6
6
  multi_json (~> 1.0)
7
- addressable (2.7.0)
7
+ addressable (2.8.0)
8
8
  public_suffix (>= 2.0.2, < 5.0)
9
9
  coffee-script (2.4.1)
10
10
  coffee-script-source
@@ -1,30 +1,138 @@
1
- # SampleClass class
2
-
3
- `NamespaceAccessible`
4
-
5
- This is a class description.
6
-
7
- ---
8
- ## Constructors
9
- ### `SampleClass()`
10
-
11
- Constructs a SampleClass without any arguments.
12
- #### Example
13
- ```
14
- <pre>
15
- SampleClass sampleInstance = new SampleClass();
16
- ```
17
-
18
- ---
19
- ## Methods
20
- ### `testMethod(String argument)` → `String`
21
-
22
- Executes commands based on the passed in argument.
23
- #### Example
24
- ```
25
- <pre>
26
- String result = SampleClass.testMethod();
27
- System.debug(result);
28
- ```
29
-
30
- ---
1
+ ---
2
+ layout: default
3
+ ---
4
+ # SampleClass
5
+
6
+ `NAMESPACEACCESSIBLE`
7
+
8
+ This is a class description.
9
+
10
+
11
+ **Group** Sample Classes
12
+
13
+
14
+ **CustomAnnotation** A Custom annotation
15
+
16
+
17
+ **Author** Cesar Parra
18
+
19
+ ## Constructors
20
+ ### `SampleClass()`
21
+
22
+ `NAMESPACEACCESSIBLE`
23
+
24
+ Constructs a SampleClass without any arguments.
25
+
26
+ #### Throws
27
+ |Exception|Description|
28
+ |---|---|
29
+ |`ExcName`|some exception|
30
+ #### Example
31
+ ```apex
32
+ <pre>
33
+ // <strong>Example</strong>
34
+ SampleClass sampleInstance = new SampleClass();
35
+ </pre>
36
+ ```
37
+
38
+ ### `SampleClass(String argument)`
39
+
40
+ Constructs a SampleClass with an argument.
41
+
42
+ #### Parameters
43
+ |Param|Description|
44
+ |---|---|
45
+ |`argument`|Argument definition|
46
+ ---
47
+ ## Properties
48
+
49
+ ### `AnotherProp` → `Decimal`
50
+
51
+ `AURAENABLED`
52
+
53
+ This is a Decimal property.
54
+
55
+ ### `MyProp` → `String`
56
+
57
+ `AURAENABLED`
58
+
59
+ This is a String property.
60
+
61
+ ---
62
+ ## Methods
63
+ ### `static sampleMethod(String argument)`
64
+
65
+ `NAMESPACEACCESSIBLE`
66
+
67
+ Executes commands based on the passed in argument.
68
+
69
+ #### Parameters
70
+ |Param|Description|
71
+ |---|---|
72
+ |`argument`|Argument to debug|
73
+ #### Return
74
+
75
+ **Type**
76
+
77
+ String
78
+
79
+ **Description**
80
+
81
+ Empty string
82
+
83
+ #### Example
84
+ ```apex
85
+ <pre>
86
+ String result = SampleClass.testMethod();
87
+ System.debug(result);
88
+ ```
89
+
90
+ ### `static call()`
91
+
92
+ Calls the method. This methods allows you to call it.
93
+
94
+ ---
95
+ ## Enums
96
+ ### InnerEnum
97
+
98
+ `NAMESPACEACCESSIBLE`
99
+
100
+ ---
101
+ ## Classes
102
+ ### AnotherInnerClass
103
+
104
+ Inner class belonging to SampleClass.
105
+
106
+ #### Properties
107
+
108
+ ##### `InnerProp` → `String`
109
+
110
+ Description of the inner property.
111
+
112
+ ---
113
+ #### Methods
114
+ ##### `innerMethod()`
115
+
116
+ Executes from the inner class.
117
+
118
+ ---
119
+
120
+ ### InnerClass
121
+
122
+ Inner class belonging to SampleClass.
123
+
124
+ #### Properties
125
+
126
+ ##### `InnerProp` → `String`
127
+
128
+ Description of the inner property.
129
+
130
+ ---
131
+ #### Methods
132
+ ##### `innerMethod()`
133
+
134
+ Executes from the inner class.
135
+
136
+ ---
137
+
138
+ ---
@@ -1,13 +1,30 @@
1
- # SampleInterface interface
1
+ ---
2
+ layout: default
3
+ ---
4
+ # SampleInterface
2
5
 
3
6
  This is an interface description.
4
7
 
5
- ---
8
+
9
+ **Group** Sample Interfaces
10
+
6
11
  ## Methods
7
- ### `execute()` → `void`
12
+ ### `execute()`
8
13
 
9
14
  Executes the command.
10
- ### `getValue()` → `String`
15
+
16
+ ### `getValue()`
11
17
 
12
18
  Returns a value based on the executed command.
19
+
20
+ #### Return
21
+
22
+ **Type**
23
+
24
+ String
25
+
26
+ **Description**
27
+
28
+ The value
29
+
13
30
  ---
package/docs/index.md CHANGED
@@ -4,17 +4,9 @@ layout: default
4
4
  # Classes
5
5
  ## Sample Classes
6
6
 
7
- ### [SampleClass](/Sample-Classes/SampleClass.md)
7
+ ## [SampleClass](/Sample-Classes/SampleClass.md)
8
8
 
9
9
 
10
10
  This is a class description.
11
11
 
12
12
 
13
- ## Sample Interfaces
14
-
15
- ### [SampleInterface](/Sample-Interfaces/SampleInterface.md)
16
-
17
-
18
- This is an interface description.
19
-
20
-
@@ -1,14 +1,27 @@
1
1
  /**
2
2
  * @description This is a class description.
3
3
  * @group Sample Classes
4
+ * @CustomAnnotation A Custom annotation
5
+ * @author Cesar Parra
4
6
  */
5
7
  @NamespaceAccessible
6
8
  public with sharing class SampleClass {
9
+ @NamespaceAccessible
10
+ public enum InnerEnum {
11
+ A,
12
+ B,
13
+ C
14
+ }
15
+
7
16
  /**
8
17
  * @description Constructs a SampleClass without any arguments.
18
+ * @throws ExcName some exception
19
+ * @CustomAnnotation A Custom annotation
9
20
  * @example
10
21
  * <pre>
22
+ * // <strong>Example</strong>
11
23
  * SampleClass sampleInstance = new SampleClass();
24
+ * </pre>
12
25
  */
13
26
  @NamespaceAccessible
14
27
  public SampleClass() {
@@ -17,6 +30,7 @@ public with sharing class SampleClass {
17
30
 
18
31
  /**
19
32
  * @description Constructs a SampleClass with an argument.
33
+ * @param argument Argument definition
20
34
  */
21
35
  public SampleClass(String argument) {
22
36
  System.debug('Constructor');
@@ -28,9 +42,11 @@ public with sharing class SampleClass {
28
42
  * <pre>
29
43
  * String result = SampleClass.testMethod();
30
44
  * System.debug(result);
45
+ * @param argument Argument to debug
46
+ * @return Empty string
31
47
  */
32
48
  @NamespaceAccessible
33
- public static String testMethod(String argument) {
49
+ public static String sampleMethod(String argument) {
34
50
  System.debug('Execute');
35
51
  return '';
36
52
  }
@@ -40,16 +56,19 @@ public with sharing class SampleClass {
40
56
  * @description Calls the method.
41
57
  * This methods allows you to call it.
42
58
  */
43
- public static void call() { }
59
+ public static void call() {
60
+ }
44
61
 
45
62
  /**
46
63
  * @description This is a String property.
47
64
  */
65
+ @AuraEnabled
48
66
  public String MyProp { get; set; }
49
67
 
50
68
  /**
51
69
  * @description This is a Decimal property.
52
70
  */
71
+ @AuraEnabled
53
72
  public Decimal AnotherProp { get; private set; }
54
73
 
55
74
  /**
@@ -59,7 +78,10 @@ public with sharing class SampleClass {
59
78
  /**
60
79
  * @description Description of the inner property.
61
80
  */
62
- public InnerProp { get; set; }
81
+ public String InnerProp {
82
+ get;
83
+ set;
84
+ }
63
85
 
64
86
  /**
65
87
  * @description Executes from the inner class.
@@ -71,12 +93,15 @@ public with sharing class SampleClass {
71
93
 
72
94
  /**
73
95
  * @description Inner class belonging to SampleClass.
74
- */
96
+ */
75
97
  public class AnotherInnerClass {
76
98
  /**
77
99
  * @description Description of the inner property.
78
100
  */
79
- public InnerProp { get; set; }
101
+ public String InnerProp {
102
+ get;
103
+ set;
104
+ }
80
105
 
81
106
  /**
82
107
  * @description Executes from the inner class.
@@ -85,4 +110,4 @@ public with sharing class SampleClass {
85
110
  System.debug('Executing inner method.');
86
111
  }
87
112
  }
88
- }
113
+ }
@@ -2,7 +2,7 @@
2
2
  * @description This is an interface description.
3
3
  * @group Sample Interfaces
4
4
  */
5
- public interface SampleInterface {
5
+ global interface SampleInterface {
6
6
  /**
7
7
  * @description Executes the command.
8
8
  */
@@ -10,6 +10,7 @@ public interface SampleInterface {
10
10
 
11
11
  /**
12
12
  * @description Returns a value based on the executed command.
13
+ * @return The value
13
14
  */
14
15
  String getValue();
15
- }
16
+ }
@@ -0,0 +1,11 @@
1
+ import { ReflectionResult } from '@cparra/apex-reflection/index';
2
+ /**
3
+ * Application entry-point to generate documentation out of Apex source files.
4
+ */
5
+ export declare class Apexdocs {
6
+ /**
7
+ * Generates documentation out of Apex source files.
8
+ */
9
+ static generate(): void;
10
+ static _reflectionWithLogger: (declarationBody: string) => ReflectionResult;
11
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const apex_file_reader_1 = require("../service/apex-file-reader");
4
+ const file_system_1 = require("../service/file-system");
5
+ const apex_reflection_1 = require("@cparra/apex-reflection");
6
+ const logger_1 = require("../util/logger");
7
+ const manifest_factory_1 = require("../service/manifest-factory");
8
+ const parser_1 = require("../service/parser");
9
+ const settings_1 = require("../settings");
10
+ const transpiler_1 = require("../transpiler/transpiler");
11
+ const file_writer_1 = require("../service/file-writer");
12
+ /**
13
+ * Application entry-point to generate documentation out of Apex source files.
14
+ */
15
+ class Apexdocs {
16
+ /**
17
+ * Generates documentation out of Apex source files.
18
+ */
19
+ static generate() {
20
+ const fileBodies = apex_file_reader_1.ApexFileReader.processFiles(new file_system_1.DefaultFileSystem());
21
+ const manifest = manifest_factory_1.createManifest(new parser_1.RawBodyParser(fileBodies), this._reflectionWithLogger);
22
+ const filteredManifest = manifest.filteredByAccessModifierAndAnnotations(settings_1.Settings.getInstance().scope);
23
+ logger_1.Logger.log(`Parsed ${filteredManifest.length} files`);
24
+ const processor = settings_1.Settings.getInstance().typeTranspiler;
25
+ transpiler_1.default.generate(filteredManifest, processor);
26
+ const generatedFiles = processor.fileBuilder().files();
27
+ file_writer_1.FileWriter.write(generatedFiles, (fileName) => {
28
+ logger_1.Logger.log(`${fileName} processed.`);
29
+ });
30
+ }
31
+ }
32
+ exports.Apexdocs = Apexdocs;
33
+ Apexdocs._reflectionWithLogger = (declarationBody) => {
34
+ var _a;
35
+ const result = apex_reflection_1.reflect(declarationBody);
36
+ if (result.error) {
37
+ logger_1.Logger.log(`Parsing error ${(_a = result.error) === null || _a === void 0 ? void 0 : _a.message}`);
38
+ }
39
+ return result;
40
+ };
41
+ //# sourceMappingURL=Apexdocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Apexdocs.js","sourceRoot":"","sources":["../../src/application/Apexdocs.ts"],"names":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CAAC;AAChB,CAAC,CAAC"}
@@ -2,8 +2,8 @@
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const yargs = require("yargs");
5
- const Generate_1 = require("../command/Generate");
6
- const FileManager_1 = require("../FileManager");
5
+ const settings_1 = require("../settings");
6
+ const Apexdocs_1 = require("../application/Apexdocs");
7
7
  const argv = yargs.options({
8
8
  sourceDir: {
9
9
  type: 'string',
@@ -14,7 +14,7 @@ const argv = yargs.options({
14
14
  targetDir: {
15
15
  type: 'string',
16
16
  alias: 't',
17
- default: 'docs',
17
+ default: './docs/',
18
18
  describe: 'The directory location where documentation will be generated to.',
19
19
  },
20
20
  recursive: {
@@ -26,28 +26,24 @@ const argv = yargs.options({
26
26
  scope: {
27
27
  type: 'array',
28
28
  alias: 'p',
29
- default: ['global', 'public', 'namespaceaccessible'],
30
- describe: 'A list of scopes to document. Values should be separated by a space, e.g --scope public private.',
29
+ default: ['global'],
30
+ describe: 'A list of scopes to document. Values should be separated by a space, e.g --scope global public namespaceaccessible. ' +
31
+ 'Annotations are supported and should be passed lowercased and without the @ symbol, e.g. namespaceaccessible auraenabled',
31
32
  },
32
33
  targetGenerator: {
33
34
  type: 'string',
34
35
  alias: 'g',
35
36
  default: 'jekyll',
36
- choices: ['jekyll', 'docsify', 'jsdoc'],
37
- describe: 'Define the static file generator for which the documents will be created. Currently supports jekyll and docsify.',
38
- },
39
- configPath: {
40
- type: 'string',
41
- alias: 'c',
42
- describe: 'The path to the JSON configuration file that defines the structure of the documents to generate.',
43
- },
44
- group: {
45
- type: 'boolean',
46
- alias: 'o',
47
- default: true,
48
- describe: 'Define whether the generated files should be grouped by the @group tag on the top level classes.' +
49
- 'If set to true, a sub directory will be created per group inside of the specified target directory.',
37
+ choices: ['jekyll', 'docsify'],
38
+ describe: 'Define the static file generator for which the documents will be created. Currently supports jekyll, and docsify.',
50
39
  },
51
40
  }).argv;
52
- const generatedClassModels = Generate_1.generate(argv.sourceDir, argv.recursive, argv.scope, argv.targetDir, argv.targetGenerator, argv.configPath, argv.group);
53
- new FileManager_1.default(generatedClassModels).generate();
41
+ settings_1.Settings.build({
42
+ sourceDirectory: argv.sourceDir,
43
+ recursive: argv.recursive,
44
+ scope: argv.scope,
45
+ outputDir: argv.targetDir,
46
+ targetGenerator: argv.targetGenerator,
47
+ });
48
+ Apexdocs_1.Apexdocs.generate();
49
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAE/B,0CAAyD;AACzD,sDAAmD;AAEnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC;IACzB,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,+DAA+D;KAC1E;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,kEAAkE;KAC7E;IACD,SAAS,EAAE;QACT,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,kFAAkF;KAC7F;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,QAAQ,EACN,sHAAsH;YACtH,0HAA0H;KAC7H;IACD,eAAe,EAAE;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC9B,QAAQ,EACN,mHAAmH;KACtH;CACF,CAAC,CAAC,IAAI,CAAC;AAER,mBAAQ,CAAC,KAAK,CAAC;IACb,eAAe,EAAE,IAAI,CAAC,SAAS;IAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;IACzB,KAAK,EAAE,IAAI,CAAC,KAAK;IACjB,SAAS,EAAE,IAAI,CAAC,SAAS;IACzB,eAAe,EAAE,IAAI,CAAC,eAAmC;CAC1D,CAAC,CAAC;AAEH,mBAAQ,CAAC,QAAQ,EAAE,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './command/Generate';
1
+ export * from './service/manifest-factory';
package/lib/index.js CHANGED
@@ -3,4 +3,5 @@ function __export(m) {
3
3
  for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./command/Generate"));
6
+ __export(require("./service/manifest-factory"));
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,gDAA2C"}
@@ -0,0 +1,10 @@
1
+ export declare abstract class File {
2
+ fileName: string;
3
+ dir: string;
4
+ _contents: string;
5
+ constructor(fileName: string, dir: string);
6
+ abstract fileExtension(): string;
7
+ get body(): string;
8
+ addText(text: string, encodeHtml?: boolean): void;
9
+ addBlankLine(): void;
10
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const html_entities_1 = require("html-entities");
4
+ class File {
5
+ constructor(fileName, dir) {
6
+ this.fileName = fileName;
7
+ this.dir = dir;
8
+ this._contents = '';
9
+ }
10
+ get body() {
11
+ return this._contents;
12
+ }
13
+ addText(text, encodeHtml = true) {
14
+ const textToAdd = encodeHtml ? html_entities_1.encode(text) : text;
15
+ this._contents += textToAdd;
16
+ this.addBlankLine();
17
+ }
18
+ addBlankLine() {
19
+ this._contents += '\n';
20
+ }
21
+ }
22
+ exports.File = File;
23
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/model/file.ts"],"names":[],"mappings":";;AAAA,iDAAuC;AAEvC,MAAsB,IAAI;IAGxB,YAAmB,QAAgB,EAAS,GAAW;QAApC,aAAQ,GAAR,QAAQ,CAAQ;QAAS,QAAG,GAAH,GAAG,CAAQ;QAFvD,cAAS,GAAG,EAAE,CAAC;IAE2C,CAAC;IAI3D,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,OAAO,CAAC,IAAY,EAAE,UAAU,GAAG,IAAI;QACrC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,sBAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC;QAC5B,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED,YAAY;QACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC;IACzB,CAAC;CACF;AApBD,oBAoBC"}
@@ -0,0 +1,22 @@
1
+ import { Type } from '@cparra/apex-reflection';
2
+ import { Annotation } from '@cparra/apex-reflection/index';
3
+ declare type AccessAware = {
4
+ access_modifier: string;
5
+ } & {
6
+ annotations: Annotation[];
7
+ };
8
+ /**
9
+ * Represents the full library of Apex top-level types (classes, enums, and interface) for a Salesforce project.
10
+ */
11
+ export default class Manifest {
12
+ types: Type[];
13
+ isForInnerTypes: boolean;
14
+ /**
15
+ * Constructs a new Manifest object.
16
+ * @param types List of types to be wrapped by this object.
17
+ */
18
+ constructor(types: Type[], isForInnerTypes?: boolean);
19
+ filteredByAccessModifierAndAnnotations(modifiers: string[]): Type[];
20
+ filterAccessibleModifier(accessAware: AccessAware[], modifiers: string[]): AccessAware[];
21
+ }
22
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Represents the full library of Apex top-level types (classes, enums, and interface) for a Salesforce project.
5
+ */
6
+ class Manifest {
7
+ /**
8
+ * Constructs a new Manifest object.
9
+ * @param types List of types to be wrapped by this object.
10
+ */
11
+ constructor(types, isForInnerTypes = false) {
12
+ this.types = types;
13
+ this.isForInnerTypes = isForInnerTypes;
14
+ }
15
+ filteredByAccessModifierAndAnnotations(modifiers) {
16
+ const filteredTypes = this.filterAccessibleModifier(this.types, modifiers);
17
+ const typesToReturn = [];
18
+ for (const filteredType of filteredTypes) {
19
+ const currentType = filteredType;
20
+ if (currentType.type_name !== 'class') {
21
+ typesToReturn.push(currentType);
22
+ continue;
23
+ }
24
+ const currentClass = currentType;
25
+ let filteredClass = Object.assign(Object.assign({}, currentType), { methods: this.filterAccessibleModifier(currentClass.methods, modifiers), properties: this.filterAccessibleModifier(currentClass.properties, modifiers), fields: this.filterAccessibleModifier(currentClass.fields, modifiers), constructors: this.filterAccessibleModifier(currentClass.constructors, modifiers) });
26
+ if (!this.isForInnerTypes) {
27
+ filteredClass = Object.assign(Object.assign({}, filteredClass), { enums: this.filterAccessibleModifier(currentClass.enums, modifiers), interfaces: this.filterAccessibleModifier(currentClass.interfaces, modifiers), classes: new Manifest(currentClass.classes, true).filteredByAccessModifierAndAnnotations(modifiers) });
28
+ }
29
+ typesToReturn.push(filteredClass);
30
+ }
31
+ return typesToReturn;
32
+ }
33
+ filterAccessibleModifier(accessAware, modifiers) {
34
+ return accessAware.filter((currentType) => {
35
+ return (modifiers.includes(currentType.access_modifier) ||
36
+ currentType.annotations.some((annotation) => modifiers.includes(annotation.type.toLowerCase())));
37
+ });
38
+ }
39
+ }
40
+ exports.default = Manifest;
41
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/model/manifest.ts"],"names":[],"mappings":";;AAKA;;GAEG;AACH,MAAqB,QAAQ;IAC3B;;;OAGG;IACH,YAAmB,KAAa,EAAS,kBAA2B,KAAK;QAAtD,UAAK,GAAL,KAAK,CAAQ;QAAS,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;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mB;QACtE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE;YACxC,OAAO,CACL,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC;gBAC/C,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAsB,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAC5G,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,2BAmDC"}
@@ -0,0 +1,10 @@
1
+ import { File } from './file';
2
+ export declare class MarkdownFile extends File {
3
+ fileExtension(): string;
4
+ addTitle(text: string, level?: number): void;
5
+ startCodeBlock(): void;
6
+ endCodeBlock(): void;
7
+ addHorizontalRule(): void;
8
+ initializeTable(...headers: string[]): void;
9
+ addTableRow(...columns: string[]): void;
10
+ }