patternfly / patternfly-elements

PatternFly Elements. A set of community-created web components based on PatternFly design.
https://patternflyelements.org/
MIT License
375 stars 85 forks source link

feat(tools): ts transform to add static version to elements #2768

Closed bennypowers closed 1 week ago

bennypowers commented 3 weeks ago

What I did

  1. add a typescript transform to a static version property to custom element classes

Testing Instructions

  1. run build
  2. check that element .js files have a static version property
  3. run the dev server
  4. customElements.whenDefined('pf-button').then(PfButton => console.log(PfButton.version));
  5. copy static-version.cjs into @rhds/elements node_modules, along with the package.json for pfe-tools
  6. add { "transform": "@patternfly/pfe-tools/typescript/transformers/static-version.cjs" }, to tsconfig.json
  7. remove the static version = '{{version}}' declarations from element files
  8. run the build and dev server, and confirm outputs as above.
changeset-bot[bot] commented 3 weeks ago

🦋 Changeset detected

Latest commit: 2333aece3460b5f5a97b0739280a556ea03695bc

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