-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathpatternfly-docs.source.js
299 lines (257 loc) · 10.7 KB
/
patternfly-docs.source.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
const path = require("path");
module.exports = (sourceMD, sourceProps, sourceFunctionDocs) => {
// Note: you must source props before sourcing the markdown files, otherwise the props table won't be rendered. Also
// source function docs (by calling sourceFunctionDocs with the package name) before sourcing markdown as well.
const contentBase = path.join(__dirname, "../patternfly-docs/content");
const reactPropsIgnore = [
"/**/examples/**",
"/**/__mocks__/**",
"/**/__tests__/**",
"/**/*.test.tsx",
];
sourceMD(path.join(contentBase, "extensions/**/*.md"), "extensions");
if (!(process.env.EXTENSIONS_ONLY === "true")) {
sourceMD(path.join(contentBase, "contribute/**/*.md"), "pages-contribute");
sourceMD(
path.join(contentBase, "get-started/**/*.md"),
"pages-get-started"
);
sourceMD(
path.join(contentBase, "developer-resources/**/*.md"),
"developer-resources"
);
sourceMD(path.join(contentBase, "accessibility/**/*.md"), "accessibility");
sourceMD(
path.join(contentBase, "design-guidelines/**/*.md"),
"design-guidelines"
);
sourceMD(path.join(contentBase, "training/**/*.md"), "training");
sourceMD(path.join(contentBase, 'tokens/**/*.md'), 'tokens');
sourceMD(path.join(contentBase, 'PatternFly-AI/**/*.md'), 'PatternFly-AI');
// Gallery pages
const galleryBase = path.join(__dirname, "../patternfly-docs/pages");
sourceMD(path.join(galleryBase, "landing-pages/**/*.md"), "landing-pages");
// Theme pages
const themePagesPath = require
.resolve("@patternfly/documentation-framework/package.json")
.replace("package.json", "pages");
sourceMD(path.join(themePagesPath, "*.md"), "pages-overview");
// Design tokens
const designTokensPath = require
.resolve('@patternfly/design-tokens/package.json')
.replace('package.json', 'patternfly-docs/content');
sourceMD(path.join(designTokensPath, '/*.md'), 'tokens');
// Core MD
const coreDocsPath = require
.resolve("@patternfly/patternfly/package.json")
.replace("package.json", "docs");
const coreDocsIgnore = path.join(coreDocsPath, "/pages/**"); // Compatibility for old gatsby workspace
sourceMD(
path.join(coreDocsPath, "!(demos)/**/examples/**/*.md"),
"html",
coreDocsIgnore
);
sourceMD(
path.join(coreDocsPath, "demos/**/*.md"),
"html-demos",
coreDocsIgnore
);
sourceMD(
path.join(coreDocsPath, "components/**/deprecated/**/*.md"),
"html-deprecated",
coreDocsIgnore
);
// React props
const reactCorePath = require
.resolve("@patternfly/react-core/package.json")
.replace("package.json", "src");
const reactTablePath = require
.resolve("@patternfly/react-table/package.json")
.replace("package.json", "src");
const reactCodeEditorPath = require
.resolve("@patternfly/react-code-editor/package.json")
.replace("package.json", "src");
const reactChartsPath = require
.resolve("@patternfly/react-charts/package.json")
.replace("package.json", "src");
const reactDragDropPath = require
.resolve("@patternfly/react-drag-drop/package.json")
.replace("package.json", "src");
const reactTemplatesPath = require
.resolve("@patternfly/react-templates/package.json")
.replace("package.json", "src");
const reactTopologyPath = require
.resolve("@patternfly/react-topology/package.json")
.replace("package.json", "patternfly-docs/content/examples");
sourceProps(path.join(reactCorePath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactTablePath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactCodeEditorPath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactChartsPath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactDragDropPath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactTopologyPath, "/**/*.tsx"), reactPropsIgnore);
sourceProps(path.join(reactTemplatesPath, "/**/*.tsx"), reactPropsIgnore);
// React MD
sourceMD(path.join(reactCorePath, "/components/**/examples/*.md"), "react");
sourceMD(path.join(reactCorePath, "/layouts/**/examples/*.md"), "react");
sourceMD(
path.join(reactCorePath, "/next/components/**/examples/*.md"),
"react-next"
);
sourceMD(
path.join(reactCorePath, "/deprecated/components/**/examples/*.md"),
"react-deprecated"
);
sourceMD(path.join(reactCorePath, "/**/demos/**/*.md"), "react-demos");
// React-table MD
sourceMD(
path.join(reactTablePath, "/components/**/examples/*.md"),
"react"
);
sourceMD(
path.join(reactTablePath, "/deprecated/components/**/examples/*.md"),
"react-deprecated"
);
sourceMD(path.join(reactTablePath, "/**/demos/*.md"), "react-demos");
// Charts MD
sourceMD(path.join(reactChartsPath, '/echarts/components/**/docs/*.md'), 'ECharts-docs'); // Alternate docs for examples
sourceMD(path.join(reactChartsPath, '/echarts/components/**/examples/*.md'), 'ECharts');
sourceMD(path.join(reactChartsPath, '/echarts/next/components/**/examples/*.md'), 'ECharts-next');
sourceMD(path.join(reactChartsPath, '/victory/components/**/examples/*.md'), '-Victory'); // Default tab
sourceMD(path.join(reactChartsPath, '/victory/next/components/**/examples/*.md'), '-Victory-next');
// React-code-editor MD
sourceMD(path.join(reactCodeEditorPath, "/**/examples/*.md"), "react");
// Drag drop MD
sourceMD(path.join(reactDragDropPath, "/**/examples/*.md"), "react");
// Templates MD
sourceMD(
path.join(reactTemplatesPath, "/**/examples/*.md"),
"react-templates"
);
// React-topology MD
sourceMD(path.join(reactTopologyPath, "/**/*.md"), "extensions");
// React OUIA MD
sourceMD(path.join(reactCorePath, "/**/helpers/OUIA/*.md"), "react");
}
// EXTENSIONS:
// Quickstarts extension
const qsPath = require.resolve("@patternfly/quickstarts/package.json");
const qsContentBase = path.join(
qsPath.replace("package.json", "dist"),
"/patternfly-docs/quick-starts"
);
const qsPropsBase = qsPath.replace("package.json", "src");
const qsPropsIgnore = ["**/*.test.tsx", "**/examples/*.tsx"];
sourceProps(path.join(qsPropsBase, "/**/*.tsx"), qsPropsIgnore);
sourceMD(path.join(qsContentBase, "**/*.md"));
// Catalog view extension
const catalogViewPath = require.resolve(
"@patternfly/react-catalog-view-extension/package.json"
);
const reactCatalogViewDocsPath = catalogViewPath.replace(
"package.json",
"patternfly-docs"
);
const reactCatalogViewSrcPath = catalogViewPath.replace(
"package.json",
"src/components"
);
sourceProps(
path.join(reactCatalogViewSrcPath, "/**/*.tsx"),
reactPropsIgnore
);
sourceMD(path.join(reactCatalogViewDocsPath, "/**/examples/*.md"), "react");
// Console extension
const consolePath = require.resolve("@patternfly/react-console/package.json");
const consoleDocsPath = consolePath.replace(
"package.json",
"patternfly-docs/content/extensions/react-console"
);
const consoleSrcPath = consolePath.replace("package.json", "src/components");
sourceProps(path.join(consoleSrcPath, "/**/*.tsx"), reactPropsIgnore);
sourceMD(path.join(consoleDocsPath, "/examples/*.md"), "react");
// Log viewer extension
const reactLogViewerPath = require
.resolve("@patternfly/react-log-viewer/package.json")
.replace("package.json", "src");
const logViewerContentBase = require
.resolve("@patternfly/react-log-viewer/package.json")
.replace(
"package.json",
"patternfly-docs/content/extensions/react-log-viewer"
);
sourceProps(path.join(reactLogViewerPath, "/**/*.tsx"), reactPropsIgnore);
sourceMD(path.join(logViewerContentBase, "/**/examples/*.md"), "react");
sourceMD(path.join(logViewerContentBase, "/**/demos/*.md"), "react-demos");
// Data view extension
const reactDataViewPath = require
.resolve("@patternfly/react-data-view/package.json")
.replace("package.json", "src");
const reactDataViewContentBase = require
.resolve("@patternfly/react-data-view/package.json")
.replace(
"package.json",
"patternfly-docs/content/extensions/data-view"
);
sourceProps(path.join(reactDataViewPath, "/**/*.tsx"), reactPropsIgnore);
sourceMD(path.join(reactDataViewContentBase, "/examples/**/*.md"), "react");
// User feedback extension
const reactUserFeedbackPath = require
.resolve("@patternfly/react-user-feedback/package.json")
.replace("package.json", "patternfly-docs/");
sourceProps(path.join(reactUserFeedbackPath, "/**/*.tsx"), reactPropsIgnore);
sourceMD(path.join(reactUserFeedbackPath, "/**/examples/*.md"), "react");
sourceMD(
path.join(reactUserFeedbackPath, "/**/design-guidelines/*.md"),
"design-guidelines"
);
// component groups extension
const reactComponentGroupsPath = require
.resolve("@patternfly/react-component-groups/package.json")
.replace("package.json", "src");
const reactComponentGroupsBase = require
.resolve("@patternfly/react-component-groups/package.json")
.replace(
"package.json",
"patternfly-docs/content/extensions/component-groups"
);
sourceProps(
path.join(reactComponentGroupsPath, "/**/*.tsx"),
reactPropsIgnore
);
sourceMD(path.join(reactComponentGroupsBase, "/**/*.md"), "react");
sourceMD(path.join(reactComponentGroupsPath, "/**/examples/*.md"), "react");
sourceMD(
path.join(reactComponentGroupsPath, "/**/design-guidelines/*.md"),
"design-guidelines"
);
// Chatbot
const virtualAssistantPath = require
.resolve("@patternfly/chatbot/package.json")
.replace("package.json", "src");
const virtualAssistantBase = require
.resolve("@patternfly/chatbot/package.json")
.replace(
"package.json",
"patternfly-docs/content/extensions/chatbot"
);
sourceProps(
path.join(virtualAssistantPath, "/**/*.tsx"),
reactPropsIgnore
);
sourceMD(path.join(virtualAssistantBase, 'examples/**/*.md'), 'PatternFly-AI');
sourceMD(path.join(virtualAssistantBase, '*.md'), 'PatternFly-AI');
// Prerelease sections:
if (process.env.PRERELEASE === "true") {
const reactVirtualizedTablePath = require
.resolve("@patternfly/react-virtualized-extension/package.json")
.replace("package.json", "src");
const reactVirtualizedTableBase = require
.resolve("@patternfly/react-virtualized-extension/package.json")
.replace("package.json", "patternfly-docs/");
sourceProps(
path.join(reactVirtualizedTablePath, "/**/*.tsx"),
reactPropsIgnore
);
sourceMD(path.join(reactVirtualizedTableBase, "/**/*.md"), "react");
}
};