Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tools): parameterize react wrapper generator #2650

Merged
merged 7 commits into from
Dec 6, 2023

Conversation

bennypowers
Copy link
Member

@bennypowers bennypowers commented Nov 29, 2023

Closes #2649

What I did

  1. parameterize react wrapper gen

Testing Instructions

  1. build react wrappers and compare output to main
  2. see rhds pr

Copy link

changeset-bot bot commented Nov 29, 2023

🦋 Changeset detected

Latest commit: 8fb3588

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@patternfly/pfe-tools Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the tools Development and build tools label Nov 29, 2023
Copy link

netlify bot commented Nov 29, 2023

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit ac86fd9
😎 Deploy Preview https://deploy-preview-2650--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the AT passed Automated testing has passed label Nov 29, 2023
@bennypowers bennypowers requested a review from zeroedin December 3, 2023 13:36
Copy link
Collaborator

@zeroedin zeroedin left a comment

Choose a reason for hiding this comment

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

Ran a build and pulled this downstream into RHDS and the react wrapper branch. Everything seemed to work until I looked at secondary nav which contains a depreciated tag:

@customElement('rh-secondary-nav')
class RhSecondaryNav extends RhNavigationSecondary {
  #logger = new Logger(this);

  constructor() {
    super();
    this.#logger.warn('rh-secondary-nav is deprecated. Use rh-navigation-secondary instead.');
  }
}

and

declare global {
  interface HTMLElementTagNameMap {
    'rh-navigation-secondary': RhNavigationSecondary;
    'rh-secondary-nav': RhSecondaryNav;
  }
}

This caused the ouput for the react wrapper to be:

// elements/rh-navigation-secondary/rh-navigation-secondary.js
import { createComponent } from '@lit/react';
import react from 'react';
import { rh-secondary-nav as elementClass } from '@rhds/elements/elements/rh-navigation-secondary/rh-navigation-secondary.js';
export const Rh-secondary-nav = createComponent({
  tagName: 'rh-secondary-nav',
  elementClass,
  react,
  events: {
    onOverlayChange: 'overlay-change',
  },
});

The import and the export class name appear to pick up the second export fromrh-navigation-secondary and use it with dashes instead of NavigationSecondary.

Will take a look for a resolution.

@bennypowers
Copy link
Member Author

solution:

  1. process all ce exports in each module, rather than just the first
  2. use the class declaration name property for class name, not the ce export's nameaaaa

@bennypowers bennypowers enabled auto-merge (squash) December 6, 2023 11:59
Copy link
Collaborator

@zeroedin zeroedin left a comment

Choose a reason for hiding this comment

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

🚢 it!
Let's get those modules

@bennypowers bennypowers merged commit 502e931 into main Dec 6, 2023
17 checks passed
@bennypowers bennypowers deleted the fix/tools/react-wrappers/params branch December 6, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AT passed Automated testing has passed ready to merge tools Development and build tools
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[bug] Fix hardcoded namespace for React wrapper tools
2 participants