Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 27 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,23 @@ apexdocs-generate

The CLI supports the following parameters:

| Parameter | Alias | Description | Default | Required |
|------------------------|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|----------|
| --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
| --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private. Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource. | `global` | No |
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports: `jekyll`, `docsify`, `plain-markdown`, and `openapi`. | `jekyll` | No |
| --indexOnly | N/A | Defines whether only the index file should be generated. | `false` | No |
| --defaultGroupName | N/A | Defines the `@group` name to be used when a file does not specify it. | `Miscellaneous` | No |
| --sanitizeHtml | N/A | When on, any special character within your ApexDocs is converted into its HTML code representation. This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" because otherwise the content within < and > would be treated as HTML tags and not shown in the output. Content in @example blocks are never sanitized. | `Apex REST Api` | No |
| --openApiTitle | N/A | If using "openapi" as the target generator, this allows you to specify the OpenApi title value. | true | No |
| --title | N/A | Allows you to specify the home page main title. If using "openapi" this acts as an alias to the openApiTitle parameter | `Classes` | No |
| --namespace | N/A | The package namespace, if any. If this value is provided the namespace will be added as a prefix to all of the parsed files. If generating an OpenApi definition, it will be added to the file's Server Url. | N/A | No |
| --openApiFileName | N/A | If using "openapi" as the target generator, this allows you to specify the name of the output file. | `openapi` | No |
| --includeMetadata | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | false | No |
| --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 |
| Parameter | Alias | Description | Default | Required |
|-----------------------------|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|----------|
| --sourceDir | -s | The directory location which contains your apex .cls classes. | N/A | Yes |
| --targetDir | -t | The directory location where documentation will be generated to. | `docs` | No |
| --recursive | -r | Whether .cls classes will be searched for recursively in the directory provided. | `true` | No |
| --scope | -p | A list of scopes to document. Values should be separated by a space, e.g --scope public private. Note that this setting is ignored if generating an OpenApi REST specification since that looks for classes annotated with @RestResource. | `global` | No |
| --targetGenerator | -g | Define the static file generator for which the documents will be created. Currently supports: `jekyll`, `docsify`, `plain-markdown`, and `openapi`. | `jekyll` | No |
| --indexOnly | N/A | Defines whether only the index file should be generated. | `false` | No |
| --defaultGroupName | N/A | Defines the `@group` name to be used when a file does not specify it. | `Miscellaneous` | No |
| --sanitizeHtml | N/A | When on, any special character within your ApexDocs is converted into its HTML code representation. This is specially useful when generic objects are described within the docs, e.g. "List< Foo>", "Map<Foo, Bar>" because otherwise the content within < and > would be treated as HTML tags and not shown in the output. Content in @example blocks are never sanitized. | `Apex REST Api` | No |
| --openApiTitle | N/A | If using "openapi" as the target generator, this allows you to specify the OpenApi title value. | true | No |
| --title | N/A | Allows you to specify the home page main title. If using "openapi" this acts as an alias to the openApiTitle parameter | `Classes` | No |
| --namespace | N/A | The package namespace, if any. If this value is provided the namespace will be added as a prefix to all of the parsed files. If generating an OpenApi definition, it will be added to the file's Server Url. | N/A | No |
| --openApiFileName | N/A | If using "openapi" as the target generator, this allows you to specify the name of the output file. | `openapi` | No |
| --sortMembersAlphabetically | N/A | Whether to sort the members of a class alphabetically. | `false` | No |
| --includeMetadata | N/A | Whether to include the file's meta.xml information: Whether it is active and and the API version | false | No |
| --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 |

### Using a configuration file

Expand All @@ -142,6 +143,16 @@ allow you to override some of the default behavior:
The full object definition can be imported from `@cparra/apexdocs/lib/settings`
- `onAfterProcess` - A function that will be called after all files have been processed. It receives a `TargetFile[]` array
with all of the files that were processed and does not return anything.
- `frontMatterHeader` - A function that will be called before the front matter is written to the file (when using the Jekyll generator).
It receives a `TargetType` object
and should return a list of strings that will be written to the file as the front matter.
The full object definition can be imported from `@cparra/apexdocs/lib/settings`
and contains the following properties:
- `name` - The name of the type
- `typeName` - Can be 'class', 'interface', or 'enum'
- `accessModifier` - The access modifier of the type
- `group` - The group to which the type belongs (if any)
- `description` - The description of the type as defined in the ApexDoc

```typescript
import {TargetFile} from "@cparra/apexdocs/lib/settings";
Expand Down
16 changes: 0 additions & 16 deletions ROADMAP.md

This file was deleted.

4 changes: 3 additions & 1 deletion apexdocs.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TargetFile } from './src/settings';
import { TargetFile, TargetType } from './src/settings';

export default {
onBeforeFileWrite: (file: TargetFile): TargetFile => {
Expand All @@ -8,4 +8,6 @@ export default {
onAfterProcess: (files: TargetFile[]) => {
console.log('onAfterProcess files', files);
},
frontMatterHeader: (file: TargetType) => [`title: ${file.name}.cls`, `description: ${file.description}`],
sortMembersAlphabetically: true,
};
39 changes: 21 additions & 18 deletions docs/types/Classes/nspc.ChildClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ ChildClass

## Fields

### `private aPrivateString` → `String`


### `private privateStringFromChild` → `String`


Expand Down Expand Up @@ -48,6 +51,24 @@ This is a protected string, use carefully.
---
## Methods
### `public void doSomething()`
### `public void execute()`

Executes the command.

### `public String getValue()`

Returns a value based on the executed command.

#### Returns

|Type|Description|
|---|---|
|`String`|The value|

### `public virtual String overridableMethod()`

*Inherited*

### `public override String overridableMethodOverridden()`

This method was overridden.
Expand All @@ -73,22 +94,4 @@ sequenceDiagram
```


### `public void execute()`

Executes the command.

### `public String getValue()`

Returns a value based on the executed command.

#### Returns

|Type|Description|
|---|---|
|`String`|The value|

### `public virtual String overridableMethod()`

*Inherited*

---
26 changes: 13 additions & 13 deletions docs/types/Main/nspc.SampleClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ Constructs a SampleClass with an argument.
## Fields
### Common Constants

* `public ANOTHER_CONSTANT` → `String`
* `public A_CONSTANT` → `String` [`NAMESPACEACCESSIBLE` ] - This is a constant.
* `public ANOTHER_CONSTANT` → `String`
* `public listOfStrings` → `List<String>`
---
### 'General' Constants

* `public GENERAL_ANOTHER_CONSTANT` → `String`
* `public GENERAL_A_CONSTANT` → `String` [`NAMESPACEACCESSIBLE` ] - This is a constant.
---
### Other variables

* `public someVariable` → `String`
* `public GENERAL_ANOTHER_CONSTANT` → `String`
---
### Other

* `private somePrivateStuff` → `String`
---
### Other variables

* `public someVariable` → `String`
---
## Properties

### `public AnotherProp` → `Decimal`
Expand All @@ -97,6 +97,13 @@ This is a String property.
---
## Methods
### A method group
##### `public static String anotherSampleMethod(String arg1)`

Something here


**Arg1** The arg1 description

##### `public static String sampleMethod(String argument1, String argument2)`

`NAMESPACEACCESSIBLE`
Expand All @@ -123,13 +130,6 @@ System.debug(result);
```


##### `public static String anotherSampleMethod(String arg1)`

Something here


**Arg1** The arg1 description

##### `public static Map<Id,List<String>> yetAnotherSampleMethod(String arg1)`
---
### Other
Expand Down
1 change: 1 addition & 0 deletions examples/force-app/main/default/classes/ChildClass.cls
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
public class ChildClass extends ParentClass implements SampleInterface {
private String privateStringFromChild;
private String aPrivateString;

public void doSomething() {
System.debug('Do something');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cparra/apexdocs",
"version": "2.22.0",
"version": "2.23.0",
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
"keywords": [
"apex",
Expand All @@ -18,7 +18,7 @@
"scripts": {
"test": "jest --coverage",
"build": "rimraf ./lib && npm run lint && tsc --declaration",
"lint": "eslint ./src/**/*.{js,ts} --quiet --fix",
"lint": "eslint './src/**/*.{js,ts}' --quiet --fix",
"prepare": "npm run build",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags",
Expand Down
Loading