@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,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderExample = renderExample;
|
|
4
|
+
exports.renderTestPanel = renderTestPanel;
|
|
5
|
+
exports.renderTestPanels = renderTestPanels;
|
|
6
|
+
exports.renderMethodsSection = renderMethodsSection;
|
|
7
|
+
exports.renderTestsSection = renderTestsSection;
|
|
8
|
+
exports.renderPropertiesSection = renderPropertiesSection;
|
|
9
|
+
exports.renderPropertiesTable = renderPropertiesTable;
|
|
10
|
+
exports.renderMethodDefinition = renderMethodDefinition;
|
|
11
|
+
exports.renderMethodDefinitions = renderMethodDefinitions;
|
|
12
|
+
exports.renderArtifactPage = renderArtifactPage;
|
|
13
|
+
exports.renderUseCasePage = renderUseCasePage;
|
|
14
|
+
const labels_1 = require("../scripts/labels");
|
|
15
|
+
const markdown_1 = require("../scripts/markdown");
|
|
16
|
+
const names_1 = require("../scripts/names");
|
|
17
|
+
/**
|
|
18
|
+
* Renders a single code example as a styled HTML div.
|
|
19
|
+
*
|
|
20
|
+
* @param example - The example code string
|
|
21
|
+
* @returns HTML div string with inline styling
|
|
22
|
+
*/
|
|
23
|
+
function renderExample(example) {
|
|
24
|
+
return `<div style={{backgroundColor:'#EEE', margin:'32px 0px', padding: '16px 16px'}}>${example}</div>`;
|
|
25
|
+
}
|
|
26
|
+
/** Status-to-label-type mapping for test result colors. */
|
|
27
|
+
const STATUS_LABEL_TYPE = {
|
|
28
|
+
passed: 'success',
|
|
29
|
+
failed: 'danger',
|
|
30
|
+
pending: 'warning',
|
|
31
|
+
todo: 'default',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Renders a single test result as a collapsible detail element.
|
|
35
|
+
*
|
|
36
|
+
* Each test gets a colored status label (green=passed, red=failed,
|
|
37
|
+
* yellow=pending, blue=todo) and a messages section inside a styled div.
|
|
38
|
+
*
|
|
39
|
+
* @param test - The test result to render (may include annotation from JSDoc)
|
|
40
|
+
* @param testFilePath - The file path containing the test
|
|
41
|
+
* @param messages - Optional messages to display (@deprecated, prefer test.annotation)
|
|
42
|
+
* @returns HTML string for the test panel (includes trailing // test-panel marker)
|
|
43
|
+
*/
|
|
44
|
+
function renderTestPanel(test, testFilePath, messages, repoSourceUrl) {
|
|
45
|
+
const labelType = STATUS_LABEL_TYPE[test.status] || 'default';
|
|
46
|
+
const labelHtml = (0, labels_1.getHtmlLabel)(labelType, test.status).replace(`display: 'inline'`, `display: 'inline-block', width: '80px', textAlign: 'center'`);
|
|
47
|
+
const headerText = `${labelHtml} ${test.title}`;
|
|
48
|
+
// Build comments from annotation (preferred) or fall back to messages
|
|
49
|
+
let comments = '';
|
|
50
|
+
if (test.annotation) {
|
|
51
|
+
// Render annotation: description + tags (matching old getDocumentationFromTest format)
|
|
52
|
+
const parts = [];
|
|
53
|
+
if (test.annotation.description) {
|
|
54
|
+
const descLines = test.annotation.description.replace(/\n/g, '<br/>');
|
|
55
|
+
parts.push(`<h3>Description</h3><p>${descLines}</p>`);
|
|
56
|
+
}
|
|
57
|
+
for (const tag of test.annotation.tags) {
|
|
58
|
+
const title = tag.title
|
|
59
|
+
? tag.title.charAt(0).toUpperCase() + tag.title.slice(1).toLowerCase()
|
|
60
|
+
: '';
|
|
61
|
+
const value = tag.value ? tag.value.replace(/\n/g, '<br/>') : '';
|
|
62
|
+
parts.push(`<h3>${title}</h3><p>${value}</p>`);
|
|
63
|
+
}
|
|
64
|
+
comments = parts.join('');
|
|
65
|
+
}
|
|
66
|
+
else if (messages && messages.length > 0) {
|
|
67
|
+
comments = messages.map((msg) => `<div>${msg}</div>`).join('');
|
|
68
|
+
}
|
|
69
|
+
const pathHtml = repoSourceUrl
|
|
70
|
+
? `<a href="${repoSourceUrl.replace(/\/+$/, '')}/${testFilePath}">[View source]</a>`
|
|
71
|
+
: testFilePath;
|
|
72
|
+
return TEST_PANEL_TEMPLATE.replace('{/* title */}', headerText)
|
|
73
|
+
.replace('{/* path */}', pathHtml)
|
|
74
|
+
.replace('{/* comments */}', comments);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders all test results across all test files as concatenated test panels.
|
|
78
|
+
*
|
|
79
|
+
* @param testFiles - Array of test files with their results
|
|
80
|
+
* @returns Concatenated HTML string of all test panels
|
|
81
|
+
*/
|
|
82
|
+
function renderTestPanels(testFiles, repoSourceUrl) {
|
|
83
|
+
let result = '';
|
|
84
|
+
for (const testFile of testFiles) {
|
|
85
|
+
for (const testResult of testFile.testResults) {
|
|
86
|
+
result += renderTestPanel(testResult, testFile.testFilePath, undefined, repoSourceUrl);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Renders the complete methods section with count header and collapsible
|
|
93
|
+
* method definitions. Returns empty string when there are no methods.
|
|
94
|
+
*
|
|
95
|
+
* @param methods - Array of method definitions
|
|
96
|
+
* @returns HTML string for the entire methods section, or '' if empty
|
|
97
|
+
*/
|
|
98
|
+
function renderMethodsSection(methods) {
|
|
99
|
+
if (methods.length === 0)
|
|
100
|
+
return '';
|
|
101
|
+
const methodsHtml = renderMethodDefinitions(methods);
|
|
102
|
+
return `<h2>Methods <span style={{ color: '#bbb' }}>[${methods.length}]</span></h2>\n${methodsHtml}`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Renders the complete tests section with count header and collapsible test panels.
|
|
106
|
+
* Returns empty string when there are no tests.
|
|
107
|
+
*
|
|
108
|
+
* @param testFiles - Array of test files with their results
|
|
109
|
+
* @returns HTML string for the entire tests section, or '' if no tests
|
|
110
|
+
*/
|
|
111
|
+
function renderTestsSection(testFiles, repoSourceUrl) {
|
|
112
|
+
const totalTests = testFiles.reduce((sum, f) => sum + f.testResults.length, 0);
|
|
113
|
+
if (totalTests === 0)
|
|
114
|
+
return '';
|
|
115
|
+
const panelsHtml = renderTestPanels(testFiles, repoSourceUrl);
|
|
116
|
+
return `<h2>Tests <span style={{ color: '#bbb' }}>[${totalTests}]</span></h2>\n${panelsHtml}`;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Renders the complete properties section with count header and
|
|
120
|
+
* collapsible table. Returns empty string when there are no properties.
|
|
121
|
+
*
|
|
122
|
+
* @param properties - Array of property definitions
|
|
123
|
+
* @returns HTML string for the entire properties section, or '' if empty
|
|
124
|
+
*/
|
|
125
|
+
function renderPropertiesSection(properties) {
|
|
126
|
+
if (properties.length === 0)
|
|
127
|
+
return '';
|
|
128
|
+
const tableHtml = renderPropertiesTable(properties);
|
|
129
|
+
return `<h2>Properties <span style={{ color: '#bbb' }}>[${properties.length}]</span></h2>\n<details style={{ marginBottom: '16px' }}>\n<summary>${properties.length} properties</summary>\n${tableHtml}\n</details>`;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Renders a markdown table of artifact properties (name, type, description).
|
|
133
|
+
*
|
|
134
|
+
* The type column renders as a link using the same logic as the monolith's
|
|
135
|
+
* linkToType: strips `<...>` suffix that follows a dot (e.g., `java.util.List<String>`
|
|
136
|
+
* → `java.util.List`), then converts the type name using names().fileName.
|
|
137
|
+
*
|
|
138
|
+
* @param properties - Array of property definitions
|
|
139
|
+
* @returns HTML table string
|
|
140
|
+
*/
|
|
141
|
+
function renderPropertiesTable(properties) {
|
|
142
|
+
const rows = properties.map((prop) => {
|
|
143
|
+
const linkedType = linkToType(prop.type);
|
|
144
|
+
return `<tr><td>${prop.name}</td><td>${linkedType}</td><td>${prop.description}</td></tr>`;
|
|
145
|
+
});
|
|
146
|
+
const rowsText = rows.join('\n');
|
|
147
|
+
return PROPERTIES_TABLE_TEMPLATE.replace('{/* row */}', rowsText);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Converts a type string to a link (same logic as monolith's linkToType).
|
|
151
|
+
*/
|
|
152
|
+
function linkToType(type) {
|
|
153
|
+
const typeSanatize = `${type}`.replace(/\.<.+>/, '');
|
|
154
|
+
const typeFileName = (0, names_1.names)(typeSanatize).fileName;
|
|
155
|
+
return `<a href="./${typeFileName}">${typeSanatize}</a>`;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Renders a single method definition with name, description,
|
|
159
|
+
* parameters table, and examples.
|
|
160
|
+
*
|
|
161
|
+
* @param method - The method definition to render
|
|
162
|
+
* @returns HTML string for the method definition (includes trailing
|
|
163
|
+
* // method-definition marker for composition)
|
|
164
|
+
*/
|
|
165
|
+
function renderMethodDefinition(method) {
|
|
166
|
+
// Build method name: name(param1, param2, ...)
|
|
167
|
+
const paramsList = method.params
|
|
168
|
+
.filter((p) => p.name)
|
|
169
|
+
.map((p) => p.name)
|
|
170
|
+
.join(', ');
|
|
171
|
+
const methodName = `${method.name}(${paramsList})`;
|
|
172
|
+
// Build description from comment + description, deduped per line
|
|
173
|
+
const commentDesc = (0, markdown_1.getMainDescriptionFromComment)(method.comment || '');
|
|
174
|
+
const rawDesc = `${commentDesc}${method.description || ''}`;
|
|
175
|
+
const methodDescription = dedupeLines(rawDesc)
|
|
176
|
+
.map((line) => `<p>${line}</p>`)
|
|
177
|
+
.join('\n');
|
|
178
|
+
// Build parameters rows
|
|
179
|
+
const parametersRows = method.params
|
|
180
|
+
.map((param) => {
|
|
181
|
+
const typeName = param.type && param.type.names && param.type.names[0]
|
|
182
|
+
? param.type.names[0]
|
|
183
|
+
: '';
|
|
184
|
+
const linkedType = typeName ? linkToType(typeName) : '';
|
|
185
|
+
return `<tr><td>${param.name}</td><td>${linkedType}</td><td>${param.description}</td></tr>`;
|
|
186
|
+
})
|
|
187
|
+
.join('\n');
|
|
188
|
+
// Build examples
|
|
189
|
+
const examplesHtml = method.examples
|
|
190
|
+
.map((example) => renderExample(example))
|
|
191
|
+
.join('');
|
|
192
|
+
return METHOD_DEFINITION_TEMPLATE.replace('{/* method-name */}', methodName)
|
|
193
|
+
.replace('{/* method-description */}', methodDescription)
|
|
194
|
+
.replace('{/* row */}', parametersRows)
|
|
195
|
+
.replace('{/* example */}', examplesHtml);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Splits text by newline, deduplicates (exact match), preserving empty strings.
|
|
199
|
+
* Matches the monolith's reduce+includes logic.
|
|
200
|
+
*/
|
|
201
|
+
function dedupeLines(text) {
|
|
202
|
+
return text.split('\n').reduce((prev, curr) => {
|
|
203
|
+
if (prev.includes(curr))
|
|
204
|
+
return prev;
|
|
205
|
+
prev.push(curr);
|
|
206
|
+
return prev;
|
|
207
|
+
}, []);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Renders multiple method definitions by composing renderMethodDefinition
|
|
211
|
+
* calls. Uses the trailing `{ /* method-definition * / }` marker for
|
|
212
|
+
* recursive composition (matches the monolith template pattern).
|
|
213
|
+
*
|
|
214
|
+
* @param methods - Array of method definitions
|
|
215
|
+
* @returns Concatenated HTML string of all method definitions
|
|
216
|
+
*/
|
|
217
|
+
function renderMethodDefinitions(methods) {
|
|
218
|
+
if (methods.length === 0)
|
|
219
|
+
return '';
|
|
220
|
+
let result = renderMethodDefinition(methods[0]);
|
|
221
|
+
for (let i = 1; i < methods.length; i++) {
|
|
222
|
+
result = result.replace('{/* method-definition */}', renderMethodDefinition(methods[i]));
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Renders the full artifact documentation page.
|
|
228
|
+
*
|
|
229
|
+
* Composes all sections: header (title, type+tags, description), attachments,
|
|
230
|
+
* properties table, method definitions, and test panels.
|
|
231
|
+
*
|
|
232
|
+
* @param artifact - The fully enriched artifact to render
|
|
233
|
+
* @param options - Optional rendering flags
|
|
234
|
+
* @returns Complete HTML page string for the artifact
|
|
235
|
+
*/
|
|
236
|
+
function renderArtifactPage(artifact, options) {
|
|
237
|
+
const skipAttachments = options?.skipAttachments ?? false;
|
|
238
|
+
const typeAndTags = `${(0, labels_1.typeTag)(artifact.type)} ${(0, labels_1.setupTagsHtml)(artifact.tags)}`;
|
|
239
|
+
// Replace title, type, description in the page template
|
|
240
|
+
let page = ARTIFACT_PAGE_TEMPLATE.replace('{/* title */}', artifact.title)
|
|
241
|
+
.replace('{/* type */}', typeAndTags)
|
|
242
|
+
.replace('{/* description */}', artifact.description || '');
|
|
243
|
+
// Attachments section
|
|
244
|
+
if (skipAttachments) {
|
|
245
|
+
// Leave marker in place for deferred replacement after minification
|
|
246
|
+
}
|
|
247
|
+
else if (artifact.hasAttachments && artifact.attachmentsMd) {
|
|
248
|
+
const attachmentsHtml = `\n\n<div style={{ backgroundColor: '#EEE', margin: '32px 0', padding: '16px' }}>\n\n${artifact.attachmentsMd}\n\n </div>\n\n`;
|
|
249
|
+
page = page.replace('{/* attachments-md */}', attachmentsHtml);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
page = page.replace('{/* attachments-md */}', '');
|
|
253
|
+
}
|
|
254
|
+
// Properties section
|
|
255
|
+
page = page.replace('{/* properties */}', renderPropertiesSection(artifact.properties));
|
|
256
|
+
// Method definitions section
|
|
257
|
+
page = page.replace('{/* method-definition */}', renderMethodsSection(artifact.methodDefinitions));
|
|
258
|
+
// Tests section
|
|
259
|
+
page = page.replace('{/* test-panel */}', renderTestsSection(artifact.testResults, options?.repoSourceUrl));
|
|
260
|
+
return page;
|
|
261
|
+
}
|
|
262
|
+
/** Raw template for the artifact page shell, from artifact.template.jsx. */
|
|
263
|
+
const ARTIFACT_PAGE_TEMPLATE = `<div>
|
|
264
|
+
<div>
|
|
265
|
+
<h1 style={{ textAlign: 'start', color: '#000000', margin: '2rem 0' }}>
|
|
266
|
+
{/* title */}
|
|
267
|
+
</h1>
|
|
268
|
+
<p>{/* type */}</p>
|
|
269
|
+
<h3 style={{ textAlign: 'start', color: 'grey', marginBottom: '2rem' }}>
|
|
270
|
+
{/* description */}
|
|
271
|
+
</h3>
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
{/* attachments-md */}
|
|
275
|
+
<div>
|
|
276
|
+
{/* properties */}
|
|
277
|
+
{/* method-definition */}
|
|
278
|
+
{/* test-panel */}
|
|
279
|
+
</div>`;
|
|
280
|
+
/** Raw template for the method definition, from method-definition.template.jsx. */
|
|
281
|
+
const METHOD_DEFINITION_TEMPLATE = `<div>
|
|
282
|
+
<details style={{ marginBottom: '16px' }}>
|
|
283
|
+
<summary><h4 style={{ color: '#000000', display: 'inline' }}>
|
|
284
|
+
{/* method-name */}
|
|
285
|
+
</h4></summary>
|
|
286
|
+
<div style={{ color: 'grey' }}>
|
|
287
|
+
{/* method-description */}
|
|
288
|
+
</div>
|
|
289
|
+
<h5 style={{ fontWeight: 600 }}>Parameters:</h5>
|
|
290
|
+
<table className="table">
|
|
291
|
+
<thead>
|
|
292
|
+
<tr>
|
|
293
|
+
<th>Name</th>
|
|
294
|
+
<th>Type</th>
|
|
295
|
+
<th>Description</th>
|
|
296
|
+
</tr>
|
|
297
|
+
</thead>
|
|
298
|
+
<tbody>
|
|
299
|
+
{/* row */}
|
|
300
|
+
</tbody>
|
|
301
|
+
</table>
|
|
302
|
+
<h5 style={{ fontWeight: 600 }}>Examples:</h5>
|
|
303
|
+
{/* example */}
|
|
304
|
+
</details>
|
|
305
|
+
</div>
|
|
306
|
+
{/* method-definition */}`;
|
|
307
|
+
/** Raw template for the properties table, from properties.template.jsx. */
|
|
308
|
+
const PROPERTIES_TABLE_TEMPLATE = `<div style={{ margin: '32px 0' }}>
|
|
309
|
+
<table className="table">
|
|
310
|
+
<thead>
|
|
311
|
+
<tr>
|
|
312
|
+
<th>Name</th>
|
|
313
|
+
<th>Type</th>
|
|
314
|
+
<th>Description</th>
|
|
315
|
+
</tr>
|
|
316
|
+
</thead>
|
|
317
|
+
<tbody>
|
|
318
|
+
{/* row */}
|
|
319
|
+
{/* <tr>
|
|
320
|
+
<td>name</td>
|
|
321
|
+
<td>type</td>
|
|
322
|
+
<td>description</td>
|
|
323
|
+
</tr> */}
|
|
324
|
+
</tbody>
|
|
325
|
+
</table>
|
|
326
|
+
</div>`;
|
|
327
|
+
/** Raw template for a single test panel, from test.template.jsx. */
|
|
328
|
+
const TEST_PANEL_TEMPLATE = `<details style={{ marginBottom: '16px' }}>
|
|
329
|
+
<summary>{/* title */}</summary>
|
|
330
|
+
{/* comments */}
|
|
331
|
+
<p>{/* path */}</p>
|
|
332
|
+
</details>
|
|
333
|
+
{/* test-panel */}`;
|
|
334
|
+
// ---------------------------------------------------------------------------
|
|
335
|
+
// Use-case rendering
|
|
336
|
+
// ---------------------------------------------------------------------------
|
|
337
|
+
/** Raw template for a use-case page, from use-case.template.jsx. */
|
|
338
|
+
const USE_CASE_PAGE_TEMPLATE = `<div>
|
|
339
|
+
<div>
|
|
340
|
+
<h1 style={{ textAlign: 'start', color: '#000000', margin: '2rem 0' }}>
|
|
341
|
+
{/* title */}
|
|
342
|
+
</h1>
|
|
343
|
+
<p>{/* type */}</p>
|
|
344
|
+
<h3 style={{ textAlign: 'start', color: 'grey', marginBottom: '2rem' }}>
|
|
345
|
+
{/* description */}
|
|
346
|
+
</h3>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
{/* attachments-md */}
|
|
350
|
+
<div>
|
|
351
|
+
{/* test-panel */}
|
|
352
|
+
</div>`;
|
|
353
|
+
/**
|
|
354
|
+
* Renders a full use-case documentation page.
|
|
355
|
+
*
|
|
356
|
+
* Composes: header (title, type+modelStatus+tags, description),
|
|
357
|
+
* attachments section, and test panels.
|
|
358
|
+
*
|
|
359
|
+
* @param useCase - The fully enriched use-case to render
|
|
360
|
+
* @param options - Optional rendering flags
|
|
361
|
+
* @returns Complete HTML page string for the use-case
|
|
362
|
+
*/
|
|
363
|
+
function renderUseCasePage(useCase, options) {
|
|
364
|
+
const skipAttachments = options?.skipAttachments ?? false;
|
|
365
|
+
const typeAndTags = `${(0, labels_1.typeTag)(useCase.type)} ${(0, labels_1.modelStatusTag)(useCase.modelStatus)} ${(0, labels_1.setupTagsHtml)(useCase.tags)}`;
|
|
366
|
+
// Replace title, type, description
|
|
367
|
+
let page = USE_CASE_PAGE_TEMPLATE.replace('{/* title */}', useCase.title)
|
|
368
|
+
.replace('{/* type */}', typeAndTags)
|
|
369
|
+
.replace('{/* description */}', (0, markdown_1.htmlDescription)(useCase.description));
|
|
370
|
+
// Attachments section
|
|
371
|
+
if (skipAttachments) {
|
|
372
|
+
// Leave marker for deferred replacement after minification
|
|
373
|
+
}
|
|
374
|
+
else if (useCase.attachmentsMd) {
|
|
375
|
+
const attachmentsHtml = `\n\n<div style={{ backgroundColor: '#EEE', margin: '32px 0', padding: '16px' }}>\n\n${useCase.attachmentsMd}\n\n </div>\n\n`;
|
|
376
|
+
page = page.replace('{/* attachments-md */}', attachmentsHtml);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
page = page.replace('{/* attachments-md */}', '');
|
|
380
|
+
}
|
|
381
|
+
// Tests section
|
|
382
|
+
page = page.replace('{/* test-panel */}', renderTestsSection(useCase.testResults, options?.repoSourceUrl));
|
|
383
|
+
return page;
|
|
384
|
+
}
|
|
385
|
+
//# sourceMappingURL=rendering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rendering.js","sourceRoot":"","sources":["../../src/reporters/rendering.ts"],"names":[],"mappings":";;AAWA,sCAEC;AAqBD,0CA6CC;AAQD,4CAUC;AASD,oDAIC;AASD,gDAQC;AASD,0DAIC;AAYD,sDASC;AAmBD,wDAuCC;AAsBD,0DAaC;AAwBD,gDA4CC;AA6G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AAC,IAAI,CAAC,IAAI,IAAA,uBAAc,EAAC,OAAO,CAAC,WAAW,CAAC,IAAI,IAAA,sBAAa,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAErH,mCAAmC;IACnC,IAAI,IAAI,GAAG,sBAAsB,CAAC,OAAO,CACvC,eAAe,EACf,OAAO,CAAC,KAAK,CACd;SACE,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC;SACpC,OAAO,CAAC,qBAAqB,EAAE,IAAA,0BAAe,EAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAExE,sBAAsB;IACtB,IAAI,eAAe,EAAE,CAAC;QACpB,2DAA2D;IAC7D,CAAC;SAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,uFAAuF,OAAO,CAAC,aAAa,iBAAiB,CAAC;QACtJ,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,gBAAgB;IAChB,IAAI,GAAG,IAAI,CAAC,OAAO,CACjB,oBAAoB,EACpB,kBAAkB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,CAChE,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Reporter Templates
|
|
2
|
+
|
|
3
|
+
These templates are used by the **domain reporter** to render the **intro page** of the domain documentation.
|
|
4
|
+
|
|
5
|
+
## What they generate
|
|
6
|
+
|
|
7
|
+
| Template file | Used by | Generates | Docusaurus URL |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `cards-container.template.jsx` | `generateIntro()` in `../generate-domain-documentation.ts` | `docs/package-root-intro.md` | `/docs/package-root-intro` |
|
|
10
|
+
| `card.template.jsx` | ^ same | ^ same | ^ same |
|
|
11
|
+
|
|
12
|
+
## What they do NOT generate
|
|
13
|
+
|
|
14
|
+
- `/docs/category/aggregates` — that's a Docusaurus auto-generated category index (from `_category_.json`)
|
|
15
|
+
- `/docs/category/domain-artifacts` — same
|
|
16
|
+
- `/docs/domain/*.md` — artifact pages are rendered by `../rendering.ts`, not these templates
|
|
17
|
+
- `/docs/aggregates/*.md` — same
|
|
18
|
+
|
|
19
|
+
## How to iterate on these templates
|
|
20
|
+
|
|
21
|
+
1. Edit `cards-container.template.jsx` or `card.template.jsx`
|
|
22
|
+
2. Run `regenerate_fixture_docs.sh` from the repo root
|
|
23
|
+
3. Open `/docs/package-root-intro` in Docusaurus to see the changes
|
|
24
|
+
4. Run `UPDATE_GOLDENS=true npx jest --runInBand generate-documentation.char` to update the golden file once satisfied
|
|
25
|
+
|
|
26
|
+
## Test coverage
|
|
27
|
+
|
|
28
|
+
The intro page output is protected by a characterization test (`generate-documentation.char.spec.ts`). Any change to these templates will cause the test to fail — regenerate the golden file to accept intentional changes.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<div style={{flex: "0 1 280px", borderRadius: "8px", boxShadow: "0 2px 4px rgba(0,0,0,0.1)", padding: "16px", backgroundColor: "white"}}>
|
|
2
|
+
<h2 style={{margin: "0 0 12px 0", color: "#333", fontSize: "20px"}}><a href="/docs/domain/{/* name-link */}">{/* name */}</a></h2>
|
|
3
|
+
<p style={{margin: 0, color: "#666", lineHeight: 1.5}}>{/* description */}</p>
|
|
4
|
+
</div>
|
|
5
|
+
{/* card */}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/** A JSDoc custom tag (e.g., @scenario, @edge-case). */
|
|
2
|
+
export interface Tag {
|
|
3
|
+
title: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/** A single test assertion result. */
|
|
7
|
+
export interface TestResult {
|
|
8
|
+
ancestorTitles: string[];
|
|
9
|
+
duration: number;
|
|
10
|
+
failureMessages: string[];
|
|
11
|
+
fullName: string;
|
|
12
|
+
status: 'passed' | 'failed' | 'pending' | 'todo';
|
|
13
|
+
title: string;
|
|
14
|
+
/** Optional test annotation extracted from JSDoc comments above the it() block. */
|
|
15
|
+
annotation?: {
|
|
16
|
+
description: string;
|
|
17
|
+
tags: Tag[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** A test file with aggregated counts and individual test results. */
|
|
21
|
+
export interface TestFile {
|
|
22
|
+
numFailingTests: number;
|
|
23
|
+
numPassingTests: number;
|
|
24
|
+
numPendingTests: number;
|
|
25
|
+
numTodoTests: number;
|
|
26
|
+
testFilePath: string;
|
|
27
|
+
testResults: TestResult[];
|
|
28
|
+
}
|
|
29
|
+
/** A raw property as it appears inside a JSDoc element's .properties array. */
|
|
30
|
+
export interface JsdocProperty {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
type?: {
|
|
34
|
+
names: string[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** A single JSDoc element from jsdoc-to-json output. */
|
|
38
|
+
export interface JsdocElem {
|
|
39
|
+
comment: string;
|
|
40
|
+
meta: {
|
|
41
|
+
filename: string;
|
|
42
|
+
path: string;
|
|
43
|
+
code: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
deprecated?: string;
|
|
50
|
+
params: Param[];
|
|
51
|
+
examples: string[];
|
|
52
|
+
returns: Return[];
|
|
53
|
+
properties?: JsdocProperty[];
|
|
54
|
+
/** Custom tags (e.g., @scenario, @edge-case). Present when JSDoc doclet has tags. */
|
|
55
|
+
tags?: Tag[];
|
|
56
|
+
}
|
|
57
|
+
export interface Param {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
type?: {
|
|
61
|
+
names: string[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export interface Return {
|
|
65
|
+
type: {
|
|
66
|
+
names: string[];
|
|
67
|
+
};
|
|
68
|
+
description: string;
|
|
69
|
+
}
|
|
70
|
+
/** A raw artifact as read from artifacts.json. */
|
|
71
|
+
export interface ArtifactRaw {
|
|
72
|
+
name: string;
|
|
73
|
+
type: string;
|
|
74
|
+
jsondocMustMatchPath: string;
|
|
75
|
+
category?: string;
|
|
76
|
+
description?: string;
|
|
77
|
+
}
|
|
78
|
+
/** Parsed YAML definition for an artifact or use-case. */
|
|
79
|
+
export interface DefinitionData {
|
|
80
|
+
title?: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
type?: string;
|
|
83
|
+
modelStatus?: string;
|
|
84
|
+
tags?: string[];
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
/** A property extracted from JSDoc props.ts entries. */
|
|
88
|
+
export interface Property {
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
type: string;
|
|
92
|
+
}
|
|
93
|
+
/** A ClassProperty extracted from JSDoc definition.ts entries. */
|
|
94
|
+
export interface ClassProperty {
|
|
95
|
+
name: string;
|
|
96
|
+
type: 'ClassProperty';
|
|
97
|
+
comment: string;
|
|
98
|
+
deprecated: string;
|
|
99
|
+
description: string;
|
|
100
|
+
params: Param[];
|
|
101
|
+
examples: string[];
|
|
102
|
+
returns: Return[];
|
|
103
|
+
}
|
|
104
|
+
/** A MethodDefinition extracted from JSDoc definition.ts entries. */
|
|
105
|
+
export interface MethodDefinition {
|
|
106
|
+
name: string;
|
|
107
|
+
type: 'MethodDefinition';
|
|
108
|
+
comment: string;
|
|
109
|
+
deprecated: string;
|
|
110
|
+
description: string;
|
|
111
|
+
params: Param[];
|
|
112
|
+
examples: string[];
|
|
113
|
+
returns: Return[];
|
|
114
|
+
}
|
|
115
|
+
/** An artifact fully enriched with JSDoc data, YAML definition, and test results. */
|
|
116
|
+
export interface EnrichedArtifact {
|
|
117
|
+
name: string;
|
|
118
|
+
type: string;
|
|
119
|
+
jsondocMustMatchPath: string;
|
|
120
|
+
category?: string;
|
|
121
|
+
description?: string;
|
|
122
|
+
id: string;
|
|
123
|
+
idMarkdown: string;
|
|
124
|
+
title: string;
|
|
125
|
+
properties: Property[];
|
|
126
|
+
classProperties: ClassProperty[];
|
|
127
|
+
methodDefinitions: MethodDefinition[];
|
|
128
|
+
tags: string[];
|
|
129
|
+
hasAttachments: boolean;
|
|
130
|
+
attachmentsMd: string;
|
|
131
|
+
testResults: TestFile[];
|
|
132
|
+
numPassingTests: number;
|
|
133
|
+
numFailingTests: number;
|
|
134
|
+
numPendingTests: number;
|
|
135
|
+
numTodoTests: number;
|
|
136
|
+
}
|
|
137
|
+
/** A documentation context (one reporter invocation per package root). */
|
|
138
|
+
export interface EnrichedContext {
|
|
139
|
+
name: string;
|
|
140
|
+
title: string;
|
|
141
|
+
artifacts: EnrichedArtifact[];
|
|
142
|
+
}
|
|
143
|
+
/** Loaded template strings used by render functions. */
|
|
144
|
+
export interface Templates {
|
|
145
|
+
artifactTemplate: string;
|
|
146
|
+
testTemplate: string;
|
|
147
|
+
propertiesTemplate: string;
|
|
148
|
+
methodDefinitionTemplate: string;
|
|
149
|
+
exampleTemplate: string;
|
|
150
|
+
}
|
|
151
|
+
/** A rendered artifact page ready for writing. */
|
|
152
|
+
export interface ArtifactPage {
|
|
153
|
+
markdown: string;
|
|
154
|
+
destPaths: string[];
|
|
155
|
+
}
|
|
156
|
+
/** A raw use-case built from a folder's definition.yaml and attachments.md. */
|
|
157
|
+
export interface UseCaseRaw {
|
|
158
|
+
title: string;
|
|
159
|
+
description: string;
|
|
160
|
+
type: string;
|
|
161
|
+
modelStatus: string;
|
|
162
|
+
tags: string[];
|
|
163
|
+
attachmentsMd: string;
|
|
164
|
+
path: string;
|
|
165
|
+
}
|
|
166
|
+
/** A fully enriched use-case ready for rendering. */
|
|
167
|
+
export interface EnrichedUseCase extends UseCaseRaw {
|
|
168
|
+
id: string;
|
|
169
|
+
idMarkdown: string;
|
|
170
|
+
testResults: TestFile[];
|
|
171
|
+
numPassingTests: number;
|
|
172
|
+
numFailingTests: number;
|
|
173
|
+
numPendingTests: number;
|
|
174
|
+
numTodoTests: number;
|
|
175
|
+
}
|
|
176
|
+
/** A rendered use-case page ready for writing. */
|
|
177
|
+
export interface UseCasePage {
|
|
178
|
+
markdown: string;
|
|
179
|
+
destPath: string;
|
|
180
|
+
}
|
|
181
|
+
/** A single artifact entry in the static manifest for the searchable table. */
|
|
182
|
+
export interface ArtifactManifestEntry {
|
|
183
|
+
name: string;
|
|
184
|
+
type: string;
|
|
185
|
+
tags: string[];
|
|
186
|
+
contextName: string;
|
|
187
|
+
description: string;
|
|
188
|
+
idMarkdown: string;
|
|
189
|
+
categories: string[];
|
|
190
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Shared data types for the reporter decomposition layers.
|
|
4
|
+
// These serve as the contract between data-loading, data-transformation,
|
|
5
|
+
// rendering, and file-writing.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reporters/types.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,2DAA2D;AAC3D,yEAAyE;AACzE,+BAA+B;AAC/B,8EAA8E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assembles (or re-assembles if needed) the Docusaurus scaffold into the
|
|
3
|
+
* .ultra-reporter/docusaurus/ directory.
|
|
4
|
+
*
|
|
5
|
+
* @param configDir - Directory containing ultra-reporter.config.json
|
|
6
|
+
* @param libraryTemplateDir - Path to the library's templates/documentation/ directory
|
|
7
|
+
* @param force - If true, re-assemble even if version matches
|
|
8
|
+
*/
|
|
9
|
+
export declare function assembleScaffold(configDir: string, libraryTemplateDir: string, force?: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if an existing scaffold is up-to-date.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isScaffoldCurrent(docusaurusDir: string): boolean;
|