Skip to content

Allow uikit plugins to be used in multiple uikit definitions in patternlab-config.json. #1137

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

Closed
wants to merge 4 commits into from

Conversation

Hydraner
Copy link
Contributor

Closes #1136

Summary of changes:

  • Adds an optional id parameter to uikit definitions in patternlab-config.json
  • When collecting the uikits data, each over the config.json uikits instead of the available plugins

@bmuenzenmeyer bmuenzenmeyer self-assigned this Apr 14, 2020
Comment on lines 49 to 51
uikits.forEach(kit => {
const configEntry = _.find(_.filter(patternlab.config.uikits, 'enabled'), {
name: `uikit-${kit.name}`,
_.filter(patternlab.config.uikits, 'enabled').forEach(uikit => {
const kit = _.find(uikitModules, {
name: uikit.name.replace('uikit-', ''),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please resolve the merge conflict at this position, resulting from dev merge?

@stale
Copy link

stale bot commented Jun 28, 2020

It's hard to keep track of everything. This issue has been automatically marked as stale because it has not had recent activity, neither from the team nor the community. It will be closed if no further activity occurs. Please consider adding additional info, volunteering to contribute a fix for this issue, or making a further case that this is important to you, the team, and the project as a whole. Thanks!

@mfranzke
Copy link
Contributor

mfranzke commented Jun 28, 2020

@Hydraner do you have a chance to review the comment by @JosefBredereck?

@ringods
Copy link
Contributor

ringods commented Jul 13, 2020

I would like another review of this implementation. In #1225 I also have to touch the loading of UI kits and plugins. In the context of Yarn v2 workspaces (monorepo), there isn't a node_modules folder in every package/workspace, but only at the top level. To correctly load dependencies, one has to require the package.

My suggestion for this PR is to use name for what you defined as id, but add package as the full name of package dependency, including scope. For example:

  "uikits": [
    {
      "name": "uikit-workshop",
      "package": "@pattern-lab/uikit-workshop",
      "outputDir": "",
      "enabled": true,
      "excludedPatternStates": [],
      "excludedTags": []
    }
  ]

For backwards compatibility, if package is not defined, I would by default prefix the name property with the scope @pattern-lab/.

In the end, this would mean that you can use the same package multiple times, but under a different uikit name.

@ringods
Copy link
Contributor

ringods commented Aug 6, 2020

In ceccfd8, I have implemented the same in my branch. You can close this PR in favor of mine.

@ringods
Copy link
Contributor

ringods commented Aug 18, 2020

@JosefBredereck can you please review my work in #1225. As mentioned before, this PR will conflict with my work which is nearing completion. There are a few more cases where manual node_modules calculation needs to be replaced with proper require.resolve before I can submit it fully for integration.

@ringods
Copy link
Contributor

ringods commented Aug 23, 2020

@Hydraner are you ok with closing this PR in favor of #1225 which is just merged? There is only a difference in the names of the properties we both chose. You chose name and id and I chose name and package. Via my work, an NPM package can be used multiple times but with a different name.

There is some backwards compatibility included when a package property is not provided in the uikit configuration, that the name will be tested with a few combinations to calculate a package name, combined with the proper deprecation warnings.

@ringods
Copy link
Contributor

ringods commented Aug 27, 2020

This is covered by #1225 (which was reverted and redone in #1246). Documentation is added to the uikits section of the configuration:

https://patternlab.io/docs/editing-the-configuration-options/#heading-uikits

@ringods ringods closed this Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow uikit plugins to be used across multiple uikit definitions
5 participants