Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9aa43f7
Lists all new classes
cesarParra Sep 21, 2024
d09de62
lists all new types
cesarParra Sep 21, 2024
4af8d42
Refactorings
cesarParra Sep 21, 2024
9792a09
Lists all removed types
cesarParra Sep 21, 2024
7b8d62e
Lists all new values of a modified enum
cesarParra Sep 21, 2024
00fb087
lists all removed enum values
cesarParra Sep 21, 2024
8c4f15b
refactorings
cesarParra Sep 21, 2024
dd10dd7
lists all new methods of a class and an interface
cesarParra Sep 21, 2024
49e6757
checking for method equality based on their shape
cesarParra Sep 22, 2024
e038996
lists all removed methods
cesarParra Sep 22, 2024
8781927
lists new properties
cesarParra Sep 22, 2024
234f6bf
lists removed properties
cesarParra Sep 22, 2024
a0f513e
lists new and removed fields
cesarParra Sep 22, 2024
175421b
lists new inner classes
cesarParra Sep 22, 2024
6efd934
lists removed inner classes
cesarParra Sep 22, 2024
58b524d
lists new and removed interfaces
cesarParra Sep 22, 2024
77571d4
lists new and removed enums
cesarParra Sep 22, 2024
8dfb5e8
refactoring
cesarParra Sep 22, 2024
993e060
refactoring
cesarParra Sep 23, 2024
56ebd4d
includes the new classes section if there are any
cesarParra Sep 23, 2024
016c401
Walking skeleton for generating the change log output from a pair of …
cesarParra Sep 23, 2024
0005629
Changelog now returns a file that can be written to disk
cesarParra Sep 23, 2024
9ef7d8c
Introducing the changelog command
cesarParra Sep 23, 2024
b0f24f3
Introducing the changelog command
cesarParra Sep 23, 2024
a1ee1af
Introducing the changelog command
cesarParra Sep 24, 2024
94fe525
Introducing the changelog command
cesarParra Sep 24, 2024
ed3872f
refactorings
cesarParra Sep 24, 2024
10a4e1e
refactorings
cesarParra Sep 24, 2024
46bf950
refactorings
cesarParra Sep 24, 2024
5146229
refactorings
cesarParra Sep 24, 2024
6698423
refactorings
cesarParra Sep 24, 2024
a459ad0
refactorings
cesarParra Sep 24, 2024
19e8c40
refactorings
cesarParra Sep 24, 2024
c4ed63c
Unit testing that new class information is added
cesarParra Sep 24, 2024
13dd0c1
Displaying new interfaces
cesarParra Sep 24, 2024
f1be07f
Incorporating the changelog into the vitepress example
cesarParra Sep 24, 2024
19f9699
New enums appear on the changelog.
cesarParra Sep 25, 2024
c589723
Refactoring the argument extraction logic to allow for a single confi…
cesarParra Sep 26, 2024
5619182
Refactoring the argument extraction logic to allow for a single confi…
cesarParra Sep 26, 2024
a77ee8e
Validating that the correct options are passed when using a config fi…
cesarParra Sep 26, 2024
76e11c0
Validating that the correct options are passed when using a config fi…
cesarParra Sep 26, 2024
775a26d
Functional error handling when processing args.
cesarParra Sep 26, 2024
0505f02
Test - extracts arguments for markdown
cesarParra Sep 27, 2024
255e500
Test - extracts arguments for openapi
cesarParra Sep 27, 2024
3904133
Test - extracts arguments for changelog
cesarParra Sep 27, 2024
0edefb0
Test - prints errors to the console
cesarParra Sep 27, 2024
d8f2cb0
Refactoring cosmicconfig dependency
cesarParra Sep 28, 2024
22046bb
simple config ut
cesarParra Sep 28, 2024
af7c3d6
config uts
cesarParra Sep 28, 2024
f364ae4
moving the `reflection` module to a shared space
cesarParra Sep 28, 2024
11c814a
moving the template utility to a shared space
cesarParra Sep 28, 2024
06cb649
can provide a scope to the changelog.
cesarParra Sep 28, 2024
7a45f5b
Ability to set "exclude" glob patterns
cesarParra Sep 28, 2024
3b481e9
Ability to set "exclude" glob patterns
cesarParra Sep 28, 2024
db161ce
Refactorings
cesarParra Sep 28, 2024
7c60ccf
Refactorings
cesarParra Sep 28, 2024
b139df2
Refactorings
cesarParra Sep 28, 2024
b1a3974
Includes removed types
cesarParra Sep 28, 2024
b5dc427
Includes removed types
cesarParra Sep 28, 2024
cfc4fb5
Includes changes to existing members
cesarParra Sep 28, 2024
45ea3dd
Documentation
cesarParra Sep 28, 2024
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
71 changes: 69 additions & 2 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 @@ -221,7 +288,7 @@ 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
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
Expand Down
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
Loading