diff --git a/packages/documentation-framework/components/example/example.js b/packages/documentation-framework/components/example/example.js index a690996aa3..0d454a4752 100644 --- a/packages/documentation-framework/components/example/example.js +++ b/packages/documentation-framework/components/example/example.js @@ -3,7 +3,9 @@ import { useLocation } from '@reach/router'; import { Badge, CodeBlock, CodeBlockCode, debounce, Switch } from '@patternfly/react-core'; import * as reactCoreModule from '@patternfly/react-core'; import * as reactCoreNextModule from '@patternfly/react-core/next'; +import * as reactCoreDeprecatedModule from '@patternfly/react-core/deprecated'; import * as reactTableModule from '@patternfly/react-table'; +import * as reactTableDeprecatedModule from '@patternfly/react-table/deprecated'; import { css } from '@patternfly/react-styles'; import { getParameters } from 'codesandbox/lib/api/define'; import { ExampleToolbar } from './exampleToolbar'; @@ -109,7 +111,8 @@ export const Example = ({ // These 2 are in the bundle anyways for the site since we dogfood ...reactCoreModule, ...reactTableModule, - ...(source === 'react-next' ? reactCoreNextModule : {}) + ...(source === 'react-next' ? reactCoreNextModule : {}), + ...(source === 'react-deprecated' ? {...reactCoreDeprecatedModule, ...reactTableDeprecatedModule} : {}) }; let livePreview = null; diff --git a/packages/documentation-framework/routes.js b/packages/documentation-framework/routes.js index aaecac373a..f8d0c244f3 100644 --- a/packages/documentation-framework/routes.js +++ b/packages/documentation-framework/routes.js @@ -65,7 +65,8 @@ const sourceOrder = { react: 1, 'react-next': 1.1, 'react-composable': 1.2, - 'react-legacy': 1.3, + 'react-deprecated': 1.3, + 'react-legacy': 1.4, 'react-demos': 2, html: 3, 'html-demos': 4, diff --git a/packages/documentation-framework/scripts/md/parseMD.js b/packages/documentation-framework/scripts/md/parseMD.js index b29ae9afac..9f2a91e7a9 100644 --- a/packages/documentation-framework/scripts/md/parseMD.js +++ b/packages/documentation-framework/scripts/md/parseMD.js @@ -61,7 +61,7 @@ function toReactComponent(mdFilePath, source, buildMode) { } const propComponents = [...new Set(frontmatter.propComponents || [])].reduce((acc, componentName) => { - const name = getTsDocName(componentName, source === 'react-next'); + const name = getTsDocName(componentName, getTsDocNameVariant(source)); if (tsDocs[name]) { acc.push(tsDocs[name]); @@ -242,7 +242,7 @@ function sourcePropsFile(file) { tsDocgen(file) .filter(({ hide }) => !hide) .forEach(({ name, description, props }) => { - tsDocs[getTsDocName(name, file.includes('/next'))] = { name, description, props }; + tsDocs[getTsDocName(name, getTsDocNameVariant(file))] = { name, description, props }; }); } @@ -283,10 +283,20 @@ function writeIndex() { return exitCode; } -// Build unique names for components if they are a part of the "next" module. -function getTsDocName(name, isNextComponent) { - return `${name}${isNextComponent ? '-next' : ''}`; -}; +// Build unique names for components with a "variant" extension +function getTsDocName(name, variant) { + return `${name}${variant ? `-${variant}` : ''}`; +} + +function getTsDocNameVariant(source) { + if (source.includes('next')) { + return 'next'; + } + + if (source.includes('deprecated')) { + return 'deprecated'; + } +} module.exports = { sourceProps(glob, ignore) { diff --git a/packages/documentation-framework/scripts/md/typecheck.js b/packages/documentation-framework/scripts/md/typecheck.js index acf8ab8a22..9413115f7b 100644 --- a/packages/documentation-framework/scripts/md/typecheck.js +++ b/packages/documentation-framework/scripts/md/typecheck.js @@ -38,6 +38,8 @@ const defaultImports = [ 'react', '@reach/router', '@patternfly/react-core/next', + '@patternfly/react-core/deprecated', + '@patternfly/react-table/deprecated', 'react-dropzone', ]; const files = { diff --git a/packages/documentation-framework/scripts/webpack/webpack.base.config.js b/packages/documentation-framework/scripts/webpack/webpack.base.config.js index ec81cb3551..1ede2f1a39 100644 --- a/packages/documentation-framework/scripts/webpack/webpack.base.config.js +++ b/packages/documentation-framework/scripts/webpack/webpack.base.config.js @@ -118,8 +118,7 @@ module.exports = (_env, argv) => { alias: { 'client-styles': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.css.js'), './routes-client': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.routes.js'), - './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js'), - '@patternfly/react-core/next': '@patternfly/react-core/dist/esm/next/index.js' // Can remove when webpack is updated to v5 + './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js') }, modules: [ 'node_modules', diff --git a/packages/v4/patternfly-docs/patternfly-docs.source.js b/packages/v4/patternfly-docs/patternfly-docs.source.js index e91a3e1932..76526ec2c8 100644 --- a/packages/v4/patternfly-docs/patternfly-docs.source.js +++ b/packages/v4/patternfly-docs/patternfly-docs.source.js @@ -40,6 +40,7 @@ module.exports = (sourceMD, sourceProps) => { const reactChartsPath = require .resolve('@patternfly/react-charts/package.json') .replace('package.json', 'src'); + const reactLogViewerPath = require .resolve('@patternfly/react-log-viewer/package.json') .replace('package.json', 'src'); @@ -59,12 +60,14 @@ module.exports = (sourceMD, sourceProps) => { 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, '/**/TableComposable/examples/*.md'), 'react-composable'); - sourceMD(path.join(reactTablePath, '/**/demos/*.md'), 'react-demos'); + sourceMD(path.join(reactTablePath, '/**/TableComposable/examples/*.md'), 'react'); sourceMD(path.join(reactTablePath, '/**/Table/examples/*.md'), 'react-legacy'); + sourceMD(path.join(reactTablePath, '/deprecated/components/**/examples/*.md'), 'react-deprecated'); + sourceMD(path.join(reactTablePath, '/**/demos/*.md'), 'react-demos'); // Charts MD (no demos yet) sourceMD(path.join(reactChartsPath, '/**/examples/*.md'), 'react');