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

Move PriceSummaryFragment to peregrine #3007

Merged

Conversation

larsroettig
Copy link
Member

@larsroettig larsroettig commented Feb 10, 2021

Description

Moves PriceSummaryFragment to peregrine to allow partner to build headless exteriperiance without venia
This refactoring helps also Extension providers to not have query duplikation

Related Issue

Closes PWA-1461.

Acceptance

  • Test Cart
  • Test Checkout

Verification Stakeholders

@sirugh @revanth0212

Specification

Verification Steps

  1. Add Product to cart
  2. Go to cart page
  3. Make checkout with braintree

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have added tests to cover my changes, if necessary.
  • I have added translations for new strings, if necessary.
  • I have updated the documentation accordingly, if necessary.

Resolved issues:

  1. resolves [chore/feature] Move PriceSummaryFragment to peregrine #3010: Move PriceSummaryFragment to peregrine

@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Feb 10, 2021

Messages
📖

Associated JIRA tickets: PWA-1461.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

Generated by 🚫 dangerJS against de23661

@larsroettig larsroettig marked this pull request as draft February 10, 2021 21:46
@larsroettig larsroettig marked this pull request as ready for review February 11, 2021 18:39
@larsroettig
Copy link
Member Author

System for Test https://pr-3007.pwa-venia.com/checkout

@sirugh
Copy link
Contributor

sirugh commented Feb 11, 2021

@magento create issue from PR

@sirugh sirugh added the version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump. label Feb 11, 2021
Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @larsroettig. The code looks fine and works as expected. I only have 1 change request from you, please check the comment out and address it as required.

jest.config.js Outdated
@@ -136,7 +139,7 @@ const testReactComponents = inPackage => ({
'@magento/venia-drivers':
'<rootDir>/packages/venia-ui/lib/drivers/index.js'
},
moduleFileExtensions: ['ee.js', 'ce.js', 'js', 'json', 'jsx', 'node'],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ee.js', 'ce.js'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you made this change?

I personally don't think this is a valid change. You changed the priority order of the file extension matching algorithm. Now ee.js and ce.js have the lowest priority and would never match against a file because .js has higher priority and will go through.

Also, we have this same file matching logic in webpack, if tomorrow's defaults.moduleFileExtensions changes but webpack matching is different, this will cause problems.

Copy link
Contributor

Choose a reason for hiding this comment

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

I made this change. Is moduleFileExtensions in order of priority? This is jest config, not webpack: https://jestjs.io/docs/en/webpack#configuring-jest-to-find-our-files

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I remember yes. For instance, if you have component.js and component.json in the same folder you try to import component since .js has higher priority, it will be picked over .json file. And we follow the same array convention in webpack configuration as well. It is beneficial if these 2 stay in sync. Webpack uses a similar import configuration while building which jest uses while testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right! We should find a way to sync these! We should export the module resolution array from some central location. @larsroettig if you can do that, would be awesome, otherwise we can just revert this change back to how it was before I modified it.

@@ -230,6 +233,12 @@ const jestConfig = {
})),
configureProject('pagebuilder', 'Pagebuilder', testReactComponents),
configureProject('peregrine', 'Peregrine', inPackage => ({
// Make sure we can test extension files.
moduleFileExtensions: [
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I would suggest using file extension array from develop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was suggesting to use ['ee.js', 'ce.js', 'js', 'json', 'jsx', 'node'] as the value of moduleFileExtensions.

Copy link
Contributor

Choose a reason for hiding this comment

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

And you'd prefer that over ['ee.js', 'ce.js', ...defaults.moduleFileExtensions] so we're explicit?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably easiest just to change this to Revanth's suggestion, @larsroettig

Copy link
Contributor

Choose a reason for hiding this comment

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

And you'd prefer that over ['ee.js', 'ce.js', ...defaults.moduleFileExtensions] so we're explicit?

I like the idea of maintaining these in a global location somewhere and importing them in the jest and webpack config files instead of relying on jest.moduleFileExtensions which can change in a future version.

I don't think we can use 1 array for both since the syntaxes they employ are different.

For instance,

Webpack config: ['.ee.js', '.ce.js', '.js', '.json', '.jsx', '.node']
Jest config: ['ee.js', 'ce.js', 'js', 'json', 'jsx', 'node']

Webpack needs . in front of the file extensions while jest doesn't.

The best solution at the moment would be to revert this change to what it was in develop and handle it in a different ticket if deemed necessary.

@larsroettig
Copy link
Member Author

@revanth0212 i updated this PR

Lars Roettig and others added 2 commits February 17, 2021 22:12
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
revanth0212
revanth0212 previously approved these changes Feb 18, 2021
Copy link
Contributor

@revanth0212 revanth0212 left a comment

Choose a reason for hiding this comment

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

Almost there. Some prettier changes needed. Please check.

@larsroettig
Copy link
Member Author

larsroettig commented Feb 19, 2021

@dpatil-magento and @revanth0212 can be procced this because i want finish my checkmo feedture

@dpatil-magento dpatil-magento merged commit 8697834 into magento:develop Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: TechDivision partners-contribution pkg:peregrine pkg:venia-ui Progress: done version: Major This changeset includes incompatible API changes and its release necessitates a Major version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chore/feature] Move PriceSummaryFragment to peregrine
6 participants