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

Utilize dynamic-modules.json provided by PatternFly packages #13866

Closed

Conversation

vojtechszocs
Copy link
Contributor

@vojtechszocs vojtechszocs commented May 17, 2024

This is a follow-up to #13832 and patternfly/patternfly-react/pull/10046

This PR updates ConsoleRemotePlugin code to utilize dynamic-modules.json files provided by relevant PatternFly packages when processing webpack federated shared modules.

The current default list of packages eligible for dynamic module processing by ConsoleRemotePlugin is following:

  • @patternfly/react-core
  • @patternfly/react-icons
  • @patternfly/react-table

When the relevant dynamic-modules.json file is missing, ConsoleRemotePlugin emits an info message to inform developers that it's falling back to Console dynamic module parser (logically equivalent to PatternFly dynamic module parser).


How to compare Console dynamic module parser vs. dynamic-modules.json files from PatternFly packages

  1. Open packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.ts and put the following code inside sharedDynamicModuleMaps reducer callback:
if (!dynamicModulesFileFound) {
  const moduleMap = acc[pkgName];
  const moduleMapSorted = Object.keys(moduleMap).sort().reduce((acc, key) => ({ ...acc, [key]: moduleMap[key] }), {});

  fs.writeFileSync(
    path.resolve(this.baseDir, `generated-dynamic-modules_${pkgName.replace(/^@.+\//, '')}.json`),
    JSON.stringify(moduleMapSorted, null, 2),
  );
}
  1. Rebuild Console plugin SDK and then your plugin, refer to these instructions for details.

  2. This should produce the following files in your plugin directory:

generated-dynamic-modules_react-core.json
generated-dynamic-modules_react-icons.json
generated-dynamic-modules_react-table.json
  1. Download latest versions of above PatternFly packages, for example:
$ npm info @patternfly/react-core dist.tarball
https://registry.npmjs.org/@patternfly/react-core/-/react-core-5.3.3.tgz
  1. Compare the contents of JSON files, for example:
$ meld generated-dynamic-modules_react-core.json /path/to/react-core-5.3.3/package/dist/dynamic-modules.json

@openshift-ci openshift-ci bot added the component/sdk Related to console-plugin-sdk label May 17, 2024
Copy link
Contributor

openshift-ci bot commented May 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2024
Copy link
Contributor

openshift-ci bot commented May 17, 2024

@vojtechszocs: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 16, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 16, 2024
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 15, 2024
@jhadvig
Copy link
Member

jhadvig commented Sep 23, 2024

@vojtechszocs this one needs rebase

@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci openshift-ci bot closed this Oct 24, 2024
Copy link
Contributor

openshift-ci bot commented Oct 24, 2024

@openshift-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/sdk Related to console-plugin-sdk lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants