@cparra/apexdocs 2.2.1 → 2.2.4
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/.github/workflows/close_stale.yml +22 -0
- package/README.md +6 -21
- package/docs/README.md +5 -0
- package/docs/Sample-Classes/SampleClass.md +5 -0
- package/docs/Sample-Interfaces/SampleInterface.md +3 -0
- package/docs/Some-group/GroupedClass.md +7 -0
- package/docs/Utils/GroupedClass.md +10 -0
- package/docs/index.md +9 -0
- package/examples/force-app/main/default/classes/GroupedClass.cls +8 -0
- package/examples/force-app/main/default/classes/SampleClass.cls +9 -0
- package/lib/application/Apexdocs.js +3 -0
- package/lib/application/Apexdocs.js.map +1 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +8 -3
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
- package/lib/util/error-logger.d.ts +8 -0
- package/lib/util/error-logger.js +89 -0
- package/lib/util/error-logger.js.map +1 -0
- package/package.json +2 -2
- package/src/application/Apexdocs.ts +5 -1
- package/src/model/markdown-generation-util/doc-comment-annotation-util.ts +8 -3
- package/src/util/error-logger.ts +91 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Close inactive issues
|
|
2
|
+
on:
|
|
3
|
+
schedule:
|
|
4
|
+
- cron: "30 1 * * *"
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
close-issues:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
issues: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/stale@v4
|
|
14
|
+
with:
|
|
15
|
+
days-before-issue-stale: -1
|
|
16
|
+
days-before-issue-close: 30
|
|
17
|
+
stale-issue-label: "stale"
|
|
18
|
+
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
|
19
|
+
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
|
|
20
|
+
days-before-pr-stale: -1
|
|
21
|
+
days-before-pr-close: -1
|
|
22
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
package/README.md
CHANGED
|
@@ -207,23 +207,8 @@ the `Properties` title will be `<h2>`, each property name will be an `<h3>`, etc
|
|
|
207
207
|
|
|
208
208
|
### Importing to your project
|
|
209
209
|
|
|
210
|
-
If you are just interested in the
|
|
211
|
-
|
|
212
|
-
Use the `docGenerator` function to create a list of `ClassModel` that includes all the parsed information from your .cls
|
|
213
|
-
files.
|
|
214
|
-
|
|
215
|
-
`docGenerator(sourceDirectory[,recursive][,scope][,outputDir])`
|
|
216
|
-
|
|
217
|
-
- `sourceDirectory` \<string>
|
|
218
|
-
- `recursive` \<boolean>
|
|
219
|
-
- `scope` \<string[]>
|
|
220
|
-
- `outpurDir` \<string>
|
|
221
|
-
|
|
222
|
-
```javascript
|
|
223
|
-
var { docGenerator } = require('@cparra/apexdocs');
|
|
224
|
-
|
|
225
|
-
let documentedClasses = docGenerator('src', true, ['global'], 'docs');
|
|
226
|
-
```
|
|
210
|
+
If you are just interested in the Apex parsing capabilities, you can use the standalone [Apex Reflection Library](https://www.npmjs.com/package/@cparra/apex-reflection)
|
|
211
|
+
which is what gets used by this library behind the scenes to generate the documentation files.
|
|
227
212
|
|
|
228
213
|
## Documentation Format
|
|
229
214
|
|
|
@@ -235,7 +220,7 @@ multiple lines, ending with `*/`.
|
|
|
235
220
|
The following tags are supported on the class level:
|
|
236
221
|
|
|
237
222
|
| Tag | Description |
|
|
238
|
-
|
|
223
|
+
|----------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
|
239
224
|
| `@description` | One or more lines describing the class. |
|
|
240
225
|
| `@see` | The name of a related class. |
|
|
241
226
|
| `@group` | The group to which the class belongs to. |
|
|
@@ -257,7 +242,7 @@ public with sharing class TestClass {
|
|
|
257
242
|
The following tags are supported on the enum level:
|
|
258
243
|
|
|
259
244
|
| Tag | Description |
|
|
260
|
-
|
|
245
|
+
|----------------|----------------------------------------|
|
|
261
246
|
| `@description` | One or more lines describing the enum. |
|
|
262
247
|
|
|
263
248
|
**Example**
|
|
@@ -276,7 +261,7 @@ public Enum ExampleEnum {
|
|
|
276
261
|
The following tags are supported on the property level:
|
|
277
262
|
|
|
278
263
|
| Tag | Description |
|
|
279
|
-
|
|
264
|
+
|----------------|--------------------------------------------|
|
|
280
265
|
| `@description` | One or more lines describing the property. |
|
|
281
266
|
|
|
282
267
|
**Example**
|
|
@@ -295,7 +280,7 @@ Methods and constructors support the same tags.
|
|
|
295
280
|
The following tags are supported on the method level:
|
|
296
281
|
|
|
297
282
|
| Tag | Description |
|
|
298
|
-
|
|
283
|
+
|---------------------------|---------------------------------------------------|
|
|
299
284
|
| `@description` | One or more lines describing the method. |
|
|
300
285
|
| `@param` _paramName_ | Description of a single parameter. |
|
|
301
286
|
| `@return` | Description of the return value of the method. |
|
package/docs/README.md
CHANGED
|
@@ -113,6 +113,11 @@ String result = SampleClass.testMethod();
|
|
|
113
113
|
System.debug(result);
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### `static anotherSampleMethod(String arg1)`
|
|
117
|
+
#### Parameters
|
|
118
|
+
|Param|Description|
|
|
119
|
+
|---|---|
|
|
120
|
+
|
|
116
121
|
### `static call()`
|
|
117
122
|
|
|
118
123
|
Calls the method. This methods allows you to call it.
|
package/docs/index.md
ADDED
|
@@ -72,6 +72,15 @@ public with sharing class SampleClass {
|
|
|
72
72
|
return '';
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* @description Something here
|
|
77
|
+
* @arg1
|
|
78
|
+
*/
|
|
79
|
+
public static String anotherSampleMethod(String arg1) {
|
|
80
|
+
System.debug('something');
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
|
|
76
85
|
/**
|
|
77
86
|
* @description Calls the method.
|
|
@@ -11,6 +11,7 @@ const settings_1 = require("../settings");
|
|
|
11
11
|
const transpiler_1 = require("../transpiler/transpiler");
|
|
12
12
|
const file_writer_1 = require("../service/file-writer");
|
|
13
13
|
const types_repository_1 = require("../model/types-repository");
|
|
14
|
+
const error_logger_1 = require("../util/error-logger");
|
|
14
15
|
/**
|
|
15
16
|
* Application entry-point to generate documentation out of Apex source files.
|
|
16
17
|
*/
|
|
@@ -30,6 +31,8 @@ class Apexdocs {
|
|
|
30
31
|
file_writer_1.FileWriter.write(generatedFiles, (fileName) => {
|
|
31
32
|
logger_1.Logger.log(`${fileName} processed.`);
|
|
32
33
|
});
|
|
34
|
+
// Error logging
|
|
35
|
+
error_logger_1.default.logErrors(filteredTypes);
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
exports.Apexdocs = Apexdocs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Apexdocs.js","sourceRoot":"","sources":["../../src/application/Apexdocs.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAC7D,wDAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"Apexdocs.js","sourceRoot":"","sources":["../../src/application/Apexdocs.ts"],"names":[],"mappings":";;;AAAA,kEAA6D;AAC7D,wDAA2D;AAC3D,6DAAuF;AACvF,2CAAwC;AACxC,kEAA6D;AAC7D,8CAAkD;AAClD,0CAAuC;AACvC,yDAAkD;AAClD,wDAAoD;AACpD,gEAA4D;AAC5D,uDAA+C;AAE/C;;GAEG;AACH,MAAa,QAAQ;IACnB;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,MAAM,UAAU,GAAG,iCAAc,CAAC,YAAY,CAAC,IAAI,+BAAiB,EAAE,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,iCAAc,CAAC,IAAI,sBAAa,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAE3F,MAAM,aAAa,GAAW,QAAQ,CAAC,sCAAsC,CAAC,mBAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC;QAC5G,kCAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAEtD,eAAM,CAAC,GAAG,CAAC,UAAU,aAAa,CAAC,MAAM,QAAQ,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACxD,oBAAU,CAAC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QAC9C,MAAM,cAAc,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC;QACvD,wBAAU,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE;YACpD,eAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,aAAa,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,gBAAgB;QAChB,sBAAW,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC;;AArBH,4BA8BC;AAPQ,8BAAqB,GAAG,CAAC,eAAuB,EAAoB,EAAE;;IAC3E,MAAM,MAAM,GAAG,yBAAO,CAAC,eAAe,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,eAAM,CAAC,GAAG,CAAC,iBAAiB,MAAA,MAAM,CAAC,KAAK,0CAAE,OAAO,EAAE,CAAC,CAAC;KACtD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -9,15 +9,20 @@ function addCustomDocCommentAnnotations(markdownFile, docCommentAware) {
|
|
|
9
9
|
markdownFile.addText(buildDocAnnotationText(currentAnnotation));
|
|
10
10
|
markdownFile.addBlankLine();
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
|
|
12
|
+
function splitAndCapitalize(text) {
|
|
13
|
+
const words = text.split(/[-_]+/);
|
|
14
|
+
const capitalizedWords = [];
|
|
15
|
+
for (const word of words) {
|
|
16
|
+
capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
|
|
17
|
+
}
|
|
18
|
+
return capitalizedWords.join(' ');
|
|
14
19
|
}
|
|
15
20
|
function buildDocAnnotationText(annotation) {
|
|
16
21
|
let annotationBodyText = annotation.body;
|
|
17
22
|
if (annotation.name.toLowerCase() === 'see') {
|
|
18
23
|
annotationBodyText = class_file_generatorHelper_1.default.getFileLinkByTypeName(annotation.body);
|
|
19
24
|
}
|
|
20
|
-
return `**${
|
|
25
|
+
return `**${splitAndCapitalize(annotation.name)}** ${annotationBodyText}`;
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
exports.addCustomDocCommentAnnotations = addCustomDocCommentAnnotations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-comment-annotation-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/doc-comment-annotation-util.ts"],"names":[],"mappings":";;;AACA,qGAA4F;AAO5F,SAAgB,8BAA8B,CAAC,YAA0B,EAAE,eAAgC;;IACzG,MAAA,eAAe,CAAC,UAAU,0CAAE,WAAW,CACpC,MAAM,CAAC,CAAC,iBAAuC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,KAAK,aAAa,EAC5F,OAAO,CAAC,CAAC,iBAAuC,EAAE,EAAE;QACnD,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAChE,YAAY,CAAC,YAAY,EAAE,CAAC;IAC9B,CAAC,EAAE;IAEL,SAAS,
|
|
1
|
+
{"version":3,"file":"doc-comment-annotation-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/doc-comment-annotation-util.ts"],"names":[],"mappings":";;;AACA,qGAA4F;AAO5F,SAAgB,8BAA8B,CAAC,YAA0B,EAAE,eAAgC;;IACzG,MAAA,eAAe,CAAC,UAAU,0CAAE,WAAW,CACpC,MAAM,CAAC,CAAC,iBAAuC,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,KAAK,aAAa,EAC5F,OAAO,CAAC,CAAC,iBAAuC,EAAE,EAAE;QACnD,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAChE,YAAY,CAAC,YAAY,EAAE,CAAC;IAC9B,CAAC,EAAE;IAEL,SAAS,kBAAkB,CAAC,IAAY;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACrE;QACD,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAED,SAAS,sBAAsB,CAAC,UAAgC;QAC9D,IAAI,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC;QACzC,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,EAAE;YAC3C,kBAAkB,GAAG,oCAAwB,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SACtF;QACD,OAAO,KAAK,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,kBAAkB,EAAE,CAAC;IAC5E,CAAC;AACH,CAAC;AAzBD,wEAyBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Type } from '@cparra/apex-reflection';
|
|
2
|
+
export default class ErrorLogger {
|
|
3
|
+
static logErrors(types: Type[]): void;
|
|
4
|
+
private static logErrorsForSingleType;
|
|
5
|
+
private static logTypeErrors;
|
|
6
|
+
private static logErrorsForClass;
|
|
7
|
+
private static logErrorsForInterface;
|
|
8
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ErrorLogger {
|
|
4
|
+
static logErrors(types) {
|
|
5
|
+
types.forEach((currentType) => {
|
|
6
|
+
this.logErrorsForSingleType(currentType);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
static logErrorsForSingleType(currentType, parentType) {
|
|
10
|
+
this.logTypeErrors(currentType);
|
|
11
|
+
if (currentType.type_name === 'class') {
|
|
12
|
+
this.logErrorsForClass(currentType);
|
|
13
|
+
}
|
|
14
|
+
else if (currentType.type_name === 'interface') {
|
|
15
|
+
this.logErrorsForInterface(currentType);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static logTypeErrors(currentType, parentType) {
|
|
19
|
+
var _a;
|
|
20
|
+
if ((_a = currentType.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
21
|
+
const typeName = parentType ? `${parentType.name}.${currentType.name}` : currentType.name;
|
|
22
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Type`);
|
|
23
|
+
console.log(`Comment:\n ${currentType.docComment.rawDeclaration}`);
|
|
24
|
+
console.log(currentType.docComment.error);
|
|
25
|
+
console.log('=================================');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
static logErrorsForClass(classMirror, parentType) {
|
|
29
|
+
const typeName = parentType ? `${parentType.name}.${classMirror.name}` : classMirror.name;
|
|
30
|
+
classMirror.constructors.forEach((currentConstructor) => {
|
|
31
|
+
var _a;
|
|
32
|
+
if ((_a = currentConstructor.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
33
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Constructor`);
|
|
34
|
+
console.log(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
|
|
35
|
+
console.log(currentConstructor.docComment.error);
|
|
36
|
+
console.log('=================================');
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
classMirror.fields.forEach((currentField) => {
|
|
40
|
+
var _a;
|
|
41
|
+
if ((_a = currentField.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
42
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Field`);
|
|
43
|
+
console.log(`Comment:\n ${currentField.docComment.rawDeclaration}`);
|
|
44
|
+
console.log(currentField.docComment.error);
|
|
45
|
+
console.log('=================================');
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
classMirror.properties.forEach((currentProperty) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if ((_a = currentProperty.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
51
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Property`);
|
|
52
|
+
console.log(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
|
|
53
|
+
console.log(currentProperty.docComment.error);
|
|
54
|
+
console.log('=================================');
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
classMirror.methods.forEach((currentMethod) => {
|
|
58
|
+
var _a;
|
|
59
|
+
if ((_a = currentMethod.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
60
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Method`);
|
|
61
|
+
console.log(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
|
|
62
|
+
console.log(currentMethod.docComment.error);
|
|
63
|
+
console.log('=================================');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
classMirror.enums.forEach((currentEnum) => {
|
|
67
|
+
this.logErrorsForSingleType(currentEnum, classMirror);
|
|
68
|
+
});
|
|
69
|
+
classMirror.interfaces.forEach((currentInterface) => {
|
|
70
|
+
this.logErrorsForSingleType(currentInterface, classMirror);
|
|
71
|
+
});
|
|
72
|
+
classMirror.classes.forEach((currentClass) => {
|
|
73
|
+
this.logErrorsForSingleType(currentClass, classMirror);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
static logErrorsForInterface(interfaceMirror) {
|
|
77
|
+
interfaceMirror.methods.forEach((currentMethod) => {
|
|
78
|
+
var _a;
|
|
79
|
+
if ((_a = currentMethod.docComment) === null || _a === void 0 ? void 0 : _a.error) {
|
|
80
|
+
console.log(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
|
|
81
|
+
console.log(`Comment: ${currentMethod.docComment.rawDeclaration}`);
|
|
82
|
+
console.log(currentMethod.docComment.error);
|
|
83
|
+
console.log('=================================');
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = ErrorLogger;
|
|
89
|
+
//# sourceMappingURL=error-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-logger.js","sourceRoot":"","sources":["../../src/util/error-logger.ts"],"names":[],"mappings":";;AAEA,MAAqB,WAAW;IACvB,MAAM,CAAC,SAAS,CAAC,KAAa;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YAC5B,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,WAAiB,EAAE,UAAiB;QACxE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAEhC,IAAI,WAAW,CAAC,SAAS,KAAK,OAAO,EAAE;YACrC,IAAI,CAAC,iBAAiB,CAAC,WAA0B,CAAC,CAAC;SACpD;aAAM,IAAI,WAAW,CAAC,SAAS,KAAK,WAAW,EAAE;YAChD,IAAI,CAAC,qBAAqB,CAAC,WAA8B,CAAC,CAAC;SAC5D;IACH,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,WAAiB,EAAE,UAAiB;;QAC/D,UAAI,WAAW,CAAC,UAAU,0CAAE,KAAK,EAAE;YACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAW,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC;YAC3F,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,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H,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;YAC3C,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,eAAgC;QACnE,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;;YAChD,UAAI,aAAa,CAAC,UAAU,0CAAE,KAAK,EAAE;gBACnC,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,IAAI,6CAA6C,CAAC,CAAC;gBAClF,OAAO,CAAC,GAAG,CAAC,YAAY,aAAa,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;gBACnE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC5C,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;aAClD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxFD,8BAwFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@cparra/apex-reflection": "^1.
|
|
67
|
+
"@cparra/apex-reflection": "^1.5.0",
|
|
68
68
|
"fast-xml-parser": "^4.0.1",
|
|
69
69
|
"chalk": "^4.1.2",
|
|
70
70
|
"html-entities": "^2.3.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApexFileReader } from '../service/apex-file-reader';
|
|
2
2
|
import { DefaultFileSystem } from '../service/file-system';
|
|
3
|
-
import { ReflectionResult, reflect, Type } from '@cparra/apex-reflection';
|
|
3
|
+
import { ReflectionResult, reflect, Type, ClassMirror } from '@cparra/apex-reflection';
|
|
4
4
|
import { Logger } from '../util/logger';
|
|
5
5
|
import { createManifest } from '../service/manifest-factory';
|
|
6
6
|
import { RawBodyParser } from '../service/parser';
|
|
@@ -8,6 +8,7 @@ import { Settings } from '../settings';
|
|
|
8
8
|
import Transpiler from '../transpiler/transpiler';
|
|
9
9
|
import { FileWriter } from '../service/file-writer';
|
|
10
10
|
import { TypesRepository } from '../model/types-repository';
|
|
11
|
+
import ErrorLogger from '../util/error-logger';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Application entry-point to generate documentation out of Apex source files.
|
|
@@ -30,6 +31,9 @@ export class Apexdocs {
|
|
|
30
31
|
FileWriter.write(generatedFiles, (fileName: string) => {
|
|
31
32
|
Logger.log(`${fileName} processed.`);
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
// Error logging
|
|
36
|
+
ErrorLogger.logErrors(filteredTypes);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
static _reflectionWithLogger = (declarationBody: string): ReflectionResult => {
|
|
@@ -15,8 +15,13 @@ export function addCustomDocCommentAnnotations(markdownFile: MarkdownFile, docCo
|
|
|
15
15
|
markdownFile.addBlankLine();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function splitAndCapitalize(text: string) {
|
|
19
|
+
const words = text.split(/[-_]+/);
|
|
20
|
+
const capitalizedWords = [];
|
|
21
|
+
for (const word of words) {
|
|
22
|
+
capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
|
|
23
|
+
}
|
|
24
|
+
return capitalizedWords.join(' ');
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
function buildDocAnnotationText(annotation: DocCommentAnnotation) {
|
|
@@ -24,6 +29,6 @@ export function addCustomDocCommentAnnotations(markdownFile: MarkdownFile, docCo
|
|
|
24
29
|
if (annotation.name.toLowerCase() === 'see') {
|
|
25
30
|
annotationBodyText = ClassFileGeneratorHelper.getFileLinkByTypeName(annotation.body);
|
|
26
31
|
}
|
|
27
|
-
return `**${
|
|
32
|
+
return `**${splitAndCapitalize(annotation.name)}** ${annotationBodyText}`;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ClassMirror, InterfaceMirror, Type } from '@cparra/apex-reflection';
|
|
2
|
+
|
|
3
|
+
export default class ErrorLogger {
|
|
4
|
+
public static logErrors(types: Type[]): void {
|
|
5
|
+
types.forEach((currentType) => {
|
|
6
|
+
this.logErrorsForSingleType(currentType);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
private static logErrorsForSingleType(currentType: Type, parentType?: Type): void {
|
|
11
|
+
this.logTypeErrors(currentType);
|
|
12
|
+
|
|
13
|
+
if (currentType.type_name === 'class') {
|
|
14
|
+
this.logErrorsForClass(currentType as ClassMirror);
|
|
15
|
+
} else if (currentType.type_name === 'interface') {
|
|
16
|
+
this.logErrorsForInterface(currentType as InterfaceMirror);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private static logTypeErrors(currentType: Type, parentType?: Type) {
|
|
21
|
+
if (currentType.docComment?.error) {
|
|
22
|
+
const typeName = parentType ? `${parentType!.name}.${currentType.name}` : currentType.name;
|
|
23
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Type`);
|
|
24
|
+
console.log(`Comment:\n ${currentType.docComment.rawDeclaration}`);
|
|
25
|
+
console.log(currentType.docComment.error);
|
|
26
|
+
console.log('=================================');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private static logErrorsForClass(classMirror: ClassMirror, parentType?: Type): void {
|
|
31
|
+
const typeName = parentType ? `${parentType!.name}.${classMirror.name}` : classMirror.name;
|
|
32
|
+
classMirror.constructors.forEach((currentConstructor) => {
|
|
33
|
+
if (currentConstructor.docComment?.error) {
|
|
34
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Constructor`);
|
|
35
|
+
console.log(`Comment:\n ${currentConstructor.docComment.rawDeclaration}`);
|
|
36
|
+
console.log(currentConstructor.docComment.error);
|
|
37
|
+
console.log('=================================');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
classMirror.fields.forEach((currentField) => {
|
|
42
|
+
if (currentField.docComment?.error) {
|
|
43
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Field`);
|
|
44
|
+
console.log(`Comment:\n ${currentField.docComment.rawDeclaration}`);
|
|
45
|
+
console.log(currentField.docComment.error);
|
|
46
|
+
console.log('=================================');
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
classMirror.properties.forEach((currentProperty) => {
|
|
51
|
+
if (currentProperty.docComment?.error) {
|
|
52
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Property`);
|
|
53
|
+
console.log(`Comment:\n ${currentProperty.docComment.rawDeclaration}`);
|
|
54
|
+
console.log(currentProperty.docComment.error);
|
|
55
|
+
console.log('=================================');
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
classMirror.methods.forEach((currentMethod) => {
|
|
60
|
+
if (currentMethod.docComment?.error) {
|
|
61
|
+
console.log(`${typeName} - Doc comment parsing error. Level: Method`);
|
|
62
|
+
console.log(`Comment:\n ${currentMethod.docComment.rawDeclaration}`);
|
|
63
|
+
console.log(currentMethod.docComment.error);
|
|
64
|
+
console.log('=================================');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
classMirror.enums.forEach((currentEnum) => {
|
|
69
|
+
this.logErrorsForSingleType(currentEnum, classMirror);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
classMirror.interfaces.forEach((currentInterface) => {
|
|
73
|
+
this.logErrorsForSingleType(currentInterface, classMirror);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
classMirror.classes.forEach((currentClass) => {
|
|
77
|
+
this.logErrorsForSingleType(currentClass, classMirror);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private static logErrorsForInterface(interfaceMirror: InterfaceMirror): void {
|
|
82
|
+
interfaceMirror.methods.forEach((currentMethod) => {
|
|
83
|
+
if (currentMethod.docComment?.error) {
|
|
84
|
+
console.log(`${interfaceMirror.name} - Doc comment parsing error. Level: Method`);
|
|
85
|
+
console.log(`Comment: ${currentMethod.docComment.rawDeclaration}`);
|
|
86
|
+
console.log(currentMethod.docComment.error);
|
|
87
|
+
console.log('=================================');
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|