Skip to content

Commit ce451b4

Browse files
committed
Add support for single source directory in apexdocs build script
1 parent 3f224a6 commit ce451b4

File tree

3 files changed

+2
-136
lines changed

3 files changed

+2
-136
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ Run the following command to generate a changelog for your Salesforce Apex class
107107

108108
```bash
109109
apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir force-app
110-
111-
# NEW: Use sfdx-project.json for both versions
112-
apexdocs changelog --useSfdxProjectJsonForPrevious --sfdxProjectPathForPrevious ./v1.0 \
113-
--useSfdxProjectJsonForCurrent --sfdxProjectPathForCurrent ./v2.0
114110
```
115111

116112
## ▶️ Available Commands

examples/sfdx-multi-dir/README.md

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -99,134 +99,3 @@ module.exports = {
9999
}
100100
};
101101
```
102-
103-
## Generators Support
104-
105-
All ApexDocs generators support the new multi-directory features:
106-
107-
### Markdown Documentation
108-
```bash
109-
apexdocs markdown --useSfdxProjectJson --targetDir ./docs
110-
```
111-
112-
### OpenAPI Specification
113-
```bash
114-
apexdocs openapi --useSfdxProjectJson --targetDir ./api-docs --fileName api-spec
115-
```
116-
117-
### Changelog Generation
118-
```bash
119-
apexdocs changelog \
120-
--useSfdxProjectJsonForPrevious --sfdxProjectPathForPrevious ./v1.0 \
121-
--useSfdxProjectJsonForCurrent --sfdxProjectPathForCurrent ./v2.0 \
122-
--targetDir ./changelog
123-
```
124-
125-
## Validation and Error Handling
126-
127-
ApexDocs validates your configuration and provides helpful error messages:
128-
129-
### Conflicting Options
130-
```bash
131-
# ❌ This will fail - cannot use both
132-
apexdocs markdown --sourceDir force-app --useSfdxProjectJson
133-
```
134-
135-
### Missing Directories
136-
If directories specified in `sfdx-project.json` don't exist, you'll get a clear error message.
137-
138-
### Empty Configuration
139-
```bash
140-
# ❌ This will fail - must specify at least one source method
141-
apexdocs markdown --targetDir ./docs
142-
```
143-
144-
## Benefits
145-
146-
### 1. **Consistency**
147-
- Uses the same directory structure as your Salesforce project
148-
- No need to maintain separate documentation configuration
149-
150-
### 2. **Automation**
151-
- Automatically includes all package directories
152-
- Works well with CI/CD pipelines
153-
154-
### 3. **Flexibility**
155-
- Mix and match with other configuration options
156-
- Override specific settings when needed
157-
158-
### 4. **Multi-Package Support**
159-
- Perfect for modularized Salesforce projects
160-
- Supports complex project structures
161-
162-
## Migration Guide
163-
164-
### From Single Directory
165-
**Before:**
166-
```bash
167-
apexdocs markdown --sourceDir force-app --targetDir ./docs
168-
```
169-
170-
**After:**
171-
```bash
172-
apexdocs markdown --useSfdxProjectJson --targetDir ./docs
173-
```
174-
175-
### From Configuration Files
176-
**Before (package.json):**
177-
```json
178-
{
179-
"apexdocs": {
180-
"sourceDir": "force-app"
181-
}
182-
}
183-
```
184-
185-
**After (package.json):**
186-
```json
187-
{
188-
"apexdocs": {
189-
"useSfdxProjectJson": true
190-
}
191-
}
192-
```
193-
194-
## Tips and Best Practices
195-
196-
1. **Metadata Files Required**: Ensure all Apex classes have corresponding `.cls-meta.xml` files
197-
2. **Directory Structure**: Follow standard Salesforce project structure (`main/default/classes/`)
198-
3. **Validation**: Use `--scope` parameter to control which classes are documented
199-
4. **Testing**: Test with `--sortAlphabetically` for consistent output
200-
201-
## Running This Example
202-
203-
1. **Install ApexDocs:**
204-
```bash
205-
npm install -g @cparra/apexdocs
206-
```
207-
208-
2. **Generate Documentation:**
209-
```bash
210-
# Using sfdx-project.json
211-
apexdocs markdown --useSfdxProjectJson --targetDir ./docs --scope public --sortAlphabetically
212-
213-
# Using multiple directories manually
214-
apexdocs markdown --sourceDirs force-app force-LWC --targetDir ./docs-manual --scope public
215-
```
216-
217-
3. **View Results:**
218-
```bash
219-
# View the generated documentation
220-
open docs/index.md
221-
```
222-
223-
## Output
224-
225-
The generated documentation will include classes from all specified directories:
226-
227-
- **Account Management** (from force-app)
228-
- AccountService
229-
- **Lightning Web Components** (from force-LWC)
230-
- LWCHelper
231-
232-
This demonstrates how ApexDocs can now seamlessly work with complex, multi-directory Salesforce projects.

examples/sfdx-multi-dir/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "sfdx-multi-dir-example",
33
"scripts": {
4-
"apexdocs:build": "ts-node ../../src/cli/generate.ts markdown --useSfdxProjectJson --targetDir ./docs --scope public"
4+
"apexdocs:build": "ts-node ../../src/cli/generate.ts markdown --useSfdxProjectJson --targetDir ./docs --scope public",
5+
"apexdocs:build:single": "ts-node ../../src/cli/generate.ts markdown --sourceDir force-app --targetDir ./docs --scope public"
56
},
67
"devDependencies": {
78
"ts-node": "^10.9.2"

0 commit comments

Comments
 (0)