@cparra/apexdocs 2.19.0-alpha.4 → 2.19.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 +45 -9
- package/lib/settings.d.ts +0 -4
- package/lib/settings.js.map +1 -1
- package/package.json +1 -1
- package/src/settings.ts +0 -5
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
|
-
####
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
*
|
|
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
|
|
@@ -120,6 +118,44 @@ The CLI supports the following parameters:
|
|
|
120
118
|
| --includeMetadata | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | false | No |
|
|
121
119
|
| --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
120
|
|
|
121
|
+
### Using a configuration file
|
|
122
|
+
|
|
123
|
+
You can also use a configuration file to define the parameters that will be used when generating the documentation. Apexdocs
|
|
124
|
+
uses [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) to load the configuration file, which means it supports
|
|
125
|
+
the following formats:
|
|
126
|
+
|
|
127
|
+
- A `package.json` property, e.g. `{ "apexdocs": { "sourceDir": "src", "targetDir": "docs" } }`
|
|
128
|
+
- A `.apexdocsrc` file, written in YAML or JSON, with optional extensions: `.yaml/.yml/.json/.js`
|
|
129
|
+
- An `apexdocs.config.js` file that exports an object
|
|
130
|
+
- A `apexdocs.config.ts` file that exports an object
|
|
131
|
+
|
|
132
|
+
The configuration file should be placed in the root directory of your project.
|
|
133
|
+
|
|
134
|
+
**Note that when using a configuration file, you can still override any of the parameters by passing them through the CLI.**
|
|
135
|
+
|
|
136
|
+
When defining a `.js` or `.ts` configuration file, your object export can also contain the following functions that will
|
|
137
|
+
allow you to override some of the default behavior:
|
|
138
|
+
|
|
139
|
+
- `onBeforeFileWrite` - A function that will be called before a file is written to disk. It receives a `TargetFile` object
|
|
140
|
+
that contains the file's content, path, and name, etc. It should return a `TargetFile` object with the updated content.
|
|
141
|
+
The full object definition can be imported from `@cparra/apexdocs/lib/settings`
|
|
142
|
+
- `onAfterProcess` - A function that will be called after all files have been processed. It receives a `TargetFile[]` array
|
|
143
|
+
with all of the files that were processed and does not return anything.
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import {TargetFile} from "@cparra/apexdocs/lib/settings";
|
|
147
|
+
export default {
|
|
148
|
+
onBeforeFileWrite: (file: TargetFile): TargetFile => {
|
|
149
|
+
console.log('onBefore writing', file);
|
|
150
|
+
return file;
|
|
151
|
+
},
|
|
152
|
+
onAfterProcess: (files: TargetFile[]) => {
|
|
153
|
+
console.log('onAfterProcess files', files);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
|
|
123
159
|
### Importing to your project
|
|
124
160
|
|
|
125
161
|
If you are just interested in the Apex parsing capabilities, you can use the
|
package/lib/settings.d.ts
CHANGED
package/lib/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAkCA,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,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;IACrC,CAAC;IAED,IAAI,SAAS;Q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