Skip to content

feat(external-router): Support different Magento driver versions#4424

Draft
joannalauu wants to merge 26 commits intodevelopfrom
support-different-versions-v2
Draft

feat(external-router): Support different Magento driver versions#4424
joannalauu wants to merge 26 commits intodevelopfrom
support-different-versions-v2

Conversation

@joannalauu
Copy link
Copy Markdown
Contributor

@joannalauu joannalauu commented Apr 10, 2026

PR Checklist

  • Commit message follows our contributing guidelines
  • Tests added/updated (for bug fixes/features)
  • Documentation added/updated (for bug fixes/features)

PR Type

  • Bug fix
  • Feature
  • Style update
  • Refactor
  • Test
  • Build
  • CI
  • Docs
  • Performance
  • Other (please describe)

Current behavior

Fixes: #3137

New behavior

  • Added providers for Magento driver v2.4.1 and v2.4.2
  • Users can import Magento driver from @daffodil/external-router/driver/magento/ instead of @daffodil/external-router/driver/magento/2.4.3
    • This is done through patching the ./driver/magento export condition to resolve to the specific driver version in the dist package.json
  • Maintainer sets default Magento driver version in libs/external-router/scripts/patch-magento-exports.mjs
    • Currently set to v2.4.3
  • Users can customize Magento driver version through modifying angular.json and tsconfig.json
    • Details in guides/drivers/magento.md
  • Commerce test matrix now includes tests for all Magento versions
    • Tests verify that only configured Magento driver version is in build bundle
    • Versions are retrieved through compute-matrix script, so the matrix doesn't need to be manually updated when new versions are added
    • When default driver version is updated, env.DEFAULT_MAGENTO_VERSION will need to be updated
  • Demo app will still need to import from @daffodil/external-router/driver/magento/2.4.3 because patch only applies to imports from node_modules, not dist/

Breaking change?

  • Yes
  • No

Additional context

@joannalauu joannalauu force-pushed the support-different-versions-v2 branch 2 times, most recently from b3f4d21 to e21fdf8 Compare April 10, 2026 22:27
@joannalauu joannalauu force-pushed the support-different-versions-v2 branch from 9681673 to 6697354 Compare April 11, 2026 01:07
@joannalauu joannalauu changed the title feat: Support different magneto driver versions feat: Support different Magento driver versions Apr 11, 2026
@joannalauu joannalauu marked this pull request as ready for review April 11, 2026 04:13
@joannalauu joannalauu requested review from a team as code owners April 11, 2026 04:13
@joannalauu joannalauu changed the title feat: Support different Magento driver versions feat(external-router): Support different Magento driver versions Apr 11, 2026
@joannalauu
Copy link
Copy Markdown
Contributor Author

joannalauu commented Apr 11, 2026

Tests in commit 47d7b9a uses the updated commerce test workflow, validating expected behavior

@joannalauu
Copy link
Copy Markdown
Contributor Author

Test failures in commit e1588cc verifies that when using a base provider to control driver version, tree shaking doesn't work and unused driver versions are included in the bundle

@damienwebdev
Copy link
Copy Markdown
Member

After a lengthy discussion with @joannalauu we came to a new idea. Essentially there will be a new @daffodil/*/driver/magento/auto entrypoint in all Magento supported packages that leverages a new file called daff.json which contains version definitions for various platforms / drivers - potentially something like:

{
  "projects": {
    "provider-test": {
      "drivers": {
        "magento": "1.9.4"
      }
    }
  }
}

We also will have tests guaranteeing that our bundles sizes remain small.

Below follows the list of notes that we generated during our discussion.

=========

  1. What's the definitions for daff.json?
    1. Docs
  2. What's the command interface / command package / per-package command for converting daff.json to angular.json / tsconfig.json?
    1. How does this command handle multiple projects within a repo like @angular/cli multiple projects.
      1. @angular/cli - daff.json + angular.json root with some way to break projects apart
      2. Determine which kind of project dynamically.
    2. Docs
  3. What does the conditions / custom-conditions spec look like? For different platforms? For different versions, etc. What's the minimum possible configurations?
    1. Internal docs
    2. What does it look across packages?
    3. How do we guarantee that packages don't drift in their exports? Linting rule?
      1. Do we need to guarantee completeness of the exports.driver/magento across all Magento versions for all Daffodil packages?
  4. We need to guarantee that provideDaffMagentoXDriver is the same. We need an interface guarantee from the root @daffodil/*/driver/magento package.
    1. This causes a per-package diff cascade
    2. We'd also have to update every package to provider functions over modules.
  5. Extract bundle size tests to a separate workflow than test-commerce-schematic. What does this actually test?
    1. What do we want to verify?
      1. For each most-recent platform version against the @daffodil/commerce schematic:
      2. That the command to generate the original daff.json works.
      3. The the command to update angular.json from daff.json works
      4. That the command to update angular.json from a revised daff.json works.
      5. That the bundle only includes the code expected from that version for ONE function from each of the @daffodil/* packages installed.
  6. Consider the entrypoint @daffodil/*/driver/magento/auto as a way to get rid of @daffodil/*/driver/magento/base
    1. Users can opt-in to the auto import if they would like, allowing this whole setup to be non-breaking.

daff.json - angular.json multiple projects

{
  "projects": {
    "provider-test": {
      "drivers": {
        "magento": "1.9.4"
      }
    }
  }
}

`daff.json` for nx projects w/ project.json
```json
{
  "drivers": {
    "magento": "2.4.7",
		"shopify": "2026-01",
		"hubspot": "kjnasdkjhasbdkjahsbdlkjhasbd"
  }
}

Copy link
Copy Markdown
Member

@griest024 griest024 left a comment

Choose a reason for hiding this comment

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

I don't like this solution. You've confirmed that the unused driver versions don't get tree shaken out?

@damienwebdev
Copy link
Copy Markdown
Member

@griest024 have you reviewed my comment above?

@joannalauu
Copy link
Copy Markdown
Contributor Author

I don't like this solution. You've confirmed that the unused driver versions don't get tree shaken out?

Yes, test failures in commit e1588cc verifies that when using a base provider to control driver version, tree shaking doesn't work and unused driver versions are included in the bundle

@joannalauu joannalauu marked this pull request as draft April 13, 2026 16:44
@griest024
Copy link
Copy Markdown
Member

@griest024 have you reviewed my comment above?

yes, see the discord thread. I think this requires further discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Create strategy for supporting different platform versions

3 participants