@patternfly/documentation-framework 2.0.0-alpha.63 → 2.0.0-alpha.65
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 +19 -0
- package/README.md +1 -1
- package/app.js +8 -2
- package/components/link/link.js +1 -2
- package/components/sideNav/sideNav.js +4 -4
- package/helpers/codesandbox.js +1 -3
- package/layouts/sideNavLayout/sideNavLayout.js +2 -5
- package/package.json +2 -2
- package/routes.js +0 -2
- package/scripts/cli/build.js +0 -1
- package/scripts/cli/cli.js +1 -1
- package/scripts/webpack/getHtmlWebpackPlugins.js +1 -2
- package/scripts/webpack/prerender.js +1 -2
- package/scripts/webpack/webpack.base.config.js +1 -3
- package/templates/sitemap.ejs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
# 2.0.0-alpha.65 (2023-06-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 2.0.0-alpha.64 (2023-06-15)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **Sidenav:** updated PageContext props ([#3593](https://github.com/patternfly/patternfly-org/issues/3593)) ([1cc24ea](https://github.com/patternfly/patternfly-org/commit/1cc24ea1ef88c42a6b62a4a6b2421d157bc298d8))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# 2.0.0-alpha.63 (2023-06-14)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @patternfly/documentation-framework
|
|
2
2
|
|
|
3
|
-
## The PatternFly documentation framework lets you develop component examples in markdown format, so that they can be added to [patternfly.org](https://www.patternfly.org/
|
|
3
|
+
## The PatternFly documentation framework lets you develop component examples in markdown format, so that they can be added to [patternfly.org](https://www.patternfly.org/).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
package/app.js
CHANGED
|
@@ -23,6 +23,13 @@ const AppRoute = ({ child, title, path }) => {
|
|
|
23
23
|
'page_title': (title || pathname)
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
// Redirect all v4 url paths to the archived v4 site
|
|
28
|
+
if(pathname.startsWith("/v4")){
|
|
29
|
+
window.location.href = `https://v4-archive.patternfly.org${pathname}`;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
// Send 404 event if redirected to 404 page
|
|
27
34
|
if (path === '/404' && pathname.split('/').pop() !== '404') {
|
|
28
35
|
trackEvent('404_redirect', 'redirect', pathname);
|
|
@@ -36,7 +43,6 @@ const AppRoute = ({ child, title, path }) => {
|
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
const SideNavRouter = () => {
|
|
39
|
-
const pathname = useLocation().pathname.replace(process.env.pathPrefix, '');
|
|
40
46
|
const componentsData = process?.env?.componentsData;
|
|
41
47
|
return (
|
|
42
48
|
<SideNavLayout groupedRoutes={groupedRoutes} navOpen={true} >
|
|
@@ -83,7 +89,7 @@ const FullscreenComponent = ({ Component, title }) => {
|
|
|
83
89
|
|
|
84
90
|
// Export for SSR
|
|
85
91
|
export const App = () => (
|
|
86
|
-
<Router
|
|
92
|
+
<Router id="ws-router">
|
|
87
93
|
<SideNavRouter path="/*" />
|
|
88
94
|
{Object.entries(fullscreenRoutes)
|
|
89
95
|
.map(([path, { title, Component }]) =>
|
package/components/link/link.js
CHANGED
|
@@ -39,8 +39,6 @@ export const Link = ({
|
|
|
39
39
|
return <a href={url} onClick={onClick} {...props} />;
|
|
40
40
|
}
|
|
41
41
|
else if (url.startsWith('/')) {
|
|
42
|
-
url = `${process.env.pathPrefix}/${url.substr(1)}`;
|
|
43
|
-
|
|
44
42
|
if (!process.env.PRERENDER) {
|
|
45
43
|
const Component = getAsyncComponent(url);
|
|
46
44
|
if (Component) {
|
|
@@ -65,5 +63,6 @@ export const Link = ({
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
}
|
|
66
|
+
|
|
68
67
|
return <ReachLink to={url} {...props} />;
|
|
69
68
|
}
|
|
@@ -9,7 +9,7 @@ import { trackEvent } from '../../helpers';
|
|
|
9
9
|
|
|
10
10
|
const getIsActive = (location, section, subsection = null) => {
|
|
11
11
|
const slug = makeSlug(null, section, null, null, subsection);
|
|
12
|
-
return location.pathname.startsWith(
|
|
12
|
+
return location.pathname.startsWith(slug);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const defaultValue = 50;
|
|
@@ -18,8 +18,8 @@ const NavItem = ({ text, href, isDeprecated, isBeta, isDemo }) => {
|
|
|
18
18
|
const isMobileView = window.innerWidth < Number.parseInt(globalBreakpointXl.value, 10);
|
|
19
19
|
return (
|
|
20
20
|
<PageContextConsumer key={href + text}>
|
|
21
|
-
{({
|
|
22
|
-
<li key={href + text} className="pf-v5-c-nav__item" onClick={() => isMobileView &&
|
|
21
|
+
{({onSidebarToggle, isSidebarOpen }) => (
|
|
22
|
+
<li key={href + text} className="pf-v5-c-nav__item" onClick={() => isMobileView && onSidebarToggle && onSidebarToggle()}>
|
|
23
23
|
<Link
|
|
24
24
|
to={href}
|
|
25
25
|
getProps={({ isCurrent, href, location }) => {
|
|
@@ -31,7 +31,7 @@ const NavItem = ({ text, href, isDeprecated, isBeta, isDemo }) => {
|
|
|
31
31
|
)
|
|
32
32
|
}}
|
|
33
33
|
}
|
|
34
|
-
tabIndex={
|
|
34
|
+
tabIndex={isSidebarOpen ? undefined : -1}
|
|
35
35
|
>
|
|
36
36
|
<Flex spaceItems={{ default: 'spaceItemsSm'}}>
|
|
37
37
|
<FlexItem>{text}</FlexItem>
|
package/helpers/codesandbox.js
CHANGED
|
@@ -2,15 +2,13 @@ const { parse } = require('@patternfly/ast-helpers');
|
|
|
2
2
|
const versions = require('../versions.json');
|
|
3
3
|
const overpass = require('./fonts');
|
|
4
4
|
const { capitalize } = require('./capitalize');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const pathPrefix = process.env.pathPrefix;
|
|
7
5
|
|
|
8
6
|
const getStaticParams = (title, html) => {
|
|
9
7
|
const imgAssetRegex = /['"](\/assets\/images\/.*)['"]/g;
|
|
10
8
|
let imgAsset;
|
|
11
9
|
while ((imgAsset = imgAssetRegex.exec(html))) {
|
|
12
10
|
const imgName = imgAsset[1];
|
|
13
|
-
html = html.replace(imgName, `https://www.patternfly.org
|
|
11
|
+
html = html.replace(imgName, `https://www.patternfly.org${imgName}`);
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
return {
|
|
@@ -38,8 +38,7 @@ const HeaderTools = ({
|
|
|
38
38
|
hasVersionSwitcher,
|
|
39
39
|
algolia,
|
|
40
40
|
hasDarkThemeSwitcher,
|
|
41
|
-
topNavItems
|
|
42
|
-
pathPrefix
|
|
41
|
+
topNavItems
|
|
43
42
|
}) => {
|
|
44
43
|
const initialVersion = staticVersions.Releases.find(release => release.latest);
|
|
45
44
|
const latestVersion = versions.Releases.find(version => version.latest);
|
|
@@ -190,7 +189,6 @@ export function attachDocSearch(algolia, inputSelector, timeout) {
|
|
|
190
189
|
}
|
|
191
190
|
|
|
192
191
|
export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp }) => {
|
|
193
|
-
const pathPrefix = process.env.pathPrefix;
|
|
194
192
|
const algolia = process.env.algolia;
|
|
195
193
|
const hasGdprBanner = process.env.hasGdprBanner;
|
|
196
194
|
const hasVersionSwitcher = process.env.hasVersionSwitcher;
|
|
@@ -234,7 +232,7 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
234
232
|
</PageToggleButton>
|
|
235
233
|
</MastheadToggle>
|
|
236
234
|
<MastheadMain>
|
|
237
|
-
<MastheadBrand href={prurl ||
|
|
235
|
+
<MastheadBrand href={prurl || '/'}>
|
|
238
236
|
{prnum ? `PR #${prnum}` : (
|
|
239
237
|
<Brand src={logoBase} alt="PatternFly logo" widths={{ default: '180px', '2xl': '220px' }}>
|
|
240
238
|
<source media="(min-width: 768px)" srcSet={logoMd} />
|
|
@@ -250,7 +248,6 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
250
248
|
algolia={algolia}
|
|
251
249
|
hasVersionSwitcher={hasVersionSwitcher}
|
|
252
250
|
hasDarkThemeSwitcher={hasDarkThemeSwitcher}
|
|
253
|
-
pathPrefix={pathPrefix}
|
|
254
251
|
topNavItems={topNavItems}
|
|
255
252
|
/>
|
|
256
253
|
)}
|
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.65",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"react": "^17.0.0 || ^18.0.0",
|
|
92
92
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "d4886e73fdacf6ec830e534c830f5114bb1fbcd8"
|
|
95
95
|
}
|
package/routes.js
CHANGED
|
@@ -145,8 +145,6 @@ function getAsyncComponent(url) {
|
|
|
145
145
|
if (!url && typeof window !== 'undefined') {
|
|
146
146
|
url = window.location.pathname.replace(/\/$/, '') || '/';
|
|
147
147
|
}
|
|
148
|
-
// Normalize path for matching
|
|
149
|
-
url = url.replace(process.env.pathPrefix, '');
|
|
150
148
|
let res;
|
|
151
149
|
|
|
152
150
|
if (allRoutes[url]) {
|
package/scripts/cli/build.js
CHANGED
|
@@ -86,7 +86,6 @@ async function build(cmd, options) {
|
|
|
86
86
|
config.legacySSL = options.legacySSL
|
|
87
87
|
|
|
88
88
|
// These get passed to `fork`ed builds
|
|
89
|
-
process.env.pathPrefix = config.pathPrefix;
|
|
90
89
|
process.env.hasDesignGuidelines = config.hasDesignGuidelines;
|
|
91
90
|
// console.log('build', cmd, options.parent.cssconfig);
|
|
92
91
|
if (toBuild.includes('server')) {
|
package/scripts/cli/cli.js
CHANGED
|
@@ -44,7 +44,7 @@ program
|
|
|
44
44
|
|
|
45
45
|
program
|
|
46
46
|
.command('screenshots')
|
|
47
|
-
.option('-u, --urlPrefix <prefix>', 'where fullscreen pages are hosted', 'http://localhost:5000
|
|
47
|
+
.option('-u, --urlPrefix <prefix>', 'where fullscreen pages are hosted', 'http://localhost:5000')
|
|
48
48
|
.option('-a, --allRoutes', 'true if screenshots of all examples - not just full screen', false)
|
|
49
49
|
.description('updates screenshots for generated components')
|
|
50
50
|
.action(options => {
|
|
@@ -9,7 +9,6 @@ async function getHtmlWebpackPlugin({
|
|
|
9
9
|
isProd,
|
|
10
10
|
googleAnalyticsID,
|
|
11
11
|
algolia,
|
|
12
|
-
pathPrefix = '',
|
|
13
12
|
url,
|
|
14
13
|
title,
|
|
15
14
|
isFullscreen
|
|
@@ -20,7 +19,7 @@ async function getHtmlWebpackPlugin({
|
|
|
20
19
|
templateParameters: {
|
|
21
20
|
title: getTitle(title),
|
|
22
21
|
// Don't prerender fullscreen pages (expensive!)
|
|
23
|
-
prerendering: (isProd && !isFullscreen && !url.includes('topology') && !url.includes('extensions')) ? await prerender(url
|
|
22
|
+
prerendering: (isProd && !isFullscreen && !url.includes('topology') && !url.includes('extensions')) ? await prerender(url) : null,
|
|
24
23
|
// Don't use GA in dev mode
|
|
25
24
|
googleAnalyticsID: isProd ? googleAnalyticsID : false,
|
|
26
25
|
algolia
|
|
@@ -8,8 +8,7 @@ const ssrPrepass = require('react-ssr-prepass');
|
|
|
8
8
|
|
|
9
9
|
// This function is effectively synchronous because it mutates global.setTimeout
|
|
10
10
|
// Only allow one copy at a time to run
|
|
11
|
-
async function prerender(url
|
|
12
|
-
url = `${pathPrefix}${url}`;
|
|
11
|
+
async function prerender(url) {
|
|
13
12
|
const location = { pathname: url };
|
|
14
13
|
// For @reach/router
|
|
15
14
|
global.history = {};
|
|
@@ -6,7 +6,6 @@ const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
|
|
6
6
|
|
|
7
7
|
module.exports = (_env, argv) => {
|
|
8
8
|
const {
|
|
9
|
-
pathPrefix = '',
|
|
10
9
|
mode,
|
|
11
10
|
googleAnalyticsID = false,
|
|
12
11
|
algolia = {},
|
|
@@ -26,7 +25,7 @@ module.exports = (_env, argv) => {
|
|
|
26
25
|
return {
|
|
27
26
|
entry: path.resolve(__dirname, '../../app.js'),
|
|
28
27
|
output: {
|
|
29
|
-
publicPath:
|
|
28
|
+
publicPath: '/',
|
|
30
29
|
pathinfo: false, // https://webpack.js.org/guides/build-performance/#output-without-path-info,
|
|
31
30
|
hashDigestLength: 8,
|
|
32
31
|
clean: true, // Clean the output directory before emit.
|
|
@@ -137,7 +136,6 @@ module.exports = (_env, argv) => {
|
|
|
137
136
|
}),
|
|
138
137
|
new webpack.DefinePlugin({
|
|
139
138
|
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
140
|
-
'process.env.pathPrefix': JSON.stringify(isProd ? pathPrefix : ''),
|
|
141
139
|
'process.env.googleAnalyticsID': JSON.stringify(isProd ? googleAnalyticsID : ''),
|
|
142
140
|
'process.env.algolia': JSON.stringify(algolia),
|
|
143
141
|
'process.env.hasGdprBanner': JSON.stringify(hasGdprBanner),
|
package/templates/sitemap.ejs
CHANGED