Skip to content

Commit

Permalink
Release v3.2.0 (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarParra authored Sep 28, 2024
1 parent ce22e5d commit 33dcebe
Show file tree
Hide file tree
Showing 82 changed files with 3,495 additions and 430 deletions.
90 changes: 87 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,19 @@ annotated with `@RestResource`:
apexdocs openapi -s force-app
```

#### Changelog

Run the following command to generate a changelog for your Salesforce Apex classes:

```bash
apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir force-app
```

## 🚀 Features

* Generate documentation for Salesforce Apex classes as Markdown files
* Generate an OpenApi REST specification based on `@RestResource` classes
* Generate a changelog based on the differences between two versions of your Salesforce Apex classes
* Support for grouping blocks of related code within a class
* Support for ignoring files and members from being documented
* Namespace support
Expand Down Expand Up @@ -146,6 +155,28 @@ apexdocs markdown -s force-app -t docs -p global public namespaceaccessible -n M
apexdocs openapi -s force-app -t docs -n MyNamespace --title "My Custom OpenApi Title"
```

### Changelog

`changelog`

#### Flags

| Flag | Alias | Description | Default | Required |
|------------------------|-------|--------------------------------------------------------------------|-------------|----------|
| `--previousVersionDir` | `-p` | The directory location of the previous version of the source code. | N/A | Yes |
| `--currentVersionDir` | `-t` | The directory location of the current version of the source code. | N/A | Yes |
| `--targetDir` | `-t` | The directory location where the changelog file will be generated. | `./docs/` | No |
| `--fileName` | N/A | The name of the changelog file to be generated. | `changelog` | No |
| `--scope` | N/A | The list of scope to respect when generating the changelog. | ['global'] | No |

#### Sample Usage

```bash
apexdocs changelog -p force-app-previous -t force-app
```

---

## 🔬 Defining a configuration file

You can also use a configuration file to define the parameters that will be used when generating the documentation.
Expand Down Expand Up @@ -187,7 +218,7 @@ CLI will be used, or the default value will be used.

### Config Intellisense

Using the `defineMarkdownConfig` (or the `defineOpenApiConfig` for OpenApi documentation)
Using the `defineMarkdownConfig` (or the `defineOpenApiConfig` for OpenApi documentation)
helper will provide Typescript-powered intellisense
for the configuration file options. This should work with both Javascript and Typescript files.

Expand All @@ -202,8 +233,44 @@ export default defineMarkdownConfig({
});
```

### Generating Different Types of Documentation

You might want to generate different types of documentation using a single command. For example, if you are releasing
a new version of your project, you might want to generate updated documentation Markdown files, and at the
same time generate a changelog listing everything new.

You can do this by providing a configuration file that exports a configuration object which keys are the type of
documentation you want to generate.

```typescript
import { defineMarkdownConfig, defineChangelogConfig } from '@cparra/apexdocs';

export default {
markdown: defineMarkdownConfig({
sourceDir: 'force-app',
targetDir: 'docs',
scope: ['global', 'public'],
...
}),
changelog: defineChangelogConfig({
previousVersionDir: 'force-app-previous',
currentVersionDir: 'force-app',
targetDir: 'docs',
scope: ['global', 'public'],
})
};
```

Then you only need to run the top level `apexdocs` command, and it will generate both types of documentation.

```bash
apexdocs
```

### Excluding Tags from Appearing in the Documentation

Note: Only works for Markdown documentation.

You can exclude tags from appearing in the documentation by using the `excludeTags` property in the configuration file,
which allow you to pass a list of tags that you want to exclude from the documentation.

Expand All @@ -219,6 +286,23 @@ export default defineMarkdownConfig({
});
```

### Excluding Files from Being Documented

You can exclude one or multiple files from being documented by providing a list of glob patterns to
the `exclude` property in the configuration file.

```typescript
import { defineMarkdownConfig } from "@cparra/apexdocs";

export default defineMarkdownConfig({
sourceDir: 'force-app',
targetDir: 'docs',
scope: ['global', 'public'],
exclude: ['**/MyClass.cls', '**/MyOtherClass.cls'],
...
});
```

### Configuration Hooks

When defining a `.js` or `.ts` configuration file, your object export can also make use
Expand Down Expand Up @@ -370,12 +454,12 @@ If using Typescript, ApexDocs provides all necessary type definitions.

## 📖 Documentation Guide

See the [wiki](https://github.com/cesarParra/apexdocs/wiki/%F0%9F%93%96-Documenting-Apex-code)
See the [wiki](https://github.com/cesarParra/apexdocs/wiki/2.-%F0%9F%93%96-Documenting-Apex-code)
for an in-depth guide on how to document your Apex code to get the most out of ApexDocs.

## 📄 Generating OpenApi REST Definitions

ApexDocs can also generate OpenApi REST definitions for your Salesforce Apex classes annotated with `@RestResource`.

See the [wiki](https://github.com/cesarParra/apexdocs/wiki/%F0%9F%93%84-Generating-OpenApi-REST-Definitions)
See the [wiki](https://github.com/cesarParra/apexdocs/wiki/3.-%F0%9F%93%84-Generating-OpenApi-REST-Definitions)
for more information.
8 changes: 8 additions & 0 deletions examples/changelog/current/classes/AccountService.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @description This is a new class that does foo and bar and references {@link Baz}.
*/
public class AccountService {
public void newMethod() {
System.debug('Hello workd!');
}
}
1 change: 1 addition & 0 deletions examples/changelog/current/classes/IAnotherExample.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public interface IAnotherExample {}
3 changes: 3 additions & 0 deletions examples/changelog/current/classes/IExemplificable.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public interface IExemplificable {
public void exampleMethod();
}
5 changes: 5 additions & 0 deletions examples/changelog/current/classes/PossibleValues.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public enum PossibleValues {
VALUE1,
VALUE2,
VALUE3
}
9 changes: 9 additions & 0 deletions examples/changelog/current/classes/SolidService.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class SolidService {
public void doSomething() {
// do something
}

public void newMethod() {
// new method
}
}
38 changes: 38 additions & 0 deletions examples/changelog/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Changelog

## New Classes

These classes are new.

### AccountService

This is a new class that does foo and bar and references Baz .

## New Interfaces

These interfaces are new.

### IAnotherExample

### IExemplificable

## New Enums

These enums are new.

### PossibleValues

## Removed Types

These types have been removed.

- OldImplementation

## New or Modified Members in Existing Types

These members have been added or modified.

### SolidService

- New Method: newMethod
- Removed Method: deprecatedMethod
Loading

0 comments on commit 33dcebe

Please sign in to comment.