@cparra/apexdocs 3.14.0 → 3.15.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -155,7 +155,9 @@ apexdocs changelog --previousVersionDir force-app-previous --currentVersionDir f
|
|
|
155
155
|
| `--customObjectsGroupName` | N/A | The name under which custom objects will be grouped in the Reference Guide | `Custom Objects` | No |
|
|
156
156
|
| `--triggersGroupName` | N/A | The name under which triggers will be grouped in the Reference Guide | `Triggers` | No |
|
|
157
157
|
| `--includeFieldSecurityMetadata` | N/A | Whether to include the compliance category and security classification for fields in the generated files. | `false` | No |
|
|
158
|
-
|
|
158
|
+
|| `--includeInlineHelpTextMetadata` | N/A | Whether to include the inline help text for fields in the generated files. | `false` | No |
|
|
159
|
+
|| `--parallelProcessing` | N/A | Whether to use parallel processing for reflection operations. | `true` | No |
|
|
160
|
+
|| `--workerThreads` | N/A | Number of worker threads to use for parallel processing (defaults to number of CPU cores). | CPU cores | No |
|
|
159
161
|
|
|
160
162
|
> **Note:** The `*` in the Required column indicates that **one** of the source directory options must be specified:
|
|
161
163
|
> - `--sourceDir` (single directory)
|
|
@@ -233,7 +235,9 @@ apexdocs openapi -s force-app -t docs -n MyNamespace --title "My Custom OpenApi
|
|
|
233
235
|
| `--fileName` | N/A | The name of the changelog file to be generated. | `changelog` | No |
|
|
234
236
|
| `--scope` | N/A | The list of scope to respect when generating the changelog. | ['global'] | No |
|
|
235
237
|
| `--customObjectVisibility` | `-v` | Controls which custom objects are documented. Values should be separated by a space. | ['public'] | No |
|
|
236
|
-
|
|
238
|
+
|| `--skipIfNoChanges` | N/A | Whether to skip generating the changelog if there are no changes. | `true` | No |
|
|
239
|
+
|| `--parallelProcessing` | N/A | Whether to use parallel processing for reflection operations. | `true` | No |
|
|
240
|
+
|| `--workerThreads` | N/A | Number of worker threads to use for parallel processing (defaults to number of CPU cores). | CPU cores | No |
|
|
237
241
|
|
|
238
242
|
#### Sample Usage
|
|
239
243
|
|
|
@@ -243,6 +247,62 @@ apexdocs changelog -p force-app-previous -t force-app
|
|
|
243
247
|
|
|
244
248
|
---
|
|
245
249
|
|
|
250
|
+
## ⚡ Parallel Processing
|
|
251
|
+
|
|
252
|
+
ApexDocs supports parallel processing for reflection operations, significantly improving performance when processing large numbers of Apex files. This feature uses Node.js Worker Threads to process files in parallel while maintaining full compatibility with existing configurations.
|
|
253
|
+
|
|
254
|
+
### Key Features
|
|
255
|
+
|
|
256
|
+
- **Automatic**: Enabled by default in production environments
|
|
257
|
+
- **Adaptive**: Automatically chooses between parallel and sequential processing based on file count and environment
|
|
258
|
+
- **Configurable**: Control the number of worker threads used
|
|
259
|
+
- **Safe**: Automatically disabled during tests to prevent interference
|
|
260
|
+
|
|
261
|
+
### Configuration
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
import { defineMarkdownConfig } from '@cparra/apexdocs';
|
|
265
|
+
|
|
266
|
+
export default defineMarkdownConfig({
|
|
267
|
+
sourceDir: 'force-app',
|
|
268
|
+
targetDir: 'docs',
|
|
269
|
+
|
|
270
|
+
// Enable/disable parallel processing (default: true in production)
|
|
271
|
+
parallelProcessing: true,
|
|
272
|
+
|
|
273
|
+
// Set number of worker threads (default: CPU cores)
|
|
274
|
+
workerThreads: 4,
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### CLI Usage
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Use parallel processing (default)
|
|
282
|
+
apexdocs markdown -s force-app
|
|
283
|
+
|
|
284
|
+
# Disable parallel processing
|
|
285
|
+
apexdocs markdown -s force-app --parallelProcessing false
|
|
286
|
+
|
|
287
|
+
# Set custom worker thread count
|
|
288
|
+
apexdocs markdown -s force-app --workerThreads 8
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Performance Benefits
|
|
292
|
+
|
|
293
|
+
- **Large codebases**: Significant performance improvements for projects with many files
|
|
294
|
+
- **Multi-core systems**: Better utilization of available CPU cores
|
|
295
|
+
- **CI/CD pipelines**: Faster documentation generation in automated environments
|
|
296
|
+
|
|
297
|
+
### When It's Used
|
|
298
|
+
|
|
299
|
+
- **Parallel**: Multiple files + production environment + parallel enabled
|
|
300
|
+
- **Sequential**: Single file OR test environment OR parallel disabled
|
|
301
|
+
|
|
302
|
+
For more detailed information, see [PARALLEL_PROCESSING.md](PARALLEL_PROCESSING.md).
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
246
306
|
## 🔬 Defining a configuration file
|
|
247
307
|
|
|
248
308
|
You can also use a configuration file to define the parameters that will be used when generating the documentation.
|
package/dist/cli/generate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var logger$1 = require('../logger-
|
|
4
|
+
var logger$1 = require('../logger-BbAtfln6.js');
|
|
5
5
|
var require$$0 = require('yargs');
|
|
6
6
|
var cosmiconfig = require('cosmiconfig');
|
|
7
7
|
var E = require('fp-ts/Either');
|
|
@@ -10,14 +10,17 @@ var _function = require('fp-ts/function');
|
|
|
10
10
|
require('fp-ts/TaskEither');
|
|
11
11
|
require('js-yaml');
|
|
12
12
|
require('path');
|
|
13
|
-
require('fp-ts/Task');
|
|
14
|
-
require('fp-ts/lib/Array');
|
|
15
|
-
require('@cparra/apex-reflection');
|
|
16
13
|
require('fp-ts/Option');
|
|
17
|
-
require('fast-xml-parser');
|
|
18
14
|
require('handlebars');
|
|
19
15
|
require('fp-ts/boolean');
|
|
16
|
+
require('fast-xml-parser');
|
|
17
|
+
require('fp-ts/Task');
|
|
20
18
|
require('fp-ts/Array');
|
|
19
|
+
require('worker_threads');
|
|
20
|
+
require('os');
|
|
21
|
+
require('fp-ts/lib/Array');
|
|
22
|
+
require('@cparra/apex-reflection');
|
|
23
|
+
require('uuid');
|
|
21
24
|
require('fs');
|
|
22
25
|
require('fp-ts/lib/TaskEither');
|
|
23
26
|
require('minimatch');
|
|
@@ -141,6 +144,15 @@ const markdownOptions = {
|
|
|
141
144
|
includeInlineHelpTextMetadata: {
|
|
142
145
|
type: "boolean",
|
|
143
146
|
describe: "Whether to include the inline help text for fields in the generated files."
|
|
147
|
+
},
|
|
148
|
+
parallelProcessing: {
|
|
149
|
+
type: "boolean",
|
|
150
|
+
describe: "Whether to use parallel processing for reflection operations.",
|
|
151
|
+
default: logger$1.markdownDefaults.parallelProcessing
|
|
152
|
+
},
|
|
153
|
+
workerThreads: {
|
|
154
|
+
type: "number",
|
|
155
|
+
describe: "Number of worker threads to use for parallel processing (defaults to number of CPU cores)."
|
|
144
156
|
}
|
|
145
157
|
};
|
|
146
158
|
|
|
@@ -256,6 +268,15 @@ const changeLogOptions = {
|
|
|
256
268
|
type: "boolean",
|
|
257
269
|
default: logger$1.changeLogDefaults.skipIfNoChanges,
|
|
258
270
|
describe: "Skip the changelog generation if there are no changes between the previous and current version."
|
|
271
|
+
},
|
|
272
|
+
parallelProcessing: {
|
|
273
|
+
type: "boolean",
|
|
274
|
+
describe: "Whether to use parallel processing for reflection operations.",
|
|
275
|
+
default: logger$1.changeLogDefaults.parallelProcessing
|
|
276
|
+
},
|
|
277
|
+
workerThreads: {
|
|
278
|
+
type: "number",
|
|
279
|
+
describe: "Number of worker threads to use for parallel processing (defaults to number of CPU cores)."
|
|
259
280
|
}
|
|
260
281
|
};
|
|
261
282
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const worker_threads_1 = require("worker_threads");
|
|
13
|
+
const apex_reflection_1 = require("@cparra/apex-reflection");
|
|
14
|
+
function processReflectionTask(task) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
let result;
|
|
18
|
+
if (task.type === 'apex') {
|
|
19
|
+
const reflectionResult = (0, apex_reflection_1.reflect)(task.content);
|
|
20
|
+
if (reflectionResult.error) {
|
|
21
|
+
throw reflectionResult.error;
|
|
22
|
+
}
|
|
23
|
+
result = reflectionResult.typeMirror;
|
|
24
|
+
}
|
|
25
|
+
else if (task.type === 'trigger') {
|
|
26
|
+
const reflectionResult = yield (0, apex_reflection_1.reflectTriggerAsync)(task.content);
|
|
27
|
+
if (reflectionResult.error) {
|
|
28
|
+
throw reflectionResult.error;
|
|
29
|
+
}
|
|
30
|
+
result = reflectionResult.triggerMirror;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new Error(`Unknown reflection type: ${task.type}`);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
id: task.id,
|
|
37
|
+
success: true,
|
|
38
|
+
result,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
id: task.id,
|
|
44
|
+
success: false,
|
|
45
|
+
error: {
|
|
46
|
+
message: error.message,
|
|
47
|
+
filePath: task.filePath,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (worker_threads_1.parentPort) {
|
|
54
|
+
worker_threads_1.parentPort.on('message', (task) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const result = yield processReflectionTask(task);
|
|
56
|
+
worker_threads_1.parentPort.postMessage(result);
|
|
57
|
+
}));
|
|
58
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -173,6 +173,8 @@ type CliConfigurableMarkdownConfig = {
|
|
|
173
173
|
referenceGuideTitle: string;
|
|
174
174
|
includeFieldSecurityMetadata: boolean;
|
|
175
175
|
includeInlineHelpTextMetadata: boolean;
|
|
176
|
+
parallelProcessing?: boolean;
|
|
177
|
+
workerThreads?: number;
|
|
176
178
|
};
|
|
177
179
|
|
|
178
180
|
type UserDefinedMarkdownConfig = {
|
|
@@ -207,6 +209,8 @@ type UserDefinedChangelogConfig = {
|
|
|
207
209
|
exclude: string[];
|
|
208
210
|
skipIfNoChanges: boolean;
|
|
209
211
|
translations?: UserTranslations['changelog'];
|
|
212
|
+
parallelProcessing?: boolean;
|
|
213
|
+
workerThreads?: number;
|
|
210
214
|
} & Partial<ChangelogConfigurableHooks>;
|
|
211
215
|
|
|
212
216
|
type UserDefinedConfig = UserDefinedMarkdownConfig | UserDefinedOpenApiConfig | UserDefinedChangelogConfig;
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var logger = require('./logger-
|
|
3
|
+
var logger = require('./logger-BbAtfln6.js');
|
|
4
4
|
var E = require('fp-ts/Either');
|
|
5
5
|
require('fp-ts/function');
|
|
6
6
|
require('fp-ts/TaskEither');
|
|
7
7
|
require('js-yaml');
|
|
8
8
|
require('path');
|
|
9
|
-
require('fp-ts/Task');
|
|
10
|
-
require('fp-ts/lib/Array');
|
|
11
|
-
require('@cparra/apex-reflection');
|
|
12
9
|
require('fp-ts/Option');
|
|
13
|
-
require('fast-xml-parser');
|
|
14
10
|
require('handlebars');
|
|
15
11
|
require('fp-ts/boolean');
|
|
12
|
+
require('fast-xml-parser');
|
|
13
|
+
require('fp-ts/Task');
|
|
16
14
|
require('fp-ts/Array');
|
|
15
|
+
require('worker_threads');
|
|
16
|
+
require('os');
|
|
17
|
+
require('fp-ts/lib/Array');
|
|
18
|
+
require('@cparra/apex-reflection');
|
|
19
|
+
require('uuid');
|
|
17
20
|
require('fs');
|
|
18
21
|
require('fp-ts/lib/TaskEither');
|
|
19
22
|
require('minimatch');
|