@patternfly/documentation-framework 2.0.0-alpha.3 → 2.0.0-alpha.31
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 +266 -0
- package/app.js +12 -11
- package/components/cssVariables/cssSearch.js +3 -4
- package/components/cssVariables/cssVariables.js +69 -67
- package/components/functionsTable/functionsTable.js +57 -0
- package/components/propsTable/propsTable.js +85 -79
- package/components/sectionGallery/sectionDataListLayout.js +67 -0
- package/components/sectionGallery/sectionGallery.css +44 -0
- package/components/sectionGallery/sectionGallery.js +53 -0
- package/components/sectionGallery/sectionGalleryLayout.js +37 -0
- package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
- package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
- package/components/sideNav/sideNav.js +10 -3
- package/helpers/getTitle.js +2 -2
- package/layouts/sideNavLayout/sideNavLayout.css +0 -4
- package/layouts/sideNavLayout/sideNavLayout.js +54 -37
- package/package.json +28 -25
- package/pages/404/index.js +3 -3
- package/routes.js +19 -5
- package/scripts/cli/build.js +6 -0
- package/scripts/cli/cli.js +2 -0
- package/scripts/cli/generate.js +2 -2
- package/scripts/cli/start.js +6 -8
- package/scripts/md/parseMD.js +40 -8
- package/scripts/tsDocgen.js +119 -91
- package/scripts/typeDocGen.js +209 -0
- package/scripts/webpack/webpack.base.config.js +34 -32
- package/scripts/webpack/webpack.client.config.js +11 -8
- package/scripts/webpack/webpack.server.config.js +8 -5
- package/scripts/writeScreenshots.js +2 -2
- package/templates/html.ejs +1 -3
- package/templates/mdx.css +0 -5
- package/templates/mdx.js +58 -41
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
- package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
- package/versions.json +29 -9
|
@@ -3,17 +3,19 @@ import {
|
|
|
3
3
|
Button,
|
|
4
4
|
Page,
|
|
5
5
|
PageSidebar,
|
|
6
|
+
PageSidebarBody,
|
|
6
7
|
Brand,
|
|
7
8
|
Dropdown,
|
|
8
|
-
DropdownToggle,
|
|
9
9
|
DropdownItem,
|
|
10
10
|
DropdownGroup,
|
|
11
|
+
DropdownList,
|
|
11
12
|
Divider,
|
|
12
13
|
Masthead,
|
|
13
14
|
MastheadToggle,
|
|
14
15
|
MastheadMain,
|
|
15
16
|
MastheadContent,
|
|
16
17
|
MastheadBrand,
|
|
18
|
+
MenuToggle,
|
|
17
19
|
PageToggleButton,
|
|
18
20
|
Toolbar,
|
|
19
21
|
ToolbarGroup,
|
|
@@ -23,7 +25,6 @@ import {
|
|
|
23
25
|
Switch,
|
|
24
26
|
SearchInput
|
|
25
27
|
} from '@patternfly/react-core';
|
|
26
|
-
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
|
|
27
28
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
28
29
|
import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';
|
|
29
30
|
import { SideNav, TopNav, GdprBanner } from '../../components';
|
|
@@ -48,14 +49,9 @@ const HeaderTools = ({
|
|
|
48
49
|
const [isSearchExpanded, setIsSearchExpanded] = React.useState(false);
|
|
49
50
|
|
|
50
51
|
const getDropdownItem = (version, isLatest = false) => (
|
|
51
|
-
<DropdownItem
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<a href={isLatest ? '/' : `/${version.name}`}>
|
|
55
|
-
{`Release ${version.name}`}
|
|
56
|
-
</a>
|
|
57
|
-
}
|
|
58
|
-
/>
|
|
52
|
+
<DropdownItem itemId={version.name} key={version.name} to={isLatest ? '/' : `/${version.name}`}>
|
|
53
|
+
{`Release ${version.name}`}
|
|
54
|
+
</DropdownItem>
|
|
59
55
|
);
|
|
60
56
|
|
|
61
57
|
const onChange = (_evt, value) => {
|
|
@@ -82,7 +78,7 @@ const HeaderTools = ({
|
|
|
82
78
|
</ToolbarItem>
|
|
83
79
|
)}
|
|
84
80
|
<ToolbarGroup
|
|
85
|
-
|
|
81
|
+
align={{ default: 'alignRight' }}
|
|
86
82
|
spaceItems={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
87
83
|
>
|
|
88
84
|
{hasDarkThemeSwitcher && (
|
|
@@ -117,42 +113,60 @@ const HeaderTools = ({
|
|
|
117
113
|
{hasVersionSwitcher && (
|
|
118
114
|
<ToolbarItem>
|
|
119
115
|
<Dropdown
|
|
120
|
-
isFullHeight
|
|
121
116
|
onSelect={() => setDropdownOpen(!isDropdownOpen)}
|
|
117
|
+
onOpenChange={(isOpen) => setDropdownOpen(isOpen)}
|
|
122
118
|
isOpen={isDropdownOpen}
|
|
123
|
-
toggle={(
|
|
124
|
-
<
|
|
125
|
-
|
|
119
|
+
toggle={(toggleRef) => (
|
|
120
|
+
<MenuToggle
|
|
121
|
+
isFullHeight
|
|
122
|
+
ref={toggleRef}
|
|
123
|
+
onClick={() => setDropdownOpen(!isDropdownOpen)}
|
|
124
|
+
isExpanded={isDropdownOpen}
|
|
126
125
|
>
|
|
127
126
|
Release {initialVersion.name}
|
|
128
|
-
</
|
|
127
|
+
</MenuToggle>
|
|
129
128
|
)}
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
>
|
|
130
|
+
<DropdownGroup key="Latest" label="Latest">
|
|
131
|
+
<DropdownList>
|
|
132
132
|
{getDropdownItem(latestVersion, true)}
|
|
133
|
-
</
|
|
134
|
-
|
|
133
|
+
</DropdownList>
|
|
134
|
+
</DropdownGroup>
|
|
135
|
+
<DropdownGroup key="Previous releases" label="Previous releases">
|
|
136
|
+
<DropdownList>
|
|
135
137
|
{Object.values(versions.Releases)
|
|
136
138
|
.filter(version => !version.hidden && !version.latest)
|
|
137
139
|
.slice(0,3)
|
|
138
140
|
.map(version => getDropdownItem(version))}
|
|
139
|
-
</
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
</DropdownList>
|
|
142
|
+
</DropdownGroup>
|
|
143
|
+
<Divider key="divider" className="ws-switcher-divider"/>
|
|
144
|
+
<DropdownGroup key="Previous versions" label="Previous versions">
|
|
145
|
+
<DropdownList>
|
|
146
|
+
<DropdownItem
|
|
147
|
+
key="PatternFly 4"
|
|
148
|
+
className="ws-patternfly-3"
|
|
149
|
+
isExternalLink
|
|
150
|
+
to="http://v4-archive.patternfly.org/v4/"
|
|
151
|
+
itemId="patternfly-4"
|
|
152
|
+
>
|
|
153
|
+
PatternFly 4
|
|
154
|
+
</DropdownItem>
|
|
155
|
+
<DropdownItem
|
|
156
|
+
key="PatternFly 3"
|
|
157
|
+
className="ws-patternfly-3"
|
|
158
|
+
isExternalLink
|
|
159
|
+
to="https://pf3.patternfly.org/"
|
|
160
|
+
itemId="patternfly-3"
|
|
161
|
+
>
|
|
162
|
+
PatternFly 3
|
|
163
|
+
</DropdownItem>
|
|
164
|
+
</DropdownList>
|
|
165
|
+
</DropdownGroup>
|
|
166
|
+
</Dropdown>
|
|
152
167
|
</ToolbarItem>
|
|
153
168
|
)}
|
|
154
|
-
</ToolbarGroup>
|
|
155
|
-
</ToolbarContent>
|
|
169
|
+
</ToolbarGroup></ToolbarContent>
|
|
156
170
|
</Toolbar>
|
|
157
171
|
);
|
|
158
172
|
}
|
|
@@ -205,8 +219,11 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
205
219
|
<PageSidebar
|
|
206
220
|
className="ws-page-sidebar"
|
|
207
221
|
theme="light"
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
>
|
|
223
|
+
<PageSidebarBody>
|
|
224
|
+
<SideNav navItems={sideNavItems} groupedRoutes={groupedRoutes} />
|
|
225
|
+
</PageSidebarBody>
|
|
226
|
+
</PageSidebar>
|
|
210
227
|
);
|
|
211
228
|
|
|
212
229
|
const Header = (
|
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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.31",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"@babel/preset-env": "7.18.2",
|
|
23
23
|
"@mdx-js/util": "1.6.16",
|
|
24
24
|
"@patternfly/ast-helpers": "^0.4.57",
|
|
25
|
-
"@reach/router": "1.3.
|
|
25
|
+
"@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
|
|
26
26
|
"autoprefixer": "9.8.6",
|
|
27
|
-
"babel-loader": "
|
|
27
|
+
"babel-loader": "9.1.2",
|
|
28
28
|
"camelcase-css": "2.0.1",
|
|
29
29
|
"chokidar": "3.5.3",
|
|
30
|
-
"clean-webpack-plugin": "
|
|
30
|
+
"clean-webpack-plugin": "4.0.0",
|
|
31
31
|
"codesandbox": "2.2.0",
|
|
32
32
|
"commander": "4.1.1",
|
|
33
|
-
"copy-webpack-plugin": "
|
|
34
|
-
"css-loader": "
|
|
33
|
+
"copy-webpack-plugin": "11.0.0",
|
|
34
|
+
"css-loader": "6.7.3",
|
|
35
35
|
"detab": "2.0.3",
|
|
36
36
|
"express": "4.18.1",
|
|
37
|
-
"file-loader": "6.
|
|
37
|
+
"file-loader": "6.2.0",
|
|
38
38
|
"file-saver": "1.3.8",
|
|
39
39
|
"fs-extra": "9.0.1",
|
|
40
40
|
"glob": "8.0.3",
|
|
@@ -42,51 +42,54 @@
|
|
|
42
42
|
"hast-to-hyperscript": "9.0.0",
|
|
43
43
|
"hast-util-to-text": "2.0.0",
|
|
44
44
|
"html-formatter": "0.1.9",
|
|
45
|
-
"html-webpack-plugin": "
|
|
45
|
+
"html-webpack-plugin": "5.5.0",
|
|
46
46
|
"js-yaml": "3.14.0",
|
|
47
47
|
"mdast-util-to-hast": "9.1.1",
|
|
48
48
|
"mdurl": "1.0.1",
|
|
49
|
-
"mini-css-extract-plugin": "
|
|
50
|
-
"monaco-editor": "0.
|
|
51
|
-
"monaco-editor-webpack-plugin": "
|
|
52
|
-
"null-loader": "4.0.
|
|
49
|
+
"mini-css-extract-plugin": "2.7.5",
|
|
50
|
+
"monaco-editor": "0.34.1",
|
|
51
|
+
"monaco-editor-webpack-plugin": "7.0.1",
|
|
52
|
+
"null-loader": "4.0.1",
|
|
53
53
|
"parse-entities": "2.0.0",
|
|
54
|
+
"path-browserify": "1.0.1",
|
|
54
55
|
"postcss": "7.0.32",
|
|
55
|
-
"postcss-loader": "
|
|
56
|
+
"postcss-loader": "7.1.0",
|
|
57
|
+
"process": "^0.11.10",
|
|
56
58
|
"puppeteer": "14.3.0",
|
|
57
59
|
"puppeteer-cluster": "0.23.0",
|
|
58
60
|
"react-docgen": "5.3.1",
|
|
59
|
-
"react-monaco-editor": "0.
|
|
60
|
-
"react-ssr-prepass": "1.
|
|
61
|
+
"react-monaco-editor": "^0.51.0",
|
|
62
|
+
"react-ssr-prepass": "1.5.0",
|
|
61
63
|
"remark-footnotes": "1.0.0",
|
|
62
64
|
"remark-frontmatter": "2.0.0",
|
|
63
65
|
"remark-mdx": "2.0.0-next.8",
|
|
64
66
|
"remark-mdxjs": "2.0.0-next.8",
|
|
65
67
|
"remark-parse": "8.0.3",
|
|
66
68
|
"remark-squeeze-paragraphs": "4.0.0",
|
|
67
|
-
"responsive-loader": "
|
|
69
|
+
"responsive-loader": "3.1.2",
|
|
68
70
|
"sharp": "0.30.6",
|
|
69
71
|
"style-to-object": "0.3.0",
|
|
70
72
|
"to-vfile": "6.1.0",
|
|
73
|
+
"typedoc": "0.22.X",
|
|
71
74
|
"typescript": "4.3.5",
|
|
72
75
|
"unified": "9.1.0",
|
|
73
76
|
"unist-util-remove": "2.0.0",
|
|
74
77
|
"unist-util-visit": "2.0.3",
|
|
75
78
|
"url-loader": "4.1.0",
|
|
76
79
|
"vfile-reporter": "6.0.1",
|
|
77
|
-
"webpack": "
|
|
78
|
-
"webpack-bundle-analyzer": "
|
|
79
|
-
"webpack-cli": "
|
|
80
|
-
"webpack-dev-server": "
|
|
80
|
+
"webpack": "5.76.3",
|
|
81
|
+
"webpack-bundle-analyzer": "4.8.0",
|
|
82
|
+
"webpack-cli": "5.0.1",
|
|
83
|
+
"webpack-dev-server": "4.13.1",
|
|
81
84
|
"webpack-merge": "5.8.0"
|
|
82
85
|
},
|
|
83
86
|
"peerDependencies": {
|
|
84
|
-
"@patternfly/patternfly": "^5.0.0-alpha.
|
|
85
|
-
"@patternfly/react-code-editor": "^5.0.0-alpha.
|
|
86
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
87
|
-
"@patternfly/react-table": "^5.0.0-alpha.
|
|
87
|
+
"@patternfly/patternfly": "^5.0.0-alpha.37",
|
|
88
|
+
"@patternfly/react-code-editor": "^5.0.0-alpha.84",
|
|
89
|
+
"@patternfly/react-core": "^5.0.0-alpha.83",
|
|
90
|
+
"@patternfly/react-table": "^5.0.0-alpha.85",
|
|
88
91
|
"react": "^17.0.0 || ^18.0.0",
|
|
89
92
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
90
93
|
},
|
|
91
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "46db0c1c334e7304290b8cc024bfdd40c887013b"
|
|
92
95
|
}
|
package/pages/404/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
CardTitle,
|
|
7
7
|
CardBody,
|
|
8
8
|
CardFooter,
|
|
9
|
-
|
|
9
|
+
CardHeader,
|
|
10
10
|
EmptyState,
|
|
11
11
|
EmptyStateBody,
|
|
12
12
|
EmptyStateIcon,
|
|
@@ -36,9 +36,9 @@ const Card404 = ({
|
|
|
36
36
|
}) => (
|
|
37
37
|
<GridItem xl={3} md={6} xs={12}>
|
|
38
38
|
<Card style={{ height: '340px' }}>
|
|
39
|
-
<
|
|
39
|
+
<CardHeader className="ws-404-card-header">
|
|
40
40
|
<img src={img} alt={alt} width="64px" />
|
|
41
|
-
</
|
|
41
|
+
</CardHeader>
|
|
42
42
|
<CardTitle>
|
|
43
43
|
{title}
|
|
44
44
|
</CardTitle>
|
package/routes.js
CHANGED
|
@@ -9,6 +9,8 @@ const routes = {
|
|
|
9
9
|
...generatedRoutes
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const defaultOrder = 50;
|
|
13
|
+
|
|
12
14
|
for (let route in routes) {
|
|
13
15
|
const pageData = routes[route];
|
|
14
16
|
if (pageData.SyncComponent) {
|
|
@@ -28,7 +30,7 @@ const isNull = o => o === null || o === undefined;
|
|
|
28
30
|
const groupedRoutes = Object.entries(routes)
|
|
29
31
|
.filter(([_slug, { id, section }]) => !isNull(id) && !isNull(section))
|
|
30
32
|
.reduce((accum, [slug, pageData]) => {
|
|
31
|
-
const { section, subsection = null, id, title, source,
|
|
33
|
+
const { section, subsection = null, id, title, source, hideNavItem, relPath, sortValue = null, subsectionSortValue = null } = pageData;
|
|
32
34
|
pageData.slug = slug;
|
|
33
35
|
// add section to groupedRoutes obj if not yet created
|
|
34
36
|
accum[section] = accum[section] || {};
|
|
@@ -40,9 +42,10 @@ const groupedRoutes = Object.entries(routes)
|
|
|
40
42
|
title,
|
|
41
43
|
slug: makeSlug(source, section, id, true, subsection),
|
|
42
44
|
sources: [],
|
|
43
|
-
katacodaLayout,
|
|
44
45
|
hideNavItem,
|
|
45
|
-
relPath
|
|
46
|
+
relPath,
|
|
47
|
+
...(sortValue && { sortValue }),
|
|
48
|
+
...(subsectionSortValue && { subsectionSortValue })
|
|
46
49
|
}
|
|
47
50
|
// add page to groupedRoutes obj section or subsection
|
|
48
51
|
if (subsection) {
|
|
@@ -52,10 +55,21 @@ const groupedRoutes = Object.entries(routes)
|
|
|
52
55
|
// add page to subsection
|
|
53
56
|
accum[section][subsection][id] = accum[section][subsection][id] || data;
|
|
54
57
|
accum[section][subsection][id].sources.push(pageData);
|
|
58
|
+
// nav item ordering
|
|
59
|
+
if (sortValue) {
|
|
60
|
+
accum[section][subsection].sortValue = sortValue;
|
|
61
|
+
}
|
|
62
|
+
if (subsectionSortValue) {
|
|
63
|
+
accum[section][subsection].subsectionSortValue = subsectionSortValue;
|
|
64
|
+
}
|
|
55
65
|
} else {
|
|
56
66
|
// add page to section
|
|
57
67
|
accum[section][id] = accum[section][id] || data;
|
|
58
68
|
accum[section][id].sources.push(pageData);
|
|
69
|
+
// nav item ordering
|
|
70
|
+
if (sortValue) {
|
|
71
|
+
accum[section][id].sortValue = sortValue;
|
|
72
|
+
}
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
return accum;
|
|
@@ -73,7 +87,6 @@ const sourceOrder = {
|
|
|
73
87
|
'design-guidelines': 99,
|
|
74
88
|
'accessibility': 100
|
|
75
89
|
};
|
|
76
|
-
const defaultOrder = 50;
|
|
77
90
|
|
|
78
91
|
const sortSources = ({ source: s1 }, { source: s2 }) => {
|
|
79
92
|
const s1Index = sourceOrder[s1] || defaultOrder;
|
|
@@ -108,7 +121,8 @@ Object.entries(groupedRoutes)
|
|
|
108
121
|
// Loop through each page in expandable subsection
|
|
109
122
|
if (pageData.isSubsection) {
|
|
110
123
|
Object.entries(pageData).map(([section, ids]) => {
|
|
111
|
-
|
|
124
|
+
// only push nested page objects
|
|
125
|
+
if (ids && ids?.id) {
|
|
112
126
|
pageDataArr.push(ids);
|
|
113
127
|
}
|
|
114
128
|
})
|
package/scripts/cli/build.js
CHANGED
|
@@ -50,6 +50,11 @@ async function execFile(file, args) {
|
|
|
50
50
|
const child_execArgv = [
|
|
51
51
|
'--max-old-space-size=4096'
|
|
52
52
|
];
|
|
53
|
+
|
|
54
|
+
if (args.legacySSL) {
|
|
55
|
+
child_execArgv.push('--openssl-legacy-provider')
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
const child = fork(path.join(__dirname, file), child_argv, { execArgv: child_execArgv });
|
|
54
59
|
function errorHandler(err) {
|
|
55
60
|
console.error(err);
|
|
@@ -78,6 +83,7 @@ async function build(cmd, options) {
|
|
|
78
83
|
const config = getConfig(options);
|
|
79
84
|
config.analyze = options.analyze;
|
|
80
85
|
config.output = options.output;
|
|
86
|
+
config.legacySSL = options.legacySSL
|
|
81
87
|
|
|
82
88
|
// These get passed to `fork`ed builds
|
|
83
89
|
process.env.pathPrefix = config.pathPrefix;
|
package/scripts/cli/cli.js
CHANGED
|
@@ -26,6 +26,7 @@ program
|
|
|
26
26
|
.command('build <server|client|all>')
|
|
27
27
|
.option('-a, --analyze', 'use webpack-bundle-analyzer', false)
|
|
28
28
|
.option('-o, --output <folder>', 'output folder', 'public')
|
|
29
|
+
.option('--legacySSL', 'use legacy version of openssl, needed to support Node 18 until we upgrade webpack to v5', false)
|
|
29
30
|
.description('generates source files and runs webpack')
|
|
30
31
|
.action((cmd, options) => {
|
|
31
32
|
const { build } = require('./build');
|
|
@@ -44,6 +45,7 @@ program
|
|
|
44
45
|
program
|
|
45
46
|
.command('screenshots')
|
|
46
47
|
.option('-u, --urlPrefix <prefix>', 'where fullscreen pages are hosted', 'http://localhost:5000/v4')
|
|
48
|
+
.option('-a, --allRoutes', 'true if screenshots of all examples - not just full screen', false)
|
|
47
49
|
.description('updates screenshots for generated components')
|
|
48
50
|
.action(options => {
|
|
49
51
|
const { writeScreenshots } = require('../writeScreenshots');
|
package/scripts/cli/generate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const { sourceMD, sourceProps, writeIndex } = require('../md/parseMD');
|
|
2
|
+
const { sourceMD, sourceProps, sourceFunctionDocs, writeIndex } = require('../md/parseMD');
|
|
3
3
|
|
|
4
4
|
function getSource(options) {
|
|
5
5
|
return require(path.join(process.cwd(), options.parent.source));
|
|
@@ -9,7 +9,7 @@ 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
|
-
getSource(options)(sourceMDWithOptions, sourceProps);
|
|
12
|
+
getSource(options)(sourceMDWithOptions, sourceProps, sourceFunctionDocs);
|
|
13
13
|
const exitCode = writeIndex();
|
|
14
14
|
if (exitCode !== 0) {
|
|
15
15
|
process.exit(exitCode);
|
package/scripts/cli/start.js
CHANGED
|
@@ -6,17 +6,15 @@ const { getConfig } = require('./helpers');
|
|
|
6
6
|
const { watchMD } = require('../md/parseMD');
|
|
7
7
|
|
|
8
8
|
function startWebpackDevServer(webpackConfig) {
|
|
9
|
-
webpackConfig.devServer.
|
|
10
|
-
webpackConfig.devServer.publicPath = webpackConfig.output.publicPath;
|
|
9
|
+
webpackConfig.devServer.static = false;
|
|
11
10
|
const { port } = webpackConfig.devServer;
|
|
12
11
|
const compiler = webpack(webpackConfig);
|
|
13
|
-
const server = new WebpackDevServer(
|
|
12
|
+
const server = new WebpackDevServer(webpackConfig.devServer, compiler);
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
14
|
+
(async () => {
|
|
15
|
+
await server.start();
|
|
16
|
+
console.log(`Dev server is listening on port ${port}`);
|
|
17
|
+
})();
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async function start(options) {
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -12,10 +12,12 @@ const { typecheck } = require('./typecheck');
|
|
|
12
12
|
const { makeSlug } = require('../../helpers/slugger');
|
|
13
13
|
const { liveCodeTypes } = require('../../helpers/liveCodeTypes');
|
|
14
14
|
const { tsDocgen } = require('../tsDocgen');
|
|
15
|
+
const { getPackageFunctionDocumentation } = require("../typeDocGen");
|
|
15
16
|
|
|
16
17
|
let exitCode = 0;
|
|
17
18
|
const outputBase = path.join(process.cwd(), `patternfly-docs/generated`);
|
|
18
19
|
const tsDocs = {};
|
|
20
|
+
let functionDocs = {};
|
|
19
21
|
const routes = {};
|
|
20
22
|
const globs = {
|
|
21
23
|
props: [],
|
|
@@ -75,6 +77,24 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
75
77
|
return acc;
|
|
76
78
|
}, []);
|
|
77
79
|
|
|
80
|
+
const functionDocumentation = Object.keys(
|
|
81
|
+
frontmatter.functions || {}
|
|
82
|
+
).reduce((acc, fileName) => {
|
|
83
|
+
const functionNames = frontmatter.functions[fileName];
|
|
84
|
+
|
|
85
|
+
functionNames.forEach((functionName) => {
|
|
86
|
+
if (functionDocs[fileName] && functionDocs[fileName][functionName]) {
|
|
87
|
+
const functionDescriptionWithName = { functionName, ...functionDocs[fileName][functionName]}
|
|
88
|
+
acc.push(functionDescriptionWithName);
|
|
89
|
+
} else {
|
|
90
|
+
file.message(
|
|
91
|
+
`function documentation for ${functionName} is missing from function docs generation`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return acc;
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
78
98
|
const normalizedPath = relPath
|
|
79
99
|
.replace('node_modules/@patternfly/patternfly/docs', 'src/patternfly')
|
|
80
100
|
.replace(/node_modules\/@patternfly\/react-([\w-])/, (_, match) => `packages/react-${match}`)
|
|
@@ -85,6 +105,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
85
105
|
section: frontmatter.section || '',
|
|
86
106
|
subsection: frontmatter.subsection || '',
|
|
87
107
|
source,
|
|
108
|
+
tabName: frontmatter.tabName || null,
|
|
88
109
|
slug,
|
|
89
110
|
sourceLink: frontmatter.sourceLink || `https://github.com/patternfly/${
|
|
90
111
|
sourceRepo}/blob/main/${
|
|
@@ -106,6 +127,9 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
106
127
|
if (propComponents.length > 0) {
|
|
107
128
|
pageData.propComponents = propComponents;
|
|
108
129
|
}
|
|
130
|
+
if (functionDocumentation.length > 0) {
|
|
131
|
+
pageData.functionDocumentation = functionDocumentation;
|
|
132
|
+
}
|
|
109
133
|
if (frontmatter.optIn) {
|
|
110
134
|
pageData.optIn = frontmatter.optIn;
|
|
111
135
|
}
|
|
@@ -117,15 +141,15 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
117
141
|
? frontmatter.cssPrefix
|
|
118
142
|
: [frontmatter.cssPrefix];
|
|
119
143
|
}
|
|
120
|
-
if (frontmatter.katacodaBroken) {
|
|
121
|
-
pageData.katacodaBroken = frontmatter.katacodaBroken;
|
|
122
|
-
}
|
|
123
|
-
if (frontmatter.katacodaLayout) {
|
|
124
|
-
pageData.katacodaLayout = frontmatter.katacodaLayout;
|
|
125
|
-
}
|
|
126
144
|
if (frontmatter.hideNavItem) {
|
|
127
145
|
pageData.hideNavItem = frontmatter.hideNavItem;
|
|
128
146
|
}
|
|
147
|
+
if (frontmatter.sortValue) {
|
|
148
|
+
pageData.sortValue = frontmatter.sortValue;
|
|
149
|
+
}
|
|
150
|
+
if (frontmatter.subsectionSortValue) {
|
|
151
|
+
pageData.subsectionSortValue = frontmatter.subsectionSortValue;
|
|
152
|
+
}
|
|
129
153
|
})
|
|
130
154
|
// Delete HTML comments
|
|
131
155
|
.use(require('./remove-comments'))
|
|
@@ -266,12 +290,19 @@ function sourceMDFile(file, source, buildMode) {
|
|
|
266
290
|
section: pageData.section,
|
|
267
291
|
subsection: pageData.subsection,
|
|
268
292
|
source: pageData.source,
|
|
269
|
-
|
|
270
|
-
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
|
|
293
|
+
tabName: pageData.tabName,
|
|
294
|
+
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem }),
|
|
295
|
+
...(pageData.beta && { beta: pageData.beta }),
|
|
296
|
+
...(pageData.sortValue && { sortValue: pageData.sortValue }),
|
|
297
|
+
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
|
|
271
298
|
};
|
|
272
299
|
}
|
|
273
300
|
}
|
|
274
301
|
|
|
302
|
+
function sourceFunctionDocs(packageName) {
|
|
303
|
+
functionDocs = getPackageFunctionDocumentation(packageName);
|
|
304
|
+
}
|
|
305
|
+
|
|
275
306
|
function writeIndex() {
|
|
276
307
|
const stringifyRoute = ([route, pageData]) => `'${route}': {\n ${Object.entries(pageData)
|
|
277
308
|
.map(([key, val]) => `${key}: ${JSON.stringify(val)}`)
|
|
@@ -310,6 +341,7 @@ module.exports = {
|
|
|
310
341
|
globs.md.push({ glob, source, ignore });
|
|
311
342
|
sync(glob, { ignore }).forEach(file => sourceMDFile(file, source, buildMode));
|
|
312
343
|
},
|
|
344
|
+
sourceFunctionDocs,
|
|
313
345
|
writeIndex,
|
|
314
346
|
watchMD() {
|
|
315
347
|
globs.props.forEach(({ glob, ignore }) => {
|