@patternfly/documentation-framework 2.0.0-alpha.64 → 2.0.0-alpha.66

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 CHANGED
@@ -3,6 +3,22 @@
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.66 (2023-06-16)
7
+
8
+ **Note:** Version bump only for package @patternfly/documentation-framework
9
+
10
+
11
+
12
+
13
+
14
+ # 2.0.0-alpha.65 (2023-06-15)
15
+
16
+ **Note:** Version bump only for package @patternfly/documentation-framework
17
+
18
+
19
+
20
+
21
+
6
22
  # 2.0.0-alpha.64 (2023-06-15)
7
23
 
8
24
 
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/v4/).
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 basepath={process.env.pathPrefix} id="ws-router">
92
+ <Router id="ws-router">
87
93
  <SideNavRouter path="/*" />
88
94
  {Object.entries(fullscreenRoutes)
89
95
  .map(([path, { title, Component }]) =>
@@ -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(`${process.env.pathPrefix}${slug}`);
12
+ return location.pathname.startsWith(slug);
13
13
  }
14
14
 
15
15
  const defaultValue = 50;
@@ -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/v4${imgName}`);
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 || pathPrefix || '/'}>
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.64",
4
+ "version": "2.0.0-alpha.66",
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": "cca91b7e5225feb6d62e4fd8818505c6cfded86b"
94
+ "gitHead": "46f5febbfd241d9cbaf3e9dee3805efdecf05caa"
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]) {
@@ -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')) {
@@ -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/v4')
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, pathPrefix) : null,
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, pathPrefix) {
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: isProd ? `${pathPrefix}/` : '/',
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),
@@ -2,7 +2,7 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <% urls.forEach(url => {%>
4
4
  <url>
5
- <loc>https://www.patternfly.org/v4<%=url%></loc>
5
+ <loc>https://www.patternfly.org<%=url%></loc>
6
6
  <changefreq>daily</changefreq>
7
7
  <priority>0.7</priority>
8
8
  </url>