@cparra/apexdocs 2.19.0-alpha.4 → 2.20.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
@@ -25,14 +25,11 @@ There are some key differences between ApexDocs and the Java based ApexDoc tool:
25
25
  Markdown like Github Pages or Netlify, and use site generators like Jekyll or Gatsby. This gives you the freedom to
26
26
  decide how to style your site to match your needs.
27
27
 
28
- #### New features
29
-
30
- * All Apex annotations are now supported through the `--scope` CLI parameter, not just `namespaceaccessible`. This means
31
- that scopes like `auraenabled`, `invocablemethod`, `invocablevariable`, `remoteaction`, and all other valid Apex
32
- annotations are supported.
33
- * Just like Javadoc, both `@throws` and `@exception` are supported when referencing an exception thrown by a method or
34
- constructor.
35
- * Any custom annotation defined in the Apexdoc is at the class level are supported, for example the following will be
28
+ #### Features
29
+
30
+ * Custom Annotations
31
+
32
+ Any custom annotation defined in the Apexdoc is at the class level are supported, for example the following will be
36
33
  output to the resulting markdown file:
37
34
 
38
35
  ```apex
@@ -43,7 +40,7 @@ public class MyClass {
43
40
  }
44
41
  ```
45
42
 
46
- * Apex docs blocks can now all be in a single line
43
+ * Single Line ApexDoc Blocks
47
44
 
48
45
  📒 Note: If you wish to have multiple `@` tags in a single line but don't want them to be treated as ApexDoc annotations, you can
49
46
  escape them by adding wrapping the annotation in ticks, for example
@@ -59,6 +56,7 @@ escape them by adding wrapping the annotation in ticks, for example
59
56
  * OpenApi REST specification generation
60
57
  * Support for ignoring files and members from being documented
61
58
  * Namespace support
59
+ * Configuration file support
62
60
  * And much, much more!
63
61
 
64
62
  ### Demo
@@ -68,6 +66,7 @@ files.
68
66
 
69
67
  ### In the wild
70
68
 
69
+ - [Expression](https://cesarparra.github.io/expression/)
71
70
  - [Nimble AMS Docs](https://nimbleuser.github.io/nams-api-docs/#/api-reference/)
72
71
  - [Yet Another Salesforce Logger](https://cesarparra.github.io/yet-another-salesforce-logger/#/)
73
72
 
@@ -120,6 +119,44 @@ The CLI supports the following parameters:
120
119
  | --includeMetadata | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | false | No |
121
120
  | --documentationRootDir | N/A | The root directory where the documentation will be generated. This is useful when you want to generate the documentation in a subdirectory of your project. | N/A | No |
122
121
 
122
+ ### Using a configuration file
123
+
124
+ You can also use a configuration file to define the parameters that will be used when generating the documentation. Apexdocs
125
+ uses [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) to load the configuration file, which means it supports
126
+ the following formats:
127
+
128
+ - A `package.json` property, e.g. `{ "apexdocs": { "sourceDir": "src", "targetDir": "docs" } }`
129
+ - A `.apexdocsrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`
130
+ - An `apexdocs.config.js` file that exports an object
131
+ - A `apexdocs.config.ts` file that exports an object
132
+
133
+ The configuration file should be placed in the root directory of your project.
134
+
135
+ **Note that when using a configuration file, you can still override any of the parameters by passing them through the CLI.**
136
+
137
+ When defining a `.js` or `.ts` configuration file, your object export can also contain the following functions that will
138
+ allow you to override some of the default behavior:
139
+
140
+ - `onBeforeFileWrite` - A function that will be called before a file is written to disk. It receives a `TargetFile` object
141
+ that contains the file's content, path, and name, etc. It should return a `TargetFile` object with the updated content.
142
+ The full object definition can be imported from `@cparra/apexdocs/lib/settings`
143
+ - `onAfterProcess` - A function that will be called after all files have been processed. It receives a `TargetFile[]` array
144
+ with all of the files that were processed and does not return anything.
145
+
146
+ ```typescript
147
+ import {TargetFile} from "@cparra/apexdocs/lib/settings";
148
+ export default {
149
+ onBeforeFileWrite: (file: TargetFile): TargetFile => {
150
+ console.log('onBefore writing', file);
151
+ return file;
152
+ },
153
+ onAfterProcess: (files: TargetFile[]) => {
154
+ console.log('onAfterProcess files', files);
155
+ },
156
+ };
157
+
158
+ ```
159
+
123
160
  ### Importing to your project
124
161
 
125
162
  If you are just interested in the Apex parsing capabilities, you can use the
@@ -1,11 +1,11 @@
1
- import { TargetFile } from './src/settings';
2
-
3
- export default {
4
- onBeforeFileWrite: (file: TargetFile): TargetFile => {
5
- console.log('onBefore writing', file);
6
- return file;
7
- },
8
- onAfterProcess: (files: TargetFile[]) => {
9
- console.log('onAfterProcess files', files);
10
- },
11
- };
1
+ import { TargetFile } from './src/settings';
2
+
3
+ export default {
4
+ onBeforeFileWrite: (file: TargetFile): TargetFile => {
5
+ console.log('onBefore writing', file);
6
+ return file;
7
+ },
8
+ onAfterProcess: (files: TargetFile[]) => {
9
+ console.log('onAfterProcess files', files);
10
+ },
11
+ };
package/lib/settings.d.ts CHANGED
@@ -5,10 +5,6 @@ export type TargetFile = {
5
5
  extension: string;
6
6
  dir: OutputDir;
7
7
  };
8
- export type TargetLocation = {
9
- dir: string;
10
- fileName: string;
11
- };
12
8
  export type OutputDir = {
13
9
  baseDir: string;
14
10
  fileDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAuCA,MAAa,QAAQ;IAGnB,YAA2B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C,MAAM,CAAC,KAAK,CAAC,MAAsB;QACxC,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;SACtD;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,M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AAM,CAAC,YAAY,mCAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IACvD,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAEM,kBAAkB;QACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC1B,OAAO,EAAE,CAAC;SACX;QACD,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,CAAC;IACrC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAEM,cAAc,CAAC,KAAmB;QACvC,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;YAC9B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;SACnC;IACH,CAAC;IAEM,iBAAiB,CAAC,IAAgB;QACvC,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;YACjC,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;SAC5C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3FD,4BA2FC"}
@@ -39,7 +39,7 @@ class OpenApiDocsProcessor extends processor_type_transpiler_1.default {
39
39
  // We can safely cast to a ClassMirror, since only these support the @RestResource annotation
40
40
  const typeAsClass = type;
41
41
  // Add tags for this Apex class to the OpenApi model
42
- const tagName = (0, string_utils_1.camel2title)(endpointPath.replaceAll('/', ''));
42
+ const tagName = (0, string_utils_1.camel2title)(endpointPath);
43
43
  this.openApiModel.tags.push({
44
44
  name: tagName,
45
45
  description: (_b = type.docComment) === null || _b === void 0 ? void 0 : _b.description,
@@ -1 +1 @@
1
- {"version":3,"file":"open-api-docs-processor.js","sourceRoot":"","sources":["../../../src/transpiler/openapi/open-api-docs-processor.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AACnE,sDAAkD;AAElD,6EAAwE;AACxE,8CAA2C;AAC3C,2DAAuD;AACvD,6CAA0C;AAC1C,yDAAsD;AACtD,0DAAsD;AAEtD,MAAa,oBAAqB,SAAQ,mCAAuB;IAI/D;QACE,KAAK,EAAE,CAAC;QAsDV,mBAAc,GAA0C,GAAG,EAAE;YAC3D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,mCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC;QAvDA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,eAAe,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;SAC/C;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,kBAAO,CAAC,KAAK,EAAE,OAAO,EAAE,mBAAQ,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,IAAU;;QAClB,eAAM,CAAC,SAAS,CAAC,cAAc,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEnE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;SACR;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC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AAC,CAAC;QACjH,MAAM,UAAU,GAAG,MAAA,sBAAsB,aAAtB,sBAAsB,uBAAtB,sBAAsB,CAAE,aAAa,0CAAE,IAAI,CAC5D,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,YAAY,CACxD,CAAC;QACF,IAAI,CAAC,UAAU,EAAE;YACf,eAAM,CAAC,KAAK,CAAC,+CAA+C,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACzE,OAAO,IAAI,CAAC;SACb;QAED,IAAI,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAClG,IAAI,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAChC,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AA/ED,oDA+EC"}
1
+ {"version":3,"file":"open-api-docs-processor.js","sourceRoot":"","sources":["../../../src/transpiler/openapi/open-api-docs-processor.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AACnE,sDAAkD;AAElD,6EAAwE;AACxE,8CAA2C;AAC3C,2DAAuD;AACvD,6CAA0C;AAC1C,yDAAsD;AACtD,0DAAsD;AAEtD,MAAa,oBAAqB,SAAQ,mCAAuB;IAI/D;QACE,KAAK,EAAE,CAAC;QAsDV,mBAAc,GAA0C,GAAG,EAAE;YAC3D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,mCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC;QAvDA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,mBAAQ,CAAC,WAAW,EAAE,CA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tB,CAAC;CACF;AA/ED,oDA+EC"}
@@ -6,7 +6,9 @@ function truncate(str, n) {
6
6
  }
7
7
  exports.truncate = truncate;
8
8
  const camel2title = (camelCase) => camelCase
9
+ .replace(/\//g, ' ')
9
10
  .replace(/([A-Z])/g, (match) => ` ${match}`)
11
+ .replace(/\b\w/g, (match) => match.toUpperCase())
10
12
  .replace(/^./, (match) => match.toUpperCase())
11
13
  .trim();
12
14
  exports.camel2title = camel2title;
@@ -1 +1 @@
1
- {"version":3,"file":"string-utils.js","sourceRoot":"","sources":["../../src/util/string-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAW,EAAE,CAAS;IAC7C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAFD,4BAEC;AAEM,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,EAAE,CAC/C,SAAS;KACN,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;KAC3C,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;KAC7C,IAAI,EAAE,CAAC;AAJC,QAAA,WAAW,eAIZ"}
1
+ {"version":3,"file":"string-utils.js","sourceRoot":"","sources":["../../src/util/string-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAW,EAAE,CAAS;IAC7C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC;AAFD,4BAEC;AAEM,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAE,EAAE,CAC/C,SAAS;KACN,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;KACnB,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;KAC3C,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;KAChD,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;KAC7C,IAAI,EAAE,CAAC;AANC,QAAA,WAAW,eAMZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cparra/apexdocs",
3
- "version": "2.19.0-alpha.4",
3
+ "version": "2.20.0",
4
4
  "description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
5
5
  "keywords": [
6
6
  "apex",
@@ -66,7 +66,7 @@
66
66
  ]
67
67
  },
68
68
  "dependencies": {
69
- "@cparra/apex-reflection": "2.5.0",
69
+ "@cparra/apex-reflection": "2.6.0",
70
70
  "chalk": "^4.1.2",
71
71
  "cosmiconfig": "^9.0.0",
72
72
  "fast-xml-parser": "^4.0.1",
package/src/settings.ts CHANGED
@@ -8,11 +8,6 @@ export type TargetFile = {
8
8
  dir: OutputDir;
9
9
  };
10
10
 
11
- export type TargetLocation = {
12
- dir: string;
13
- fileName: string;
14
- };
15
-
16
11
  export type OutputDir = {
17
12
  baseDir: string;
18
13
  fileDir: string;
@@ -24,6 +24,21 @@ it('should add a path based on the @UrlResource annotation on the class', functi
24
24
  expect(processor.openApiModel.paths).toHaveProperty('Account/');
25
25
  });
26
26
 
27
+ it('should respect slashes', function () {
28
+ const annotationElementValue = {
29
+ key: 'urlMapping',
30
+ value: "'v1/Account/*'",
31
+ };
32
+ const classMirror = new ClassMirrorBuilder()
33
+ .addAnnotation(new AnnotationBuilder().addElementValue(annotationElementValue).build())
34
+ .build();
35
+
36
+ const processor = new OpenApiDocsProcessor();
37
+ processor.onProcess(classMirror);
38
+
39
+ expect(processor.openApiModel.paths).toHaveProperty('v1/Account/');
40
+ });
41
+
27
42
  it('should contain a path with a description when the class has an ApexDoc comment', function () {
28
43
  const annotationElementValue = {
29
44
  key: 'urlMapping',
@@ -43,7 +43,7 @@ export class OpenApiDocsProcessor extends ProcessorTypeTranspiler {
43
43
  const typeAsClass = type as ClassMirror;
44
44
 
45
45
  // Add tags for this Apex class to the OpenApi model
46
- const tagName = camel2title(endpointPath.replaceAll('/', ''));
46
+ const tagName = camel2title(endpointPath);
47
47
  this.openApiModel.tags.push({
48
48
  name: tagName,
49
49
  description: type.docComment?.description,
@@ -4,6 +4,8 @@ export function truncate(str: string, n: number) {
4
4
 
5
5
  export const camel2title = (camelCase: string) =>
6
6
  camelCase
7
+ .replace(/\//g, ' ')
7
8
  .replace(/([A-Z])/g, (match) => ` ${match}`)
9
+ .replace(/\b\w/g, (match) => match.toUpperCase())
8
10
  .replace(/^./, (match) => match.toUpperCase())
9
11
  .trim();