console
console copied to clipboard
Utilize dynamic-modules.json provided by PatternFly packages
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
- Open
packages/console-dynamic-plugin-sdk/src/webpack/ConsoleRemotePlugin.tsand put the following code insidesharedDynamicModuleMapsreducer 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),
);
}
-
Rebuild Console plugin SDK and then your plugin, refer to these instructions for details.
-
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
- 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
- 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
[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
- ~~frontend/packages/console-dynamic-plugin-sdk/OWNERS~~ [vojtechszocs]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
@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.
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
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.
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
@vojtechszocs this one needs rebase
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-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.