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

bpmn-js-properties-panel should be a normal "dependency" #113

Open
boris-petrov opened this issue Apr 12, 2022 · 4 comments
Open

bpmn-js-properties-panel should be a normal "dependency" #113

boris-petrov opened this issue Apr 12, 2022 · 4 comments
Labels
backlog Queued in backlog bug Something isn't working

Comments

@boris-petrov
Copy link

boris-petrov commented Apr 12, 2022

Describe the Bug

I'm not sure if I'm doing everything right but just adding "camunda-bpmn-js": "0.13.0-alpha.8", to package.json and trying out to use the Modeler fails because bpmn-js-properties-panel is missing. It is added as a peer dependency which means that it won't be installed by yarn. I think it should be moved to dependencies.

Steps to Reproduce
Expected Behavior
Environment

  • OS: Linux
  • Modeler version: 0.13.0-alpha.8

P.S. The same applies to @bpmn-io/properties-panel.

@boris-petrov boris-petrov added the bug Something isn't working label Apr 12, 2022
@barmac
Copy link
Contributor

barmac commented Apr 14, 2022

Hi,

thanks for creating this issue. I will try to explain why both the @bpmn-io/properties-panel and bpmn-js-properties-panel need to be peer dependencies. If there's any flaw in my reasoning, please feel free to point it out so that we can achieve right solution.

To start with, we want developers using camunda-bpmn-js to be able to provide properties panel extensions in their custom builds. Also, we don't want require developers to use non-standard deduplication tools, e.g. npm dedupe.

At first, we included both projects as direct dependencies. This resulted in a structure of node_modules similar to one below:

├── camunda-bpmn-js
│   ├── node_modules
│   │   ├── bpmn-js-properties-panel
│   │   │   ├── node_modules
│   │   │   │   ├── @bpmn-io/properties-panel

When one added bpmn-js-properties-panel to the project dependencies in order to import useService hook, it would then look like this:

├── bpmn-js-properties-panel
│   ├── node_modules
│   │   ├── @bpmn-io/properties-panel
├── camunda-bpmn-js
│   ├── node_modules
│   │   ├── bpmn-js-properties-panel
│   │   │   ├── node_modules
│   │   │   │   ├── @bpmn-io/properties-panel

Because useService relies on preact context, it would not work in such a setup. The properties panel would use the nested context while custom extension would take the closest module which resulted in an error. The same applied to @bpmn-io/properties-panel. This is what we have experienced.

With peer dependencies, the node_modules looks like this:

├── @bpmn-io/properties-panel
├── bpmn-js-properties-panel
├── camunda-bpmn-js

So we have only one instance of each dependencies which rely on context and hooks. Thus, extensibility is maintained.

If you have a better idea how to achieve this, we are happy to receive suggestions.

@boris-petrov
Copy link
Author

@barmac - thank you for the detailed answer. I was asking if this was connected with the other issue and you linked it while I was typing. :)

As for a better idea... I definitely don't have one. 😄 This is a very "hacky" way of making sure that the same preact context is used but I'm totally unfamiliar with both preact and writing plugins for bpmn-js so I really can't say more. I do understand your pain though and understand that this is the best you can do for now so thank you for the information!

If you would like, let's leave the issue open so maybe someone someday has a solution in mind. :)

@marstamm marstamm added backlog Queued in backlog and removed help wanted Extra attention is needed labels Apr 26, 2022
@philippfromme
Copy link
Contributor

Stupid question: Why not make preact a peer dependency of all these packages? 🤔

@barmac
Copy link
Contributor

barmac commented May 4, 2022

The reason we decided against it is that if we make preact dependency, we force the library users to install a preact version specified in the peer dependencies. We don't want to enforce preact version for the code which is not related to the properties panel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants