@imolko/create-ultra-reporter 2.1.23-beta
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 +219 -0
- package/bin/classes/index.d.ts +0 -0
- package/bin/classes/index.js +2 -0
- package/bin/classes/index.js.map +1 -0
- package/bin/classes/logger.d.ts +42 -0
- package/bin/classes/logger.js +185 -0
- package/bin/classes/logger.js.map +1 -0
- package/bin/cli.d.ts +2 -0
- package/bin/cli.js +48 -0
- package/bin/cli.js.map +1 -0
- package/bin/commands/build.d.ts +2 -0
- package/bin/commands/build.js +151 -0
- package/bin/commands/build.js.map +1 -0
- package/bin/commands/create.d.ts +60 -0
- package/bin/commands/create.js +368 -0
- package/bin/commands/create.js.map +1 -0
- package/bin/commands/generate-documentation.d.ts +2 -0
- package/bin/commands/generate-documentation.js +249 -0
- package/bin/commands/generate-documentation.js.map +1 -0
- package/bin/commands/generate.d.ts +2 -0
- package/bin/commands/generate.js +79 -0
- package/bin/commands/generate.js.map +1 -0
- package/bin/commands/index.d.ts +6 -0
- package/bin/commands/index.js +16 -0
- package/bin/commands/index.js.map +1 -0
- package/bin/commands/init.d.ts +2 -0
- package/bin/commands/init.js +54 -0
- package/bin/commands/init.js.map +1 -0
- package/bin/commands/serve.d.ts +2 -0
- package/bin/commands/serve.js +124 -0
- package/bin/commands/serve.js.map +1 -0
- package/bin/commands/types.d.ts +65 -0
- package/bin/commands/types.js +9 -0
- package/bin/commands/types.js.map +1 -0
- package/bin/config/reader.d.ts +17 -0
- package/bin/config/reader.js +166 -0
- package/bin/config/reader.js.map +1 -0
- package/bin/config/types.d.ts +57 -0
- package/bin/config/types.js +21 -0
- package/bin/config/types.js.map +1 -0
- package/bin/data/documentation-folder.d.ts +1 -0
- package/bin/data/documentation-folder.js +5 -0
- package/bin/data/documentation-folder.js.map +1 -0
- package/bin/data/files-generated.d.ts +1 -0
- package/bin/data/files-generated.js +10 -0
- package/bin/data/files-generated.js.map +1 -0
- package/bin/data/index.d.ts +2 -0
- package/bin/data/index.js +8 -0
- package/bin/data/index.js.map +1 -0
- package/bin/pipeline/generate.d.ts +26 -0
- package/bin/pipeline/generate.js +269 -0
- package/bin/pipeline/generate.js.map +1 -0
- package/bin/reporters/data-loading.d.ts +121 -0
- package/bin/reporters/data-loading.js +398 -0
- package/bin/reporters/data-loading.js.map +1 -0
- package/bin/reporters/data-transformation.d.ts +101 -0
- package/bin/reporters/data-transformation.js +392 -0
- package/bin/reporters/data-transformation.js.map +1 -0
- package/bin/reporters/file-writing.d.ts +29 -0
- package/bin/reporters/file-writing.js +100 -0
- package/bin/reporters/file-writing.js.map +1 -0
- package/bin/reporters/generate-domain-documentation.d.ts +17 -0
- package/bin/reporters/generate-domain-documentation.js +161 -0
- package/bin/reporters/generate-domain-documentation.js.map +1 -0
- package/bin/reporters/generate-use-cases-documentation.d.ts +18 -0
- package/bin/reporters/generate-use-cases-documentation.js +123 -0
- package/bin/reporters/generate-use-cases-documentation.js.map +1 -0
- package/bin/reporters/rendering.d.ts +116 -0
- package/bin/reporters/rendering.js +385 -0
- package/bin/reporters/rendering.js.map +1 -0
- package/bin/reporters/templates/README.md +28 -0
- package/bin/reporters/templates/card.template.jsx +5 -0
- package/bin/reporters/templates/cards-container.template.jsx +5 -0
- package/bin/reporters/types.d.ts +190 -0
- package/bin/reporters/types.js +8 -0
- package/bin/reporters/types.js.map +1 -0
- package/bin/scaffold/assembler.d.ts +13 -0
- package/bin/scaffold/assembler.js +371 -0
- package/bin/scaffold/assembler.js.map +1 -0
- package/bin/scaffold/doc-assembler.d.ts +10 -0
- package/bin/scaffold/doc-assembler.js +113 -0
- package/bin/scaffold/doc-assembler.js.map +1 -0
- package/bin/scripts/add-import.d.ts +1 -0
- package/bin/scripts/add-import.js +26 -0
- package/bin/scripts/add-import.js.map +1 -0
- package/bin/scripts/converter.d.ts +6 -0
- package/bin/scripts/converter.js +120 -0
- package/bin/scripts/converter.js.map +1 -0
- package/bin/scripts/copy-files.d.ts +1 -0
- package/bin/scripts/copy-files.js +96 -0
- package/bin/scripts/copy-files.js.map +1 -0
- package/bin/scripts/create-folder.d.ts +1 -0
- package/bin/scripts/create-folder.js +23 -0
- package/bin/scripts/create-folder.js.map +1 -0
- package/bin/scripts/delete-paths.d.ts +1 -0
- package/bin/scripts/delete-paths.js +34 -0
- package/bin/scripts/delete-paths.js.map +1 -0
- package/bin/scripts/exists-file.d.ts +5 -0
- package/bin/scripts/exists-file.js +12 -0
- package/bin/scripts/exists-file.js.map +1 -0
- package/bin/scripts/generate-track-artifacts.d.ts +1 -0
- package/bin/scripts/generate-track-artifacts.js +59 -0
- package/bin/scripts/generate-track-artifacts.js.map +1 -0
- package/bin/scripts/get-artifacts.d.ts +1 -0
- package/bin/scripts/get-artifacts.js +38 -0
- package/bin/scripts/get-artifacts.js.map +1 -0
- package/bin/scripts/get-directories.d.ts +1 -0
- package/bin/scripts/get-directories.js +10 -0
- package/bin/scripts/get-directories.js.map +1 -0
- package/bin/scripts/get-file.d.ts +9 -0
- package/bin/scripts/get-file.js +38 -0
- package/bin/scripts/get-file.js.map +1 -0
- package/bin/scripts/labels.d.ts +35 -0
- package/bin/scripts/labels.js +108 -0
- package/bin/scripts/labels.js.map +1 -0
- package/bin/scripts/markdown.d.ts +34 -0
- package/bin/scripts/markdown.js +99 -0
- package/bin/scripts/markdown.js.map +1 -0
- package/bin/scripts/names.d.ts +18 -0
- package/bin/scripts/names.js +64 -0
- package/bin/scripts/names.js.map +1 -0
- package/bin/scripts/track-artifacts.d.ts +2 -0
- package/bin/scripts/track-artifacts.js +101 -0
- package/bin/scripts/track-artifacts.js.map +1 -0
- package/bin/utils/create-folder.d.ts +1 -0
- package/bin/utils/create-folder.js +23 -0
- package/bin/utils/create-folder.js.map +1 -0
- package/bin/utils/delete-markdown-files.d.ts +1 -0
- package/bin/utils/delete-markdown-files.js +46 -0
- package/bin/utils/delete-markdown-files.js.map +1 -0
- package/bin/utils/delete-paths.d.ts +5 -0
- package/bin/utils/delete-paths.js +26 -0
- package/bin/utils/delete-paths.js.map +1 -0
- package/bin/utils/exists-file.d.ts +6 -0
- package/bin/utils/exists-file.js +13 -0
- package/bin/utils/exists-file.js.map +1 -0
- package/bin/utils/exists-folder.d.ts +6 -0
- package/bin/utils/exists-folder.js +13 -0
- package/bin/utils/exists-folder.js.map +1 -0
- package/bin/utils/get-internal-resource-path.d.ts +1 -0
- package/bin/utils/get-internal-resource-path.js +43 -0
- package/bin/utils/get-internal-resource-path.js.map +1 -0
- package/bin/utils/get-json-file.d.ts +1 -0
- package/bin/utils/get-json-file.js +27 -0
- package/bin/utils/get-json-file.js.map +1 -0
- package/bin/utils/index.d.ts +6 -0
- package/bin/utils/index.js +16 -0
- package/bin/utils/index.js.map +1 -0
- package/bin/utils/run-command.d.ts +5 -0
- package/bin/utils/run-command.js +36 -0
- package/bin/utils/run-command.js.map +1 -0
- package/jsdoc.conf.json +30 -0
- package/package.json +75 -0
- package/templates/documentation/README.md +41 -0
- package/templates/documentation/docs/.gitkeep +0 -0
- package/templates/documentation/docusaurus.config.ts +127 -0
- package/templates/documentation/package-lock.json +19431 -0
- package/templates/documentation/package.json +49 -0
- package/templates/documentation/sidebars.ts +33 -0
- package/templates/documentation/src/components/ArtifactTable/FilterBar.tsx +185 -0
- package/templates/documentation/src/components/ArtifactTable/index.tsx +298 -0
- package/templates/documentation/src/components/ArtifactTable/styles.module.css +282 -0
- package/templates/documentation/src/components/ArtifactTable/types.ts +31 -0
- package/templates/documentation/src/components/HomepageFeatures/index.tsx +77 -0
- package/templates/documentation/src/components/HomepageFeatures/styles.module.css +11 -0
- package/templates/documentation/src/css/custom.css +30 -0
- package/templates/documentation/src/pages/index.module.css +23 -0
- package/templates/documentation/src/pages/index.tsx +43 -0
- package/templates/documentation/src/pages/markdown-page.md +7 -0
- package/templates/documentation/static/.nojekyll +0 -0
- package/templates/documentation/static/img/docusaurus-social-card.jpg +0 -0
- package/templates/documentation/static/img/docusaurus.png +0 -0
- package/templates/documentation/static/img/favicon.ico +0 -0
- package/templates/documentation/static/img/logo.svg +1 -0
- package/templates/documentation/static/img/logo_imolko_azul.png +0 -0
- package/templates/documentation/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/templates/documentation/static/img/undraw_docusaurus_react.svg +170 -0
- package/templates/documentation/static/img/undraw_docusaurus_tree.svg +40 -0
- package/templates/documentation/tsconfig.json +8 -0
- package/templates/documentation/ultra-reporter.config.json +55 -0
- package/templates/track-artifacts-script.ts +44 -0
- package/tsconfig.build-track.json +39 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Shared generation pipeline
|
|
4
|
+
//
|
|
5
|
+
// Orchestrates the full documentation generation:
|
|
6
|
+
// 1. Track artifacts → artifacts.json
|
|
7
|
+
// 2. JSDoc extraction → jsdoc-report.txt
|
|
8
|
+
// 3. CTRF conversion → test-results.json
|
|
9
|
+
// 4. Domain reporter → generated .md
|
|
10
|
+
// 5. Use-cases reporter → generated .md
|
|
11
|
+
//
|
|
12
|
+
// All output goes to .ultra-reporter/generated-docs/ and .ultra-reporter/cache/.
|
|
13
|
+
// Used by serve, generate, and build commands.
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.derivePipelinePaths = derivePipelinePaths;
|
|
53
|
+
exports.generateAllDocs = generateAllDocs;
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
const fs = __importStar(require("fs"));
|
|
56
|
+
const path_1 = require("path");
|
|
57
|
+
const utils_1 = require("../utils");
|
|
58
|
+
const delete_paths_1 = require("../scripts/delete-paths");
|
|
59
|
+
const run_command_1 = require("../utils/run-command");
|
|
60
|
+
const converter_1 = require("../scripts/converter");
|
|
61
|
+
const generate_domain_documentation_1 = require("../reporters/generate-domain-documentation");
|
|
62
|
+
const generate_use_cases_documentation_1 = require("../reporters/generate-use-cases-documentation");
|
|
63
|
+
const reader_1 = require("../config/reader");
|
|
64
|
+
const logger_1 = __importDefault(require("../classes/logger"));
|
|
65
|
+
const pipeLogger = logger_1.default.createContextLogger('pipeline:generate');
|
|
66
|
+
/**
|
|
67
|
+
* Derives pipeline paths from the config file location.
|
|
68
|
+
*/
|
|
69
|
+
function derivePipelinePaths(configDir) {
|
|
70
|
+
const ultraReporterRoot = path.resolve(configDir, '.ultra-reporter');
|
|
71
|
+
const cacheDir = path.resolve(ultraReporterRoot, 'cache');
|
|
72
|
+
const generatedDocsDir = path.resolve(ultraReporterRoot, 'generated-docs');
|
|
73
|
+
const configPath = path.resolve(configDir, 'ultra-reporter.config.json');
|
|
74
|
+
const packageRootName = path.basename(configDir).replace(/[^a-zA-Z0-9]+/g, '-') || 'project';
|
|
75
|
+
return {
|
|
76
|
+
ultraReporterRoot,
|
|
77
|
+
cacheDir,
|
|
78
|
+
generatedDocsDir,
|
|
79
|
+
configPath,
|
|
80
|
+
packageRootName,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Generates all documentation for the project.
|
|
85
|
+
*
|
|
86
|
+
* @param configDir - Directory containing ultra-reporter.config.json
|
|
87
|
+
* @param cmdRoot - Path to the bin/ directory (for locating internal scripts)
|
|
88
|
+
*/
|
|
89
|
+
async function generateAllDocs(configDir, cmdRoot) {
|
|
90
|
+
const config = (0, reader_1.readConfig)(configDir);
|
|
91
|
+
const paths = derivePipelinePaths(configDir);
|
|
92
|
+
// Ensure output directories exist
|
|
93
|
+
await (0, utils_1.createFolder)(paths.ultraReporterRoot);
|
|
94
|
+
await (0, utils_1.createFolder)(paths.cacheDir);
|
|
95
|
+
// Clean generated docs on each run
|
|
96
|
+
await (0, delete_paths_1.deletePaths)([paths.generatedDocsDir]);
|
|
97
|
+
await (0, utils_1.createFolder)(paths.generatedDocsDir);
|
|
98
|
+
// ---- Domain target ----
|
|
99
|
+
await generateDomainTarget(config, paths, configDir, cmdRoot);
|
|
100
|
+
// ---- Use-cases target ----
|
|
101
|
+
if (config.useCases) {
|
|
102
|
+
await generateUseCasesTarget(config, paths, configDir, cmdRoot);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
// Domain target generation
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
async function generateDomainTarget(config, paths, cwd, cmdRoot) {
|
|
109
|
+
const domain = config.domain;
|
|
110
|
+
const domainSrc = domain.srcPath;
|
|
111
|
+
const packageRootName = paths.packageRootName;
|
|
112
|
+
const artifactsFolderPath = (0, path_1.resolve)(cwd, domainSrc);
|
|
113
|
+
// 1. Track artifacts → artifacts.json
|
|
114
|
+
const trackArtifactsScriptPath = (0, path_1.resolve)(cmdRoot, 'scripts/track-artifacts.js');
|
|
115
|
+
const artifactsJsonPath = (0, path_1.resolve)(paths.cacheDir, 'artifacts.json');
|
|
116
|
+
if ((0, utils_1.existsFile)(trackArtifactsScriptPath)) {
|
|
117
|
+
await (0, run_command_1.runCommand)(`node ${trackArtifactsScriptPath} ${artifactsFolderPath} ${artifactsJsonPath} ${domain.name}`);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
pipeLogger.warn('track-artifacts script not found, skipping artifact discovery');
|
|
121
|
+
}
|
|
122
|
+
// 2. JSDoc extraction
|
|
123
|
+
const jsdocOutputFile = (0, path_1.resolve)(paths.cacheDir, 'jsdoc-report.txt');
|
|
124
|
+
const internalJsdocConfigPath = (0, path_1.resolve)(cmdRoot, '../../jsdoc.conf.json');
|
|
125
|
+
const packageRootPath = (0, path_1.resolve)(cwd, findPackageRoot(cwd, domainSrc));
|
|
126
|
+
if ((0, utils_1.existsFile)(internalJsdocConfigPath)) {
|
|
127
|
+
const jsonFile = await (0, utils_1.getJSONFile)(internalJsdocConfigPath);
|
|
128
|
+
const includePath = (0, path_1.resolve)(cwd, domainSrc);
|
|
129
|
+
jsonFile.source.include = [includePath];
|
|
130
|
+
const jsdocConfigPath = (0, path_1.resolve)(paths.cacheDir, 'jsdoc.conf.json');
|
|
131
|
+
fs.writeFileSync(jsdocConfigPath, JSON.stringify(jsonFile, null, 2));
|
|
132
|
+
try {
|
|
133
|
+
await (0, run_command_1.runCommand)(`./node_modules/.bin/jsdoc --explain -c ${jsdocConfigPath} > ${jsdocOutputFile}`);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
pipeLogger.warn('JSDoc extraction failed, continuing without JSDoc data');
|
|
137
|
+
}
|
|
138
|
+
// Clean up temp config
|
|
139
|
+
fs.unlinkSync(jsdocConfigPath);
|
|
140
|
+
}
|
|
141
|
+
// 3. CTRF conversion → test-results.json
|
|
142
|
+
if (domain.testResultsPath) {
|
|
143
|
+
const testResultsPath = (0, path_1.resolve)(cwd, domain.testResultsPath);
|
|
144
|
+
const ctrfFile = (0, path_1.resolve)(paths.cacheDir, 'ctrf-test-results.json');
|
|
145
|
+
if ((0, utils_1.existsFile)(testResultsPath)) {
|
|
146
|
+
const testResults = await (0, utils_1.getJSONFile)(testResultsPath);
|
|
147
|
+
fs.writeFileSync(ctrfFile, JSON.stringify(testResults, null, 2));
|
|
148
|
+
const newTestResultsFile = (0, path_1.resolve)(paths.cacheDir, 'test-results.json');
|
|
149
|
+
(0, converter_1.convertTestJsonFormat)(ctrfFile, newTestResultsFile);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
pipeLogger.warn(`Test results file not found: ${testResultsPath}. Generating docs without test data.`);
|
|
153
|
+
writeEmptyTestResults((0, path_1.resolve)(paths.cacheDir, 'test-results.json'));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
writeEmptyTestResults((0, path_1.resolve)(paths.cacheDir, 'test-results.json'));
|
|
158
|
+
}
|
|
159
|
+
// 4. Generate domain documentation
|
|
160
|
+
const domainTabName = 'domain';
|
|
161
|
+
const aggregateTabName = 'aggregates';
|
|
162
|
+
await (0, generate_domain_documentation_1.generateDomainDocumentation)({
|
|
163
|
+
packageRootName,
|
|
164
|
+
contextName: domain.name,
|
|
165
|
+
documentationPath: paths.ultraReporterRoot,
|
|
166
|
+
domainPath: domainSrc,
|
|
167
|
+
domainTabName,
|
|
168
|
+
aggregateTabName,
|
|
169
|
+
templateDir: (0, path_1.resolve)(cmdRoot, '../reporters/templates'),
|
|
170
|
+
repoSourceUrl: config.repoSourceUrl,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Use-cases target generation
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
async function generateUseCasesTarget(config, paths, cwd, cmdRoot) {
|
|
177
|
+
if (!config.useCases)
|
|
178
|
+
return;
|
|
179
|
+
const useCases = config.useCases;
|
|
180
|
+
const useCasesSrc = useCases.srcPath;
|
|
181
|
+
const packageRootName = paths.packageRootName;
|
|
182
|
+
// 1. JSDoc extraction
|
|
183
|
+
const jsdocOutputFile = (0, path_1.resolve)(paths.cacheDir, 'jsdoc-report-uc.txt');
|
|
184
|
+
const internalJsdocConfigPath = (0, path_1.resolve)(cmdRoot, '../../jsdoc.conf.json');
|
|
185
|
+
if ((0, utils_1.existsFile)(internalJsdocConfigPath)) {
|
|
186
|
+
const jsonFile = await (0, utils_1.getJSONFile)(internalJsdocConfigPath);
|
|
187
|
+
const includePath = (0, path_1.resolve)(cwd, useCasesSrc);
|
|
188
|
+
jsonFile.source.include = [includePath];
|
|
189
|
+
const jsdocConfigPath = (0, path_1.resolve)(paths.cacheDir, 'jsdoc-uc.conf.json');
|
|
190
|
+
fs.writeFileSync(jsdocConfigPath, JSON.stringify(jsonFile, null, 2));
|
|
191
|
+
try {
|
|
192
|
+
await (0, run_command_1.runCommand)(`./node_modules/.bin/jsdoc --explain -c ${jsdocConfigPath} > ${jsdocOutputFile}`);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
pipeLogger.warn('JSDoc extraction failed for use-cases, continuing without JSDoc data');
|
|
196
|
+
}
|
|
197
|
+
fs.unlinkSync(jsdocConfigPath);
|
|
198
|
+
}
|
|
199
|
+
// 2. CTRF conversion
|
|
200
|
+
if (useCases.testResultsPath) {
|
|
201
|
+
const testResultsPath = (0, path_1.resolve)(cwd, useCases.testResultsPath);
|
|
202
|
+
const ctrfFile = (0, path_1.resolve)(paths.cacheDir, 'ctrf-test-results-uc.json');
|
|
203
|
+
if ((0, utils_1.existsFile)(testResultsPath)) {
|
|
204
|
+
const testResults = await (0, utils_1.getJSONFile)(testResultsPath);
|
|
205
|
+
fs.writeFileSync(ctrfFile, JSON.stringify(testResults, null, 2));
|
|
206
|
+
const newTestResultsFile = (0, path_1.resolve)(paths.cacheDir, 'test-results-uc.json');
|
|
207
|
+
(0, converter_1.convertTestJsonFormat)(ctrfFile, newTestResultsFile);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
writeEmptyTestResults((0, path_1.resolve)(paths.cacheDir, 'test-results-uc.json'));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
writeEmptyTestResults((0, path_1.resolve)(paths.cacheDir, 'test-results-uc.json'));
|
|
215
|
+
}
|
|
216
|
+
// 3. Generate use-cases documentation
|
|
217
|
+
const useCasesTabName = 'use-cases';
|
|
218
|
+
await (0, generate_use_cases_documentation_1.generateUseCasesDocumentation)({
|
|
219
|
+
packageRootName,
|
|
220
|
+
title: useCases.title,
|
|
221
|
+
documentationPath: paths.ultraReporterRoot,
|
|
222
|
+
useCasesPath: useCasesSrc,
|
|
223
|
+
useCasesTabName,
|
|
224
|
+
templateDir: (0, path_1.resolve)(cmdRoot, '../reporters/templates'),
|
|
225
|
+
cwd,
|
|
226
|
+
repoSourceUrl: config.repoSourceUrl,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
// Helpers
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
/**
|
|
233
|
+
* Finds the package root for a source path by walking up to find package.json.
|
|
234
|
+
*/
|
|
235
|
+
function findPackageRoot(cwd, srcPath) {
|
|
236
|
+
let currentDir = (0, path_1.resolve)(cwd, srcPath);
|
|
237
|
+
// eslint-disable-next-line no-constant-condition
|
|
238
|
+
while (true) {
|
|
239
|
+
if (fs.existsSync(path.join(currentDir, 'package.json'))) {
|
|
240
|
+
return currentDir;
|
|
241
|
+
}
|
|
242
|
+
const parentDir = path.dirname(currentDir);
|
|
243
|
+
if (parentDir === currentDir)
|
|
244
|
+
break;
|
|
245
|
+
currentDir = parentDir;
|
|
246
|
+
}
|
|
247
|
+
return cwd; // Fallback to cwd
|
|
248
|
+
}
|
|
249
|
+
/** Writes an empty test results file to prevent errors downstream. */
|
|
250
|
+
function writeEmptyTestResults(filePath) {
|
|
251
|
+
const empty = {
|
|
252
|
+
numFailedTestSuites: 0,
|
|
253
|
+
numFailedTests: 0,
|
|
254
|
+
numPassedTestSuites: 0,
|
|
255
|
+
numPassedTests: 0,
|
|
256
|
+
numPendingTestSuites: 0,
|
|
257
|
+
numPendingTests: 0,
|
|
258
|
+
numRuntimeErrorTestSuites: 0,
|
|
259
|
+
numTodoTests: 0,
|
|
260
|
+
numTotalTestSuites: 0,
|
|
261
|
+
numTotalTests: 0,
|
|
262
|
+
startTime: 0,
|
|
263
|
+
success: true,
|
|
264
|
+
testResults: [],
|
|
265
|
+
};
|
|
266
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
267
|
+
fs.writeFileSync(filePath, JSON.stringify(empty, null, 2));
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/pipeline/generate.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,6BAA6B;AAC7B,EAAE;AACF,kDAAkD;AAClD,wCAAwC;AACxC,2CAA2C;AAC3C,2CAA2C;AAC3C,uCAAuC;AACvC,0CAA0C;AAC1C,EAAE;AACF,iFAAiF;AACjF,+CAA+C;AAC/C,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,IAAI,EAAE,CAAC;QACZ,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACzD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,SAAS,KAAK,UAAU;YAAE,MAAM;QACpC,UAAU,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,OAAO,GAAG,CAAC,CAAC,kBAAkB;AAChC,CAAC;AAED,sEAAsE;AACtE,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,MAAM,KAAK,GAAG;QACZ,mBAAmB,EAAE,CAAC;QACtB,cAAc,EAAE,CAAC;QACjB,mBAAmB,EAAE,CAAC;QACtB,cAAc,EAAE,CAAC;QACjB,oBAAoB,EAAE,CAAC;QACvB,eAAe,EAAE,CAAC;QAClB,yBAAyB,EAAE,CAAC;QAC5B,YAAY,EAAE,CAAC;QACf,kBAAkB,EAAE,CAAC;QACrB,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ArtifactRaw, DefinitionData, JsdocElem, Templates, TestFile } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Reads and parses an artifacts.json file.
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadArtifacts(pathStr: string): Promise<ArtifactRaw[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Reads all required template files from the given directory.
|
|
8
|
+
* Returns a Templates object with each template as a string.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadTemplates(templateDir: string): Promise<Templates>;
|
|
11
|
+
/**
|
|
12
|
+
* Reads and parses an artifact's definition.yaml file.
|
|
13
|
+
* Returns {} if the file doesn't exist, is empty, or contains invalid YAML.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadYamlDefinition(name: string, basePath: string, cwd: string): Promise<DefinitionData>;
|
|
16
|
+
/**
|
|
17
|
+
* Reads an artifact's attachments.md file.
|
|
18
|
+
* Returns empty string if the file doesn't exist or is empty.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadAttachments(name: string, basePath: string, cwd: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Reads a jsdoc-to-json output file, strips progress lines, and parses the JSON.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadJsdocReport(pathStr: string): Promise<JsdocElem[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads a jest test-results.json file and extracts the testResults array.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadTestResults(pathStr: string): Promise<TestFile[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Removes "Parsing ..." and "Finished running in..." progress lines from
|
|
31
|
+
* jsdoc-to-json raw output, leaving only valid JSON.
|
|
32
|
+
*/
|
|
33
|
+
export declare function cleanJsdocOutput(raw: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Lists folder names inside a use-cases directory.
|
|
36
|
+
* Returns an empty array if the directory does not exist or is empty.
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadUseCaseFolders(basePath: string): Promise<string[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Reads and parses a use-case's definition.yaml file.
|
|
41
|
+
* Returns {} if the file doesn't exist, is empty, or contains invalid YAML.
|
|
42
|
+
*/
|
|
43
|
+
export declare function loadUseCaseDefinition(useCaseDirPath: string): Promise<DefinitionData>;
|
|
44
|
+
/**
|
|
45
|
+
* Reads a use-case's attachments.md file.
|
|
46
|
+
* Returns empty string if the file doesn't exist or is empty.
|
|
47
|
+
*/
|
|
48
|
+
export declare function loadUseCaseAttachments(useCaseDirPath: string): Promise<string>;
|
|
49
|
+
/** Return type for {@link parseMarkdownFrontmatter}. */
|
|
50
|
+
export interface ParsedMarkdown {
|
|
51
|
+
/** Merged frontmatter fields (same shape as DefinitionData). */
|
|
52
|
+
frontmatter: DefinitionData;
|
|
53
|
+
/** The markdown body content with frontmatter block removed. */
|
|
54
|
+
body: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parses YAML frontmatter from a markdown string.
|
|
58
|
+
*
|
|
59
|
+
* Frontmatter is a YAML block delimited by `---` at the very start of the
|
|
60
|
+
* file. Only the first `---...---` block is treated as frontmatter;
|
|
61
|
+
* subsequent `---` lines in the body are left as literal content.
|
|
62
|
+
*
|
|
63
|
+
* If there is no opening `---` on line 1, or the YAML is invalid, the
|
|
64
|
+
* entire content is returned as `body` with an empty `frontmatter`.
|
|
65
|
+
*
|
|
66
|
+
* @param rawContent - The raw markdown file content as a string.
|
|
67
|
+
* @returns Parsed frontmatter and body.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseMarkdownFrontmatter(rawContent: string): ParsedMarkdown;
|
|
70
|
+
/** Return type for {@link loadMarkdownFilesFromFolder}. */
|
|
71
|
+
export interface MergedMarkdown {
|
|
72
|
+
/** Frontmatter merged across all .md files (first alphabetical wins per key). */
|
|
73
|
+
mergedFrontmatter: DefinitionData;
|
|
74
|
+
/** Bodies of all non-empty .md files concatenated in alphabetical order. */
|
|
75
|
+
concatenatedBodies: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Scans a folder for all `.md` files, extracts frontmatter from each, and
|
|
79
|
+
* merges the results into a single frontmatter object (first file
|
|
80
|
+
* alphabetically wins on key conflicts) and a concatenated body string.
|
|
81
|
+
*
|
|
82
|
+
* Files with an empty body (after stripping frontmatter) are excluded from
|
|
83
|
+
* the concatenated body but their frontmatter is still merged.
|
|
84
|
+
*
|
|
85
|
+
* @param folderPath - Absolute path to the folder to scan.
|
|
86
|
+
* @returns Merged frontmatter and concatenated bodies.
|
|
87
|
+
*/
|
|
88
|
+
export declare function loadMarkdownFilesFromFolder(folderPath: string): Promise<MergedMarkdown>;
|
|
89
|
+
/** Return type for {@link loadArtifactMetadataAndContent}. */
|
|
90
|
+
export interface ArtifactMetadataAndContent {
|
|
91
|
+
definition: DefinitionData;
|
|
92
|
+
attachmentsMd: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Loads metadata and markdown content for a domain artifact by composing
|
|
96
|
+
* legacy `definition.yaml` loading with `.md` frontmatter scanning.
|
|
97
|
+
*
|
|
98
|
+
* 1. Loads `definition.yaml` as the base metadata.
|
|
99
|
+
* 2. Scans all `.md` files in the artifact folder for frontmatter.
|
|
100
|
+
* 3. Merges: `.md` frontmatter overrides `definition.yaml` on key conflicts.
|
|
101
|
+
* 4. Concatenates all `.md` file bodies (alphabetical, empty bodies excluded).
|
|
102
|
+
*
|
|
103
|
+
* @param name - Artifact folder name (e.g., "MyEntity").
|
|
104
|
+
* @param basePath - Base path relative to cwd (e.g., "domain/src").
|
|
105
|
+
* @param cwd - Working directory.
|
|
106
|
+
* @returns Merged definition and concatenated markdown bodies.
|
|
107
|
+
*/
|
|
108
|
+
export declare function loadArtifactMetadataAndContent(name: string, basePath: string, cwd: string): Promise<ArtifactMetadataAndContent>;
|
|
109
|
+
/**
|
|
110
|
+
* Loads metadata and markdown content for a use-case by composing legacy
|
|
111
|
+
* `definition.yaml` loading with `.md` frontmatter scanning.
|
|
112
|
+
*
|
|
113
|
+
* 1. Loads `definition.yaml` as the base metadata.
|
|
114
|
+
* 2. Scans all `.md` files in the use-case folder for frontmatter.
|
|
115
|
+
* 3. Merges: `.md` frontmatter overrides `definition.yaml` on key conflicts.
|
|
116
|
+
* 4. Concatenates all `.md` file bodies (alphabetical, empty bodies excluded).
|
|
117
|
+
*
|
|
118
|
+
* @param useCaseDirPath - Absolute path to the use-case folder.
|
|
119
|
+
* @returns Merged definition and concatenated markdown bodies.
|
|
120
|
+
*/
|
|
121
|
+
export declare function loadUseCaseMetadataAndContent(useCaseDirPath: string): Promise<ArtifactMetadataAndContent>;
|