@patternfly/documentation-framework 6.36.4 → 6.36.5
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/CHANGELOG.md +11 -0
- package/package.json +2 -2
- package/scripts/cli/build.js +1 -1
- package/scripts/cli/cli.js +4 -4
- package/scripts/cli/generate.js +4 -2
- package/scripts/cli/start.js +1 -1
- package/scripts/md/parseMD.js +21 -7
- package/scripts/tsDocgen.js +13 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.36.5 (2026-03-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Changes for docs-gen v6 ESM compatibility ([#4956](https://github.com/patternfly/patternfly-org/issues/4956)) ([ce09638](https://github.com/patternfly/patternfly-org/commit/ce0963869e626e790ff36f59d745a625c7b36bdf))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 6.36.4 (2026-03-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "6.36.
|
|
4
|
+
"version": "6.36.5",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"http-cache-semantics": ">=4.1.1",
|
|
93
93
|
"nanoid": "3.3.8"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "c42c9792d7641cf637444c81074af628e7811ea7"
|
|
96
96
|
}
|
package/scripts/cli/build.js
CHANGED
package/scripts/cli/cli.js
CHANGED
|
@@ -9,17 +9,17 @@ program
|
|
|
9
9
|
program
|
|
10
10
|
.command('generate')
|
|
11
11
|
.description('generates source files')
|
|
12
|
-
.action(options => {
|
|
12
|
+
.action(async options => {
|
|
13
13
|
const { generate } = require('./generate');
|
|
14
|
-
generate(options);
|
|
14
|
+
await generate(options);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
program
|
|
18
18
|
.command('start')
|
|
19
19
|
.description('generates source files and runs webpack-dev-server')
|
|
20
|
-
.action(options => {
|
|
20
|
+
.action(async options => {
|
|
21
21
|
const { start } = require('./start');
|
|
22
|
-
start(options);
|
|
22
|
+
await start(options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
program
|
package/scripts/cli/generate.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const { sourceMD, sourceProps, sourceFunctionDocs, writeIndex } = require('../md/parseMD');
|
|
2
|
+
const { sourceMD, sourceProps, sourceFunctionDocs, writeIndex, waitForProps, processMD } = require('../md/parseMD');
|
|
3
3
|
|
|
4
4
|
function getSource(options) {
|
|
5
5
|
return require(path.join(process.cwd(), options.parent.source));
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
function generate(options) {
|
|
8
|
+
async function generate(options) {
|
|
9
9
|
const start = new Date();
|
|
10
10
|
console.log('write source files to patternfly-docs/generated');
|
|
11
11
|
const sourceMDWithOptions = (glob, source, ignore) => sourceMD(glob, source, ignore, options._name);
|
|
12
12
|
getSource(options)(sourceMDWithOptions, sourceProps, sourceFunctionDocs);
|
|
13
|
+
await waitForProps();
|
|
14
|
+
processMD();
|
|
13
15
|
const exitCode = writeIndex();
|
|
14
16
|
if (exitCode !== 0) {
|
|
15
17
|
process.exit(exitCode);
|
package/scripts/cli/start.js
CHANGED
|
@@ -19,7 +19,7 @@ function startDevServer(webpackConfig) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async function start(options) {
|
|
22
|
-
generate(options, true);
|
|
22
|
+
await generate(options, true);
|
|
23
23
|
const webpackClientConfig = await clientConfig(null, { mode: 'development', ...getConfig(options) });
|
|
24
24
|
console.log('start rspack-dev-server');
|
|
25
25
|
watchMD();
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -19,6 +19,7 @@ const outputBase = path.join(process.cwd(), `patternfly-docs/generated`);
|
|
|
19
19
|
const tsDocs = {};
|
|
20
20
|
let functionDocs = {};
|
|
21
21
|
const routes = {};
|
|
22
|
+
const pendingProps = [];
|
|
22
23
|
const globs = {
|
|
23
24
|
props: [],
|
|
24
25
|
md: [],
|
|
@@ -267,8 +268,8 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
function sourcePropsFile(file) {
|
|
271
|
-
tsDocgen(file)
|
|
271
|
+
async function sourcePropsFile(file) {
|
|
272
|
+
(await tsDocgen(file))
|
|
272
273
|
.filter(({ hide }) => !hide)
|
|
273
274
|
.forEach(({ name, description, props }) => {
|
|
274
275
|
tsDocs[getTsDocName(name, getTsDocNameVariant(file))] = { name, description, props };
|
|
@@ -345,19 +346,32 @@ function getTsDocNameVariant(source) {
|
|
|
345
346
|
module.exports = {
|
|
346
347
|
sourceProps(glob, ignore) {
|
|
347
348
|
globs.props.push({ glob, ignore });
|
|
348
|
-
globSync(glob, { ignore }).
|
|
349
|
+
const promise = Promise.all(globSync(glob, { ignore }).map(sourcePropsFile));
|
|
350
|
+
pendingProps.push(promise);
|
|
351
|
+
},
|
|
352
|
+
async waitForProps() {
|
|
353
|
+
await Promise.all(pendingProps);
|
|
349
354
|
},
|
|
350
355
|
sourceMD(glob, source, ignore, buildMode) {
|
|
351
|
-
globs.md.push({ glob, source, ignore });
|
|
352
|
-
|
|
356
|
+
globs.md.push({ glob, source, ignore, buildMode });
|
|
357
|
+
},
|
|
358
|
+
processMD() {
|
|
359
|
+
globs.md.forEach(({ glob, source, ignore, buildMode }) => {
|
|
360
|
+
globSync(glob, { ignore }).forEach(file => sourceMDFile(file, source, buildMode));
|
|
361
|
+
});
|
|
353
362
|
},
|
|
354
363
|
sourceFunctionDocs,
|
|
355
364
|
writeIndex,
|
|
356
365
|
watchMD() {
|
|
357
366
|
globs.props.forEach(({ glob, ignore }) => {
|
|
358
367
|
const propWatcher = chokidar.watch(globSync(glob, { ignored: ignore, ignoreInitial: true}));
|
|
359
|
-
|
|
360
|
-
|
|
368
|
+
const onPropFile = (file) => {
|
|
369
|
+
sourcePropsFile(file).catch((err) => {
|
|
370
|
+
console.error('Error updating props from', file, err);
|
|
371
|
+
});
|
|
372
|
+
};
|
|
373
|
+
propWatcher.on('add', onPropFile);
|
|
374
|
+
propWatcher.on('change', onPropFile);
|
|
361
375
|
});
|
|
362
376
|
globs.md.forEach(({ glob, source, ignore }) => {
|
|
363
377
|
const mdWatcher = chokidar.watch(globSync(glob, { ignored: ignore, ignoreInitial: true }));
|
package/scripts/tsDocgen.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
|
-
const reactDocgen = require("react-docgen");
|
|
3
2
|
const ts = require("typescript");
|
|
4
3
|
|
|
4
|
+
// react-docgen v6+ is ESM-only; lazy-load it asynchronously on first use
|
|
5
|
+
let reactDocgenReady = null;
|
|
6
|
+
function loadReactDocgen() {
|
|
7
|
+
if (!reactDocgenReady) {
|
|
8
|
+
reactDocgenReady = import("react-docgen");
|
|
9
|
+
}
|
|
10
|
+
return reactDocgenReady;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
const annotations = [
|
|
6
14
|
{
|
|
7
15
|
regex: /@deprecated/,
|
|
@@ -41,7 +49,8 @@ function addAnnotations(prop) {
|
|
|
41
49
|
return prop;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
function getComponentMetadata(filename, sourceText) {
|
|
52
|
+
async function getComponentMetadata(filename, sourceText) {
|
|
53
|
+
const reactDocgen = await loadReactDocgen();
|
|
45
54
|
let parsedComponents = null;
|
|
46
55
|
try {
|
|
47
56
|
parsedComponents = reactDocgen.parse(sourceText, {
|
|
@@ -159,9 +168,9 @@ function normalizeProp([
|
|
|
159
168
|
return res;
|
|
160
169
|
}
|
|
161
170
|
|
|
162
|
-
function tsDocgen(file) {
|
|
171
|
+
async function tsDocgen(file) {
|
|
163
172
|
const sourceText = fs.readFileSync(file, "utf8");
|
|
164
|
-
const componentMeta = getComponentMetadata(file, sourceText); // Array of components with props
|
|
173
|
+
const componentMeta = await getComponentMetadata(file, sourceText); // Array of components with props
|
|
165
174
|
const interfaceMeta = getInterfaceMetadata(file, sourceText); // Array of interfaces with props
|
|
166
175
|
const typeAliasMeta = getTypeAliasMetadata(file, sourceText); // Array of type aliases with props
|
|
167
176
|
const propsMetaMap = [...interfaceMeta, ...typeAliasMeta].reduce(function (
|