Skip to content

Strategy in combining multiple modules under same vendor

We have a custom module. Now because of certain needs I need to make it into multiple modules like this

  • Vendor-Name
    • module-name-feature1-core
    • module-name-EE
    • module-name-B2B
    • module-name-feature2-core

When I was reading about meta packages I kind of understand that. But what I cannot get my header around is how to have conditional packages downloaded.

Here is what I need

If Magento Open Source

  • module-name-feature1-core
  • module-name-feature2-core

If Adobe Commerce

  • module-name-feature1-core
  • module-name-feature2-core
  • module-name-EE

If Adobe Commerce with B2B module installed

  • module-name-feature1-core
  • module-name-feature2-core
  • module-name-EE
  • module-name-B2B

My Community Extension meta package will Look like this

{
"name": "vendorname/adobe-commerce-extension",
"description": "Commerce extension",
"type": "metapackage",
"version": "1.4.1",
"require": {
    "vendorname/feature1-core": "2.4.6",
    "vendorname/feature2-core": "2.4.6"
}

}

My Adobe Commerce Extension meta package will look like this

{
"name": "vendorname/adobe-commerce-extension",
"description": "Commerce extension",
"type": "metapackage",
"version": "1.4.1",
"require": {
    "vendorname/feature1-core": "2.4.6",
    "vendorname/feature2-core": "2.4.6"
    "vendorname/EE-module": "2.4.6"
    "vendorname/b2b-module": "2.4.6" <-- this should depend on magento B2B module installed in given magento instance
}

}

How do I achieve something like this?