feat: add deprecated subpaths#3291
Conversation
|
PF4 preview: https://patternfly-org-pr-3291-v4.surge.sh/v4 |
| ...reactTableModule, | ||
| ...(source === 'react-next' ? reactCoreNextModule : {}) | ||
| ...(source === 'react-next' ? reactCoreNextModule : {}), | ||
| ...(source === 'react-deprecated' ? reactCoreDeprecatedModule : {}) |
There was a problem hiding this comment.
It doesn't look like reactCoreDeprecatedModule is defined, and I think we want to extend upon react-table's module for this scope and not react-core (I assume we'll want both eventually, but for this change, at least react-table).
| 'react-composable': 1.2, | ||
| 'react-legacy': 1.3, | ||
| 'react-deprecated': 1.3, | ||
| 'react-legacy': 1.4, |
There was a problem hiding this comment.
Do we still have plans to use react-legacy after this change and introduction of react-deprecated?
There was a problem hiding this comment.
ultimately react-deprecated will replace the legacy here so I can remove it, but probably not until it's been removed after the breaking change. I don't want to remove it before then.
The deprecated work is going in the v5 branch
There was a problem hiding this comment.
Got it, so maybe we make a follow-up issue to remove this when we're ready?
| @@ -281,9 +281,14 @@ function writeIndex() { | |||
| } | |||
|
|
|||
| // Build unique names for components if they are a part of the "next" module. | |||
There was a problem hiding this comment.
If we keep this function as you've expanded upon it, we should update this comment.
| function getTsDocName(name, isNextComponent) { | ||
| return `${name}${isNextComponent ? '-next' : ''}`; | ||
| }; | ||
| function getTsDocName(name, isNextComponent, isDeprecatedComponent) { |
There was a problem hiding this comment.
So as to not have to add new parameters to this function whenever a new condition arises, we might want to consider reworking this a bit. This is what I had in mind roughly, where if there's another "variant" at any point, we just have to update the 1 location in getTsDocNameVariant:
// 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';
}
}
and the 2 usages above would then look like the following:
tsDocs[getTsDocName(name, getTsDocNameVariant(file))] = { name, description, props };
and
const name = getTsDocName(componentName, getTsDocNameVariant(source));
There was a problem hiding this comment.
Looks good. Once Jenny's PR is merged; patternfly/patternfly-react#8381, this build should pass.
3cc0849 to
f5a5722
Compare
| // 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'); |
There was a problem hiding this comment.
Was this tested locally by any chance? This regex might conflict with the deprecated path regex on line 61. To prevent the potential for that we can remove the wildcard at the beginning of this line and replace it with components (e.g. /components/TableComposable/...).
There was a problem hiding this comment.
not recently but i'll do that
There was a problem hiding this comment.
@jeffpuzzo so i'm realizing now that this line will be better tested in the react-docs package where we have our own patternfly-docs.source.js file defined. patternfly-react does not consume org's v4 package, it's actually the other way around, so if these lines dont work in the react workspace when the change is made there, then we can update it here to match whatever worked in the workspace. If this is good to be merged, hopefully this will unblock the work to deprecate table
There was a problem hiding this comment.
Ah right, that makes sense.
f5a5722 to
dcc4165
Compare
| '@patternfly/react-core/next': '@patternfly/react-core/dist/esm/next/index.js' // Can remove when webpack is updated to v5 | ||
| '@patternfly/react-core/next': '@patternfly/react-core/dist/esm/next/index.js', // Can remove when webpack is updated to v5 | ||
| '@patternfly/react-core/deprecated': '@patternfly/react-core/dist/esm/deprecated/index.js', // Can remove when webpack is updated to v5 | ||
| '@patternfly/react-table/deprecated': '@patternfly/react-table/dist/esm/deprecated/index.js' // Can remove when webpack is updated to v5 |
There was a problem hiding this comment.
I think all of these path aliases can be removed now since we're no longer using package exports in react-core/table.
| sourceProps(path.join(reactCodeEditorPath, '/**/*.tsx'),reactPropsIgnore); | ||
| sourceProps(path.join(reactChartsPath, '/**/*.tsx'),reactPropsIgnore); | ||
| sourceProps(path.join(reactLogViewerPath, '/**/*.tsx'), reactPropsIgnore); | ||
| //sourceProps(path.join(reactDragDropPath, '/**/*.tsx'), reactPropsIgnore); |
There was a problem hiding this comment.
Maybe for now, unless we want to add TODO comments explaining when we'd add this back in, we can remove this commented out line along with lines 43-44 & 81?
| ...(source === 'react-next' ? reactCoreNextModule : {}) | ||
| ...(source === 'react-next' ? reactCoreNextModule : {}), | ||
| ...(source === 'react-deprecated' ? reactCoreDeprecatedModule : {}), | ||
| ...(source === 'react-deprecated' ? reactTableDeprecatedModule : {}) |
There was a problem hiding this comment.
I think we can use the condition source === 'react-deprecated' just once for the inclusion of both of these deprecated modules.
jpuzz0
left a comment
There was a problem hiding this comment.
Tested this locally against patternfly-react successfully. Code changes LGTM.
jenny-s51
left a comment
There was a problem hiding this comment.
Looks great @nicolethoen !! 🚀
Also tested locally and I am able to now add demos under Table -> react-deprecated .
Closes #3289