Skip to content

Commit a8017ab

Browse files
authored
Changelog (#182)
1 parent a726525 commit a8017ab

File tree

78 files changed

+3255
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3255
-305
lines changed

README.md

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,19 @@ annotated with `@RestResource`:
4141
apexdocs openapi -s force-app
4242
```
4343

44+
#### Changelog
45+
46+
Run the following command to generate a changelog for your Salesforce Apex classes:
47+
48+
```bash
49+
apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir force-app
50+
```
51+
4452
## 🚀 Features
4553

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

158+
### Changelog
159+
160+
`changelog`
161+
162+
#### Flags
163+
164+
| Flag | Alias | Description | Default | Required |
165+
|------------------------|-------|--------------------------------------------------------------------|-------------|----------|
166+
| `--previousVersionDir` | `-p` | The directory location of the previous version of the source code. | N/A | Yes |
167+
| `--currentVersionDir` | `-t` | The directory location of the current version of the source code. | N/A | Yes |
168+
| `--targetDir` | `-t` | The directory location where the changelog file will be generated. | `./docs/` | No |
169+
| `--fileName` | N/A | The name of the changelog file to be generated. | `changelog` | No |
170+
| `--scope` | N/A | The list of scope to respect when generating the changelog. | ['global'] | No |
171+
172+
#### Sample Usage
173+
174+
```bash
175+
apexdocs changelog -p force-app-previous -t force-app
176+
```
177+
178+
---
179+
149180
## 🔬 Defining a configuration file
150181

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

188219
### Config Intellisense
189220

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

@@ -202,8 +233,44 @@ export default defineMarkdownConfig({
202233
});
203234
```
204235

236+
### Generating Different Types of Documentation
237+
238+
You might want to generate different types of documentation using a single command. For example, if you are releasing
239+
a new version of your project, you might want to generate updated documentation Markdown files, and at the
240+
same time generate a changelog listing everything new.
241+
242+
You can do this by providing a configuration file that exports a configuration object which keys are the type of
243+
documentation you want to generate.
244+
245+
```typescript
246+
import { defineMarkdownConfig, defineChangelogConfig } from '@cparra/apexdocs';
247+
248+
export default {
249+
markdown: defineMarkdownConfig({
250+
sourceDir: 'force-app',
251+
targetDir: 'docs',
252+
scope: ['global', 'public'],
253+
...
254+
}),
255+
changelog: defineChangelogConfig({
256+
previousVersionDir: 'force-app-previous',
257+
currentVersionDir: 'force-app',
258+
targetDir: 'docs',
259+
scope: ['global', 'public'],
260+
})
261+
};
262+
```
263+
264+
Then you only need to run the top level `apexdocs` command, and it will generate both types of documentation.
265+
266+
```bash
267+
apexdocs
268+
```
269+
205270
### Excluding Tags from Appearing in the Documentation
206271

272+
Note: Only works for Markdown documentation.
273+
207274
You can exclude tags from appearing in the documentation by using the `excludeTags` property in the configuration file,
208275
which allow you to pass a list of tags that you want to exclude from the documentation.
209276

@@ -221,7 +288,7 @@ export default defineMarkdownConfig({
221288

222289
### Excluding Files from Being Documented
223290

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

227294
```typescript
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @description This is a new class that does foo and bar and references {@link Baz}.
3+
*/
4+
public class AccountService {
5+
public void newMethod() {
6+
System.debug('Hello workd!');
7+
}
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public interface IAnotherExample {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public interface IExemplificable {
2+
public void exampleMethod();
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public enum PossibleValues {
2+
VALUE1,
3+
VALUE2,
4+
VALUE3
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class SolidService {
2+
public void doSomething() {
3+
// do something
4+
}
5+
6+
public void newMethod() {
7+
// new method
8+
}
9+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Changelog
2+
3+
## New Classes
4+
5+
These classes are new.
6+
7+
### AccountService
8+
9+
This is a new class that does foo and bar and references Baz .
10+
11+
## New Interfaces
12+
13+
These interfaces are new.
14+
15+
### IAnotherExample
16+
17+
### IExemplificable
18+
19+
## New Enums
20+
21+
These enums are new.
22+
23+
### PossibleValues
24+
25+
## Removed Types
26+
27+
These types have been removed.
28+
29+
- OldImplementation
30+
31+
## New or Modified Members in Existing Types
32+
33+
These members have been added or modified.
34+
35+
### SolidService
36+
37+
- New Method: newMethod
38+
- Removed Method: deprecatedMethod

0 commit comments

Comments
 (0)