@cparra/apexdocs 1.13.8 → 1.14.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
@@ -8,14 +8,21 @@
8
8
 
9
9
  ## Description
10
10
 
11
- ApexDocs was built as an alternative to the [Java based ApexDoc tool](https://github.com/SalesforceFoundation/ApexDoc) originally created by Aslam Bari and later maintained by Salesforce.org, as that tool is no longer being maintained.
11
+ ApexDocs was built as an alternative to the [Java based ApexDoc tool](https://github.com/SalesforceFoundation/ApexDoc)
12
+ originally created by Aslam Bari and later maintained by Salesforce.org, as that tool is no longer being maintained.
12
13
 
13
- ApexDocs is a Node.js library built on Typescript and hosted on [npm](https://www.npmjs.com/package/@cparra/apexdocs). It offers CLI capabilities to automatically generate a set of files that fully document each one of you classes. Additionally it can be imported and consumed directly by your JavaScript code.
14
+ ApexDocs is a Node.js library built on Typescript and hosted on [npm](https://www.npmjs.com/package/@cparra/apexdocs).
15
+ It offers CLI capabilities to automatically generate a set of files that fully document each one of you classes.
16
+ Additionally, it can be imported and consumed directly by your JavaScript code.
14
17
 
15
18
  There are some key differences between ApexDocs and the Java based ApexDoc tool:
16
19
 
17
- - **Recursive file search through your module directory structure**. In an `sfdx` based project, all of your classes will be documented by specifying the top-most directory where file search should begin.
18
- - **Unopinionated documentation site generation**. Instead of creating HTML files, ApexDocs generates a Markdown (.md) file per Apex class being documented. This means you can host your files in static web hosting services that parse Markdown like Github Pages or Netlify, and use site generators like Jekyll or Gatsby. This gives you the freedom to decide how to style your site to match your needs.
20
+ - **Recursive file search through your module directory structure**. In an `sfdx` based project, all of your classes
21
+ will be documented by specifying the top-most directory where file search should begin.
22
+ - **Unopinionated documentation site generation**. Instead of creating HTML files, ApexDocs generates a Markdown (.md)
23
+ file per Apex class being documented. This means you can host your files in static web hosting services that parse
24
+ Markdown like Github Pages or Netlify, and use site generators like Jekyll or Gatsby. This gives you the freedom to
25
+ decide how to style your site to match your needs.
19
26
 
20
27
  ### Demo
21
28
 
@@ -58,19 +65,20 @@ apexdocs-generate
58
65
 
59
66
  The CLI supports the following parameters:
60
67
 
61
- | Parameter | Alias | Description | Default | Required |
62
- | ----------------- | ----- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------- | -------- |
63
- | --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
64
- | --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
65
- | --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
66
- | --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private | `global namespaceaccessible public` | No |
67
- | --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports jekyll and docsify. | `jekyll` | No |
68
- | --configPath | -c | The path to the JSON configuration file that defines the structure of the documents to generate. | N/A | No |
69
- | --group | -o | Define whether the generated files should be grouped by the @group tag on the top level classes. | `true` | No |
68
+ | Parameter | Alias | Description | Default | Required |
69
+ | ----------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------| ----------------------------------- | -------- |
70
+ | --sourceDir | -s | The directory or directories location(s) which contains your apex .cls classes. Multiple directories can be specified separated by spaces | N/A | Yes |
71
+ | --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
72
+ | --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
73
+ | --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private | `global namespaceaccessible public` | No |
74
+ | --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports jekyll and docsify. | `jekyll` | No |
75
+ | --configPath | -c | The path to the JSON configuration file that defines the structure of the documents to generate. | N/A | No |
76
+ | --group | -o | Define whether the generated files should be grouped by the @group tag on the top level classes. | `true` | No |
70
77
 
71
78
  #### Configuration File
72
79
 
73
- You can optionally specify the path to a configuration JSON file through the `--configPath` parameter. This let's you have some additional control over the content outputs.
80
+ You can optionally specify the path to a configuration JSON file through the `--configPath` parameter. This let's you
81
+ have some additional control over the content outputs.
74
82
 
75
83
  The configuration file allows you to specify the following:
76
84
 
@@ -80,7 +88,8 @@ _Note_: Everything in the configuration file is optional. When something is not
80
88
 
81
89
  Default: None
82
90
 
83
- Allows you to specify the root directory for where the files are being generated. This can be helpful when embedding the generated docs into an existing site so that the links are generated correctly.
91
+ Allows you to specify the root directory for where the files are being generated. This can be helpful when embedding the
92
+ generated docs into an existing site so that the links are generated correctly.
84
93
 
85
94
  `defaultGroupName`
86
95
 
@@ -92,9 +101,11 @@ Defines the `@group` name to be used when a file does not specify it.
92
101
 
93
102
  Default: None
94
103
 
95
- Defines the name of the language that will be used when generating `@example` blocks. Use this when you are interested in using syntax highlighting for your project.
104
+ Defines the name of the language that will be used when generating `@example` blocks. Use this when you are interested
105
+ in using syntax highlighting for your project.
96
106
 
97
- Even though the source code material for which documentation is generated is always `Apex`, generally you will be able to use a syntax highlighter that recognizes `java` source code, so set this value to `java` in those cases.
107
+ Even though the source code material for which documentation is generated is always `Apex`, generally you will be able
108
+ to use a syntax highlighter that recognizes `java` source code, so set this value to `java` in those cases.
98
109
 
99
110
  `home` (Object)
100
111
 
@@ -104,7 +115,8 @@ Gives you control over the home page.
104
115
 
105
116
  Default: None
106
117
 
107
- Allows you to embedd custom content into your home page by using the `header` property to point to the a file which contents will be added to the top of the generated home page.
118
+ Allows you to embed custom content into your home page by using the `header` property to point to the a file which
119
+ contents will be added to the top of the generated home page.
108
120
 
109
121
  Specify the path with the content that you want to embed.
110
122
 
@@ -128,7 +140,9 @@ Whether the `@date` tag should be used to add the file's date to the page.
128
140
 
129
141
  Default: 1
130
142
 
131
- The starting H tag level for the document. Each title will use this as the starting point to generate the approaprite `<h#>` tag. For example, if set to 1, the class' file name at the top of the file will use an `<h1>` tag, the `Properties` title will be `<h2>`, each property name will be an `<h3>`, etc.
143
+ The starting H tag level for the document. Each title will use this as the starting point to generate the
144
+ appropriate `<h#>` tag. For example, if set to 1, the class' file name at the top of the file will use an `<h1>` tag,
145
+ the `Properties` title will be `<h2>`, each property name will be an `<h3>`, etc.
132
146
 
133
147
  ```
134
148
  {
@@ -150,7 +164,8 @@ The starting H tag level for the document. Each title will use this as the start
150
164
 
151
165
  If you are just interested in the documentation parsing capabilities, you can import ApexDocs into your own project.
152
166
 
153
- Use the `generate` function to create a list of `ClassModel` that includes all of the parsed information from your .cls files.
167
+ Use the `generate` function to create a list of `ClassModel` that includes all the parsed information from your .cls
168
+ files.
154
169
 
155
170
  `generate(sourceDirectory[,recursive][,scope][,outputDir])`
156
171
 
@@ -167,7 +182,8 @@ let documentedClasses = generate('src', true, ['global'], 'docs');
167
182
 
168
183
  ## Documentation Format
169
184
 
170
- ApexDocs picks up blocks of comments throughout your `.cls` files. The block must begin with `/**` and span through multiple lines, ending with `*/`.
185
+ ApexDocs picks up blocks of comments throughout your `.cls` files. The block must begin with `/**` and span through
186
+ multiple lines, ending with `*/`.
171
187
 
172
188
  ### Documenting Classes
173
189
 
@@ -187,7 +203,10 @@ The following tags are supported on the class level:
187
203
  /**
188
204
  * @description This is my class description.
189
205
  */
190
- public with sharing class TestClass { }
206
+ public with sharing
207
+
208
+ class TestClass {
209
+ }
191
210
  ```
192
211
 
193
212
  ### Documenting Enums
@@ -204,7 +223,7 @@ The following tags are supported on the enum level:
204
223
  /**
205
224
  * @description This is my enum description.
206
225
  */
207
- public Enum ExampleEnum { VALUE_1, VALUE_2 }
226
+ public Enum ExampleEnum{VALUE_1,VALUE_2}
208
227
  ```
209
228
 
210
229
  ### Documenting Properties
@@ -221,7 +240,7 @@ The following tags are supported on the property level:
221
240
  /**
222
241
  * @description This is my property description.
223
242
  */
224
- public String ExampleProperty { get; set; }
243
+ public String ExampleProperty{get;set;}
225
244
  ```
226
245
 
227
246
  ### Documenting Methods and Constructors
@@ -248,13 +267,13 @@ The following tags are supported on the method level:
248
267
  * @example
249
268
  * Object result = SampleClass.call('exampleAction');
250
269
  */
251
- public static Object call(String action) {
270
+ public static Object call(String action){
252
271
  ```
253
272
 
254
273
  ### Inline linking
255
274
 
256
- Apexdocs allows you to reference other classes from anywhere in your docs, and automatically creates a link to that class
257
- file for easy navigation.
275
+ Apexdocs allows you to reference other classes from anywhere in your docs, and automatically creates a link to that
276
+ class file for easy navigation.
258
277
 
259
278
  Apexdocs recognizes 2 different syntax when linking files:
260
279
 
@@ -269,7 +288,7 @@ Apexdocs recognizes 2 different syntax when linking files:
269
288
  * @param param1 An <<ExampleClass>> instance. Can also do {@link ExampleClass}
270
289
  * @return The result of the operation.
271
290
  */
272
- public static Object class(ExampleClass param1) {
291
+ public static Object class(ExampleClass param1){
273
292
  ```
274
293
 
275
294
  ## Typescript
@@ -1,115 +1,115 @@
1
- ---
2
- layout: default
3
- ---
4
- # SampleClass class
5
-
6
- `NamespaceAccessible`
7
-
8
- This is a class description.
9
-
10
- ## Related
11
-
12
- [SampleInterface](../Sample-Interfaces/SampleInterface.md)
13
-
14
-
15
- [SampleClass2](../Sample-Classes/SampleClass2.md)
16
-
17
- ---
18
- ## Constructors
19
- ### `SampleClass()`
20
-
21
- `NamespaceAccessible`
22
-
23
- Constructs a SampleClass without any arguments.
24
- #### Example
25
- ```
26
- <pre>
27
- SampleClass sampleInstance = new SampleClass();
28
- ```
29
-
30
- ### `SampleClass(String argument)`
31
-
32
- `NamespaceAccessible`
33
-
34
- Constructs a SampleClass with an argument.
35
- #### Parameters
36
-
37
- | Param | Description |
38
- | ----- | ----------- |
39
- |`argument` | Some argument |
40
-
41
- ---
42
- ## Properties
43
-
44
- ### `AnotherProp` → `Decimal`
45
-
46
- `NamespaceAccessible`
47
-
48
- This is a Decimal property.
49
-
50
- ### `MyProp` → `String`
51
-
52
- `NamespaceAccessible`
53
-
54
- This is a String property.
55
-
56
- ---
57
- ## Methods
58
- ### `call()` → `void`
59
-
60
- `NamespaceAccessible`
61
-
62
- Calls the method. This methods allows you to call it.
63
-
64
- ### `testMethod(String argument)` → `String`
65
-
66
- `NamespaceAccessible`
67
-
68
- Executes commands based on the passed in argument.
69
-
70
- #### Example
71
- ```
72
- <pre>
73
- String result = SampleClass.testMethod();
74
- System.debug(result);
75
- ```
76
-
77
- ---
78
- ## Inner Classes
79
-
80
- ### SampleClass.AnotherInnerClass class
81
-
82
- Inner class belonging to SampleClass.
83
-
84
- ---
85
- #### Properties
86
-
87
- ##### `InnerProp` → `public`
88
-
89
- Description of the inner property.
90
-
91
- ---
92
- #### Methods
93
- ##### `innerMethod()` → `void`
94
-
95
- Executes from the inner class.
96
-
97
- ---
98
- ### SampleClass.InnerClass class
99
-
100
- Inner class belonging to SampleClass.
101
-
102
- ---
103
- #### Properties
104
-
105
- ##### `InnerProp` → `public`
106
-
107
- Description of the inner property.
108
-
109
- ---
110
- #### Methods
111
- ##### `innerMethod()` → `void`
112
-
113
- Executes from the inner class.
114
-
115
- ---
1
+ ---
2
+ layout: default
3
+ ---
4
+ # SampleClass class
5
+
6
+ `NamespaceAccessible`
7
+
8
+ This is a class description.
9
+
10
+ ## Related
11
+
12
+ SampleInterface
13
+
14
+
15
+ SampleClass2
16
+
17
+ ---
18
+ ## Constructors
19
+ ### `SampleClass()`
20
+
21
+ `NamespaceAccessible`
22
+
23
+ Constructs a SampleClass without any arguments.
24
+ #### Example
25
+ ```
26
+ <pre>
27
+ SampleClass sampleInstance = new SampleClass();
28
+ ```
29
+
30
+ ### `SampleClass(String argument)`
31
+
32
+ `NamespaceAccessible`
33
+
34
+ Constructs a SampleClass with an argument.
35
+ #### Parameters
36
+
37
+ | Param | Description |
38
+ | ----- | ----------- |
39
+ |`argument` | Some argument |
40
+
41
+ ---
42
+ ## Properties
43
+
44
+ ### `AnotherProp` → `Decimal`
45
+
46
+ `NamespaceAccessible`
47
+
48
+ This is a Decimal property.
49
+
50
+ ### `MyProp` → `String`
51
+
52
+ `NamespaceAccessible`
53
+
54
+ This is a String property.
55
+
56
+ ---
57
+ ## Methods
58
+ ### `call()` → `void`
59
+
60
+ `NamespaceAccessible`
61
+
62
+ Calls the method. This methods allows you to call it.
63
+
64
+ ### `testMethod(String argument)` → `String`
65
+
66
+ `NamespaceAccessible`
67
+
68
+ Executes commands based on the passed in argument.
69
+
70
+ #### Example
71
+ ```
72
+ <pre>
73
+ String result = SampleClass.testMethod();
74
+ System.debug(result);
75
+ ```
76
+
77
+ ---
78
+ ## Inner Classes
79
+
80
+ ### SampleClass.AnotherInnerClass class
81
+
82
+ Inner class belonging to SampleClass.
83
+
84
+ ---
85
+ #### Properties
86
+
87
+ ##### `InnerProp` → `public`
88
+
89
+ Description of the inner property.
90
+
91
+ ---
92
+ #### Methods
93
+ ##### `innerMethod()` → `void`
94
+
95
+ Executes from the inner class.
96
+
97
+ ---
98
+ ### SampleClass.InnerClass class
99
+
100
+ Inner class belonging to SampleClass.
101
+
102
+ ---
103
+ #### Properties
104
+
105
+ ##### `InnerProp` → `public`
106
+
107
+ Description of the inner property.
108
+
109
+ ---
110
+ #### Methods
111
+ ##### `innerMethod()` → `void`
112
+
113
+ Executes from the inner class.
114
+
115
+ ---
@@ -1,115 +1,115 @@
1
- ---
2
- layout: default
3
- ---
4
- # SampleClass2 class
5
-
6
- `NamespaceAccessible`
7
-
8
- This is a class description.
9
-
10
- ## Related
11
-
12
- [SampleInterface](../Sample-Interfaces/SampleInterface.md)
13
-
14
-
15
- [SampleClass](../Sample-Classes/SampleClass.md)
16
-
17
- ---
18
- ## Constructors
19
- ### `SampleClass2()`
20
-
21
- `NamespaceAccessible`
22
-
23
- Constructs a SampleClass2 without any arguments.
24
- #### Example
25
- ```
26
- <pre>
27
- SampleClass2 sampleInstance = new SampleClass2();
28
- ```
29
-
30
- ### `SampleClass2(String argument)`
31
-
32
- `NamespaceAccessible`
33
-
34
- Constructs a SampleClass2 with an argument.
35
- #### Parameters
36
-
37
- | Param | Description |
38
- | ----- | ----------- |
39
- |`argument` | Some argument |
40
-
41
- ---
42
- ## Properties
43
-
44
- ### `AnotherProp` → `Decimal`
45
-
46
- `NamespaceAccessible`
47
-
48
- This is a Decimal property.
49
-
50
- ### `MyProp` → `String`
51
-
52
- `NamespaceAccessible`
53
-
54
- This is a String property.
55
-
56
- ---
57
- ## Methods
58
- ### `call()` → `void`
59
-
60
- `NamespaceAccessible`
61
-
62
- Calls the method. This methods allows you to call it.
63
-
64
- ### `testMethod(String argument)` → `String`
65
-
66
- `NamespaceAccessible`
67
-
68
- Executes commands based on the passed in argument.
69
-
70
- #### Example
71
- ```
72
- <pre>
73
- String result = SampleClass2.testMethod();
74
- System.debug(result);
75
- ```
76
-
77
- ---
78
- ## Inner Classes
79
-
80
- ### SampleClass2.AnotherInnerClass class
81
-
82
- Inner class belonging to SampleClass2.
83
-
84
- ---
85
- #### Properties
86
-
87
- ##### `InnerProp` → `public`
88
-
89
- Description of the inner property.
90
-
91
- ---
92
- #### Methods
93
- ##### `innerMethod()` → `void`
94
-
95
- Executes from the inner class.
96
-
97
- ---
98
- ### SampleClass2.InnerClass class
99
-
100
- Inner class belonging to SampleClass2.
101
-
102
- ---
103
- #### Properties
104
-
105
- ##### `InnerProp` → `public`
106
-
107
- Description of the inner property.
108
-
109
- ---
110
- #### Methods
111
- ##### `innerMethod()` → `void`
112
-
113
- Executes from the inner class.
114
-
115
- ---
1
+ ---
2
+ layout: default
3
+ ---
4
+ # SampleClass2 class
5
+
6
+ `NamespaceAccessible`
7
+
8
+ This is a class description.
9
+
10
+ ## Related
11
+
12
+ [SampleInterface](../Sample-Interfaces/SampleInterface.md)
13
+
14
+
15
+ [SampleClass](../Sample-Classes/SampleClass.md)
16
+
17
+ ---
18
+ ## Constructors
19
+ ### `SampleClass2()`
20
+
21
+ `NamespaceAccessible`
22
+
23
+ Constructs a SampleClass2 without any arguments.
24
+ #### Example
25
+ ```
26
+ <pre>
27
+ SampleClass2 sampleInstance = new SampleClass2();
28
+ ```
29
+
30
+ ### `SampleClass2(String argument)`
31
+
32
+ `NamespaceAccessible`
33
+
34
+ Constructs a SampleClass2 with an argument.
35
+ #### Parameters
36
+
37
+ | Param | Description |
38
+ | ----- | ----------- |
39
+ |`argument` | Some argument |
40
+
41
+ ---
42
+ ## Properties
43
+
44
+ ### `AnotherProp` → `Decimal`
45
+
46
+ `NamespaceAccessible`
47
+
48
+ This is a Decimal property.
49
+
50
+ ### `MyProp` → `String`
51
+
52
+ `NamespaceAccessible`
53
+
54
+ This is a String property.
55
+
56
+ ---
57
+ ## Methods
58
+ ### `call()` → `void`
59
+
60
+ `NamespaceAccessible`
61
+
62
+ Calls the method. This methods allows you to call it.
63
+
64
+ ### `testMethod(String argument)` → `String`
65
+
66
+ `NamespaceAccessible`
67
+
68
+ Executes commands based on the passed in argument.
69
+
70
+ #### Example
71
+ ```
72
+ <pre>
73
+ String result = SampleClass2.testMethod();
74
+ System.debug(result);
75
+ ```
76
+
77
+ ---
78
+ ## Inner Classes
79
+
80
+ ### SampleClass2.AnotherInnerClass class
81
+
82
+ Inner class belonging to SampleClass2.
83
+
84
+ ---
85
+ #### Properties
86
+
87
+ ##### `InnerProp` → `public`
88
+
89
+ Description of the inner property.
90
+
91
+ ---
92
+ #### Methods
93
+ ##### `innerMethod()` → `void`
94
+
95
+ Executes from the inner class.
96
+
97
+ ---
98
+ ### SampleClass2.InnerClass class
99
+
100
+ Inner class belonging to SampleClass2.
101
+
102
+ ---
103
+ #### Properties
104
+
105
+ ##### `InnerProp` → `public`
106
+
107
+ Description of the inner property.
108
+
109
+ ---
110
+ #### Methods
111
+ ##### `innerMethod()` → `void`
112
+
113
+ Executes from the inner class.
114
+
115
+ ---
@@ -1,32 +1,32 @@
1
- ---
2
- layout: default
3
- ---
4
- # SampleInterface interface
5
-
6
- This is an interface description.
7
-
8
- ## Related
9
-
10
- [SampleClass](../Sample-Classes/SampleClass.md)
11
-
12
- ---
13
- ## Methods
14
- ### `execute()` → `void`
15
-
16
- Executes the command.
17
-
18
- ### `getValue()` → `String`
19
-
20
- Returns a value based on the executed command.
21
-
22
- #### Return
23
-
24
- **Type**
25
-
26
- String
27
-
28
- **Description**
29
-
30
- Empty value
31
-
32
- ---
1
+ ---
2
+ layout: default
3
+ ---
4
+ # SampleInterface interface
5
+
6
+ This is an interface description.
7
+
8
+ ## Related
9
+
10
+ [SampleClass](../Sample-Classes/SampleClass.md)
11
+
12
+ ---
13
+ ## Methods
14
+ ### `execute()` → `void`
15
+
16
+ Executes the command.
17
+
18
+ ### `getValue()` → `String`
19
+
20
+ Returns a value based on the executed command.
21
+
22
+ #### Return
23
+
24
+ **Type**
25
+
26
+ String
27
+
28
+ **Description**
29
+
30
+ Empty value
31
+
32
+ ---
package/docs/index.md CHANGED
@@ -1,27 +1,12 @@
1
- ---
2
- layout: default
3
- ---
4
- # Classes
5
- ## Sample Classes
6
-
7
- ### [SampleClass](/Sample-Classes/SampleClass.md)
8
-
9
-
10
- This is a class description.
11
-
12
-
13
-
14
- ### [SampleClass2](/Sample-Classes/SampleClass2.md)
15
-
16
-
17
- This is a class description.
18
-
19
-
20
- ## Sample Interfaces
21
-
22
- ### [SampleInterface](/Sample-Interfaces/SampleInterface.md)
23
-
24
-
25
- This is an interface description.
26
-
27
-
1
+ ---
2
+ layout: default
3
+ ---
4
+ # Classes
5
+ ## Sample Classes
6
+
7
+ ### [SampleClass](/Sample-Classes/SampleClass.md)
8
+
9
+
10
+ This is a class description.
11
+
12
+
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @description This is a class description.
3
+ * @group Sample Classes
4
+ * @see SampleInterface
5
+ * @see SampleClass2
6
+ */
7
+ @NamespaceAccessible
8
+ public with sharing class SampleClass {
9
+ /**
10
+ * @description Constructs a SampleClass without any arguments.
11
+ * @example
12
+ * <pre>
13
+ * SampleClass sampleInstance = new SampleClass();
14
+ */
15
+ @NamespaceAccessible
16
+ public SampleClass() {
17
+ System.debug('Constructor');
18
+ }
19
+
20
+ /**
21
+ * @description Constructs a SampleClass with an argument.
22
+ * @param argument Some argument
23
+ */
24
+ public SampleClass(String argument) {
25
+ System.debug('Constructor');
26
+ }
27
+
28
+ /**
29
+ * @description Executes commands based on the passed in argument.
30
+ * @example
31
+ * <pre>
32
+ * String result = SampleClass.testMethod();
33
+ * System.debug(result);
34
+ */
35
+ @NamespaceAccessible
36
+ public static String testMethod(String argument) {
37
+ System.debug('Execute');
38
+ return '';
39
+ }
40
+
41
+
42
+ /**
43
+ * @description Calls the method.
44
+ * This methods allows you to call it.
45
+ */
46
+ public static void call() {
47
+ }
48
+
49
+ /**
50
+ * @description This is a String property.
51
+ */
52
+ public String MyProp { get; set; }
53
+
54
+ /**
55
+ * @description This is a Decimal property.
56
+ */
57
+ public Decimal AnotherProp { get; private set; }
58
+
59
+ /**
60
+ * @description Inner class belonging to SampleClass.
61
+ */
62
+ public class InnerClass {
63
+ /**
64
+ * @description Description of the inner property.
65
+ */
66
+ public InnerProp {
67
+ get; set;
68
+ }
69
+
70
+ /**
71
+ * @description Executes from the inner class.
72
+ */
73
+ public void innerMethod() {
74
+ System.debug('Executing inner method.');
75
+ }
76
+ }
77
+
78
+ /**
79
+ * @description Inner class belonging to SampleClass.
80
+ */
81
+ public class AnotherInnerClass {
82
+ /**
83
+ * @description Description of the inner property.
84
+ */
85
+ public InnerProp {
86
+ get; set;
87
+ }
88
+
89
+ /**
90
+ * @description Executes from the inner class.
91
+ */
92
+ public void innerMethod() {
93
+ System.debug('Executing inner method.');
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @description This is an interface description.
3
+ * @group Sample Interfaces
4
+ * @see SampleClass
5
+ */
6
+ public interface SampleInterface {
7
+ /**
8
+ * @description Executes the command.
9
+ */
10
+ void execute();
11
+
12
+ /**
13
+ * @description Returns a value based on the executed command.
14
+ * @return Empty value
15
+ */
16
+ String getValue();
17
+ }
@@ -1,2 +1,2 @@
1
1
  import ClassModel from '../Model/ClassModel';
2
- export declare function generate(sourceDirectory: string, recursive?: boolean, scope?: string[], outputDir?: string, targetGenerator?: string, configPath?: string, group?: boolean): ClassModel[];
2
+ export declare function generate(sourceDirectories: (string | number)[], recursive?: boolean, scope?: string[], outputDir?: string, targetGenerator?: string, configPath?: string, group?: boolean): ClassModel[];
@@ -7,7 +7,7 @@ const FileParser_1 = require("../Parser/FileParser");
7
7
  const DocsifyDocsProcessor_1 = require("../DocsifyDocsProcessor");
8
8
  const JekyllDocsProcessor_1 = require("../JekyllDocsProcessor");
9
9
  const AsJsDocsProcessor_1 = require("../AsJsDocsProcessor");
10
- function generate(sourceDirectory, recursive = true, scope = ['global', 'public', 'namespaceaccessible'], outputDir = 'docs', targetGenerator = 'jekyll', configPath, group) {
10
+ function generate(sourceDirectories, recursive = true, scope = ['global', 'public', 'namespaceaccessible'], outputDir = 'docs', targetGenerator = 'jekyll', configPath, group) {
11
11
  Settings_1.default.getInstance().setScope(scope);
12
12
  Settings_1.default.getInstance().setOutputDir(outputDir);
13
13
  if (targetGenerator === 'jekyll') {
@@ -26,29 +26,32 @@ function generate(sourceDirectory, recursive = true, scope = ['global', 'public'
26
26
  Settings_1.default.getInstance().setConfigPath(configPath);
27
27
  }
28
28
  // TODO: Assert data validation to avoid exposing 'fs' and 'path' errors to callers.
29
- const classes = getClassesFromDirectory(sourceDirectory, recursive);
29
+ const classes = getClassesFromDirectory(sourceDirectories, recursive);
30
30
  // tslint:disable-next-line:no-console
31
31
  console.log(`Processed ${classes.length} files`);
32
32
  return classes;
33
33
  }
34
34
  exports.generate = generate;
35
- function getClassesFromDirectory(sourceDirectory, recursive) {
35
+ function getClassesFromDirectory(sourceDirectories, recursive) {
36
36
  let classes = [];
37
- const directoryContents = fs.readdirSync(sourceDirectory);
38
- directoryContents.forEach(currentFile => {
39
- const currentPath = path.join(sourceDirectory, currentFile);
40
- if (recursive && fs.statSync(currentPath).isDirectory()) {
41
- classes = classes.concat(getClassesFromDirectory(currentPath, recursive));
42
- }
43
- if (!currentFile.endsWith('.cls')) {
44
- return;
45
- }
46
- const rawFile = fs.readFileSync(currentPath);
47
- const response = new FileParser_1.default().parseFileContents(rawFile.toString());
48
- if (!response) {
49
- return;
50
- }
51
- classes.push(response);
52
- });
37
+ for (const currentDirectory of sourceDirectories) {
38
+ const sourceDirectory = currentDirectory;
39
+ const directoryContents = fs.readdirSync(sourceDirectory);
40
+ directoryContents.forEach(currentFile => {
41
+ const currentPath = path.join(sourceDirectory, currentFile);
42
+ if (recursive && fs.statSync(currentPath).isDirectory()) {
43
+ classes = classes.concat(getClassesFromDirectory([currentPath], recursive));
44
+ }
45
+ if (!currentFile.endsWith('.cls')) {
46
+ return;
47
+ }
48
+ const rawFile = fs.readFileSync(currentPath);
49
+ const response = new FileParser_1.default().parseFileContents(rawFile.toString());
50
+ if (!response) {
51
+ return;
52
+ }
53
+ classes.push(response);
54
+ });
55
+ }
53
56
  return classes;
54
57
  }
@@ -10,18 +10,18 @@ beforeEach(() => {
10
10
  });
11
11
  it('returns an empty list when there are no files', () => {
12
12
  fs.readdirSync.mockReturnValue([]);
13
- const classes = Generate_1.generate('src');
13
+ const classes = Generate_1.generate(['src']);
14
14
  expect(classes.length).toBe(0);
15
15
  });
16
16
  it('returns an empty list when there are no files ending in .cls', () => {
17
17
  fs.readdirSync.mockReturnValue(['file.xml', 'README.md']);
18
- const classes = Generate_1.generate('src', false);
18
+ const classes = Generate_1.generate(['src'], false);
19
19
  expect(classes.length).toBe(0);
20
20
  });
21
21
  it('returns parsed files when there are .cls files', () => {
22
22
  fs.readdirSync.mockReturnValue(['TestClass.cls', 'README.md']);
23
23
  fs.readFileSync.mockReturnValue('Raw class data');
24
- Generate_1.generate('src', false);
24
+ Generate_1.generate(['src'], false);
25
25
  expect(FileParser_1.default).toHaveBeenCalledTimes(1);
26
26
  const mockFileParserInstance = FileParser_1.default.mock.instances[0];
27
27
  const mockParseFileContents = mockFileParserInstance.parseFileContents;
@@ -6,10 +6,10 @@ const Generate_1 = require("../Command/Generate");
6
6
  const FileManager_1 = require("../FileManager");
7
7
  const argv = yargs.options({
8
8
  sourceDir: {
9
- type: 'string',
9
+ type: 'array',
10
10
  alias: 's',
11
11
  demandOption: true,
12
- describe: 'The directory location which contains your apex .cls classes.',
12
+ describe: 'The directory or directories location(s) which contains your apex .cls classes.',
13
13
  },
14
14
  targetDir: {
15
15
  type: 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "1.13.8",
3
+ "version": "1.14.0",
4
4
  "description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
5
5
  "keywords": [
6
6
  "apex",
@@ -23,7 +23,8 @@
23
23
  "prepare": "npm run build",
24
24
  "version": "npm run format && git add -A src",
25
25
  "postversion": "git push && git push --tags",
26
- "generage:sample": "node lib/cli/generate.js -s examples -t docs"
26
+ "generage:sample": "node lib/cli/generate.js -s examples -t docs",
27
+ "generage:sample:multiple:directories": "node lib/cli/generate.js -s examples/dir1 examples/dir2 -t docs"
27
28
  },
28
29
  "author": "Cesar Parra",
29
30
  "license": "MIT",
@@ -10,7 +10,7 @@ import JekyllDocsProcessor from '../JekyllDocsProcessor';
10
10
  import AsJsDocsProcessor from '../AsJsDocsProcessor';
11
11
 
12
12
  export function generate(
13
- sourceDirectory: string,
13
+ sourceDirectories: (string | number)[],
14
14
  recursive: boolean = true,
15
15
  scope: string[] = ['global', 'public', 'namespaceaccessible'],
16
16
  outputDir: string = 'docs',
@@ -38,32 +38,36 @@ export function generate(
38
38
  }
39
39
 
40
40
  // TODO: Assert data validation to avoid exposing 'fs' and 'path' errors to callers.
41
- const classes: ClassModel[] = getClassesFromDirectory(sourceDirectory, recursive);
41
+ const classes: ClassModel[] = getClassesFromDirectory(sourceDirectories, recursive);
42
42
  // tslint:disable-next-line:no-console
43
43
  console.log(`Processed ${classes.length} files`);
44
44
  return classes;
45
45
  }
46
46
 
47
- function getClassesFromDirectory(sourceDirectory: string, recursive: boolean) {
47
+ function getClassesFromDirectory(sourceDirectories: (string | number)[], recursive: boolean) {
48
48
  let classes: ClassModel[] = [];
49
49
 
50
- const directoryContents = fs.readdirSync(sourceDirectory);
51
- directoryContents.forEach(currentFile => {
52
- const currentPath = path.join(sourceDirectory, currentFile);
53
- if (recursive && fs.statSync(currentPath).isDirectory()) {
54
- classes = classes.concat(getClassesFromDirectory(currentPath, recursive));
55
- }
50
+ for (const currentDirectory of sourceDirectories) {
51
+ const sourceDirectory = currentDirectory as string;
52
+ const directoryContents = fs.readdirSync(sourceDirectory);
53
+ directoryContents.forEach(currentFile => {
54
+ const currentPath = path.join(sourceDirectory, currentFile);
55
+ if (recursive && fs.statSync(currentPath).isDirectory()) {
56
+ classes = classes.concat(getClassesFromDirectory([currentPath], recursive));
57
+ }
56
58
 
57
- if (!currentFile.endsWith('.cls')) {
58
- return;
59
- }
59
+ if (!currentFile.endsWith('.cls')) {
60
+ return;
61
+ }
62
+
63
+ const rawFile = fs.readFileSync(currentPath);
64
+ const response = new FileParser().parseFileContents(rawFile.toString());
65
+ if (!response) {
66
+ return;
67
+ }
68
+ classes.push(response);
69
+ });
70
+ }
60
71
 
61
- const rawFile = fs.readFileSync(currentPath);
62
- const response = new FileParser().parseFileContents(rawFile.toString());
63
- if (!response) {
64
- return;
65
- }
66
- classes.push(response);
67
- });
68
72
  return classes;
69
73
  }
@@ -12,7 +12,7 @@ beforeEach(() => {
12
12
  it('returns an empty list when there are no files', () => {
13
13
  (fs.readdirSync as jest.Mock).mockReturnValue([]);
14
14
 
15
- const classes = generate('src');
15
+ const classes = generate(['src']);
16
16
 
17
17
  expect(classes.length).toBe(0);
18
18
  });
@@ -20,7 +20,7 @@ it('returns an empty list when there are no files', () => {
20
20
  it('returns an empty list when there are no files ending in .cls', () => {
21
21
  (fs.readdirSync as jest.Mock).mockReturnValue(['file.xml', 'README.md']);
22
22
 
23
- const classes = generate('src', false);
23
+ const classes = generate(['src'], false);
24
24
 
25
25
  expect(classes.length).toBe(0);
26
26
  });
@@ -29,7 +29,7 @@ it('returns parsed files when there are .cls files', () => {
29
29
  (fs.readdirSync as jest.Mock).mockReturnValue(['TestClass.cls', 'README.md']);
30
30
  (fs.readFileSync as jest.Mock).mockReturnValue('Raw class data');
31
31
 
32
- generate('src', false);
32
+ generate(['src'], false);
33
33
 
34
34
  expect(FileParser).toHaveBeenCalledTimes(1);
35
35
  const mockFileParserInstance = (FileParser as jest.Mock).mock.instances[0];
@@ -6,10 +6,10 @@ import FileManager from '../FileManager';
6
6
 
7
7
  const argv = yargs.options({
8
8
  sourceDir: {
9
- type: 'string',
9
+ type: 'array',
10
10
  alias: 's',
11
11
  demandOption: true,
12
- describe: 'The directory location which contains your apex .cls classes.',
12
+ describe: 'The directory or directories location(s) which contains your apex .cls classes.',
13
13
  },
14
14
  targetDir: {
15
15
  type: 'string',