buckaroo-it / Magento2_Hyva

This repository contains the additional module to support Hyvä React Checkout
3 stars 0 forks source link

Override Buckaroo components #18

Closed ennostuurman closed 1 year ago

ennostuurman commented 1 year ago

@harli91 I'm Just wondering if you can recommend a good practice to override the components (for example app/code/Hyva/CheckoutExample/reactapp/src/paymentMethods/buckaroo/src/method/IDeal/IDeal.jsx) without overriding the npm installed Buckaroo components.

harli91 commented 1 year ago

The best way I think is to create a local git branch and do the changes there, if we make changes to our plugin, you just need to merge the changes to your branch and fix any conflicts that may happen

ennostuurman commented 1 year ago

Yes I considered that but still would like to have your advice.

1) I could version the files in the react checkout src/paymentMethods/* (which is in the react checkout .gitignore now) and commit that to my repo.

2) I could replace the package.json paymentMethodsRepo config with my own repo (which is cloned from the Buckaroo repo) and npm install from there. Something like this

"paymentMethodsRepo": {
        "buckaroo": "git@github.com:ennostuurman/Magento2_Hyva_Buckaroo.git"
    }

3) Or did you consider another way to override the Buckaroo components?

Magento PWA Studio for example uses the Webpack Module Override Plugin to map overrides to original components IIUC. https://www.piyushweb.com/blog/override-the-component-in-the-pwa-studio-project/

I expect there will be enough use cases that an override is needed, changing Tailwind classes already requires template overrides or the case where I want to change a component to add the label prop to radio inputs. Or maybe just to apply a hotfix.

harli91 commented 1 year ago

Hello @ennostuurman I was suggesting something similar to your point 2, you can even work directly with the local code in CheckoutExample/reactapp/src/paymentMethods/buckaroo you can create a branch there, Hyva clones the repository using git

ennostuurman commented 1 year ago

Thanks @harli for confirming, I'll close the issue.