patternfly / patternfly-elements

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

fix!: v3 deprecations #2655

Closed bennypowers closed 5 months ago

bennypowers commented 6 months ago

What I did

  1. remove deprecatedCustomEvent
  2. remove framework test wrapper fixtures
  3. remove icons from elements package
  4. remove render functions from DocsPage
  5. fix the tokens in accordion

Notes to Reviewers

In reviewing this PR, please take a look at the wds config in https://github.com/RedHat-UX/red-hat-design-system/pull/1420/files/7f8e1bc5c1054e55083a0d50582d0bf0a6d56ff4..bfa209ba48e697ad4c78df20d285ff55518a2bbe, as a sample "downstream" usage of these changes

changeset-bot[bot] commented 6 months ago

šŸ¦‹ Changeset detected

Latest commit: bbf779ed2faaa5aa6b072e07067deb679496a2f6

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

This PR includes changesets to release 4 packages | Name | Type | | ---------------------------------- | ----- | | @patternfly/elements | Major | | @patternfly/pfe-tools | Major | | @patternfly/pfe-core | Major | | @patternfly/eslint-config-elements | Patch |

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[bot] commented 6 months ago

"\n## šŸ‘• Commitlint Problems for this PR: \n\nšŸ”Ž found 2 errors, 0 warnings\nā„¹ļø Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint\n \n\n\n1eafb022 - Update little-singers-sell.md \n\n\n- āŒ subject may not be empty\n- āŒ type may not be empty "

netlify[bot] commented 6 months ago

Deploy Preview for patternfly-elements ready!

Name Link
Latest commit 476d2dd03d050a95b0aea1daa26172ce240cbf09
Deploy Preview https://deploy-preview-2655--patternfly-elements.netlify.app/

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

bennypowers commented 5 months ago

I apparently fixed the import map generator plugin. I then ran roughshod over the demo files because the import map plugin requires all top-level modules be inlined.

I haven't checked yet if this breaks the demos on the DP (eleventy). A followup PR should load those demos in iframes, a la pf.org

We'll have to test this with rhds (and maybe cp too, cc @eyevana)

this is also missing changesets

bennypowers commented 5 months ago

Ok this appears to work in rhds with the following dev server config

// @ts-check
import { pfeDevServerConfig } from '@patternfly/pfe-tools/dev-server/config.js';
import { glob } from 'glob';

export const litcssOptions = {
  include: (/** @type{string[]}*/(/** @type{unknown}*/([
    /elements\/rh-[\w-]+\/[\w-]+\.css$/,
    /lib\/.*\.css$/,
  ]))),
  exclude: /lightdom/,
};

const libImports =
  await glob('./lib/**/*.js', { ignore: ['**/test/**'] })
    .then(files => files.map(spec => [`@rhds/elements/${spec}`, `./${spec}`]))
    .then(Object.fromEntries);

const elementImports =
  await glob('./elements/**/*.js', { ignore: ['**/test/**'] })
    .then(files => files.map(spec => [`@rhds/elements/${spec.replace('elements/', '')}`, `./${spec}`]))
    .then(Object.fromEntries);

export default pfeDevServerConfig({
  litcssOptions,
  tsconfig: 'tsconfig.json',
  importMapOptions: {
    providers: {
      '@patternfly/icons': 'nodemodules',
      '@patternfly/elements': 'nodemodules',
      '@patternfly/pfe-tools': 'nodemodules',
      '@patternfly/pfe-core': 'nodemodules',
    },
    inputMap: {
      imports: {
        ...libImports,
        ...elementImports,
      },
    },
  },
  middleware: [
    /** redirect requests for lightdom css to /elements */
    function(ctx, next) {
      const match = ctx.path.match(/^\/components\/(?<slug>[-\w]+)\/(?<path>.*)\.css$/);
      if (match) {
        const { slug, path } = /** @type{{ slug: string; path: string }} */ (match.groups);
        ctx.redirect(`/elements/rh-${slug}/${path}.css`);
      }
      return next();
    },
    /** redirect requests for /assets/* css to /docs/assets/prism.css */
    function(ctx, next) {
      if (ctx.path.startsWith('/assets/')) {
        ctx.redirect(`/docs${ctx.path}`);
      }
      return next();
    }
  ]
});