Skip to content

Conversation

@nicolethoen
Copy link
Collaborator

@nicolethoen nicolethoen commented Nov 14, 2022

Closes #3289

@patternfly-build
Copy link
Collaborator

patternfly-build commented Nov 14, 2022

...reactTableModule,
...(source === 'react-next' ? reactCoreNextModule : {})
...(source === 'react-next' ? reactCoreNextModule : {}),
...(source === 'react-deprecated' ? reactCoreDeprecatedModule : {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

truee

'react-composable': 1.2,
'react-legacy': 1.3,
'react-deprecated': 1.3,
'react-legacy': 1.4,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have plans to use react-legacy after this change and introduction of react-deprecated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, so maybe we make a follow-up issue to remove this when we're ready?

return exitCode;
}

// Build unique names for components if they are a part of the "next" module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));

jpuzz0
jpuzz0 previously approved these changes Nov 17, 2022
Copy link
Contributor

@jpuzz0 jpuzz0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Once Jenny's PR is merged; patternfly/patternfly-react#8381, this build should pass.

// 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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/...).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not recently but i'll do that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, that makes sense.

'@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

@jpuzz0 jpuzz0 Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 : {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the condition source === 'react-deprecated' just once for the inclusion of both of these deprecated modules.

Copy link
Contributor

@jpuzz0 jpuzz0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally against patternfly-react successfully. Code changes LGTM.

Copy link
Contributor

@jenny-s51 jenny-s51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @nicolethoen !! 🚀

Also tested locally and I am able to now add demos under Table -> react-deprecated .

@nicolethoen nicolethoen merged commit b4324a7 into patternfly:main Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add 'deprecated' sub-paths for deprecated tabs

4 participants