-
Notifications
You must be signed in to change notification settings - Fork 687
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
Move PriceSummaryFragment to peregrine #3007
Conversation
|
System for Test https://pr-3007.pwa-venia.com/checkout |
@magento create issue from PR |
There was a problem hiding this 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'], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: [ |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@revanth0212 i updated this PR |
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
Co-authored-by: Stephen <sirugh@users.noreply.github.com>
There was a problem hiding this 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.
@dpatil-magento and @revanth0212 can be procced this because i want finish my checkmo feedture |
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
Verification Stakeholders
@sirugh @revanth0212
Specification
Verification Steps
Screenshots / Screen Captures (if appropriate)
Checklist
Resolved issues: