-
Notifications
You must be signed in to change notification settings - Fork 563
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
Add all manifest validation logic as separate rules #2572
Conversation
78dbce1
to
b446d32
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2572 +/- ##
==========================================
+ Coverage 94.01% 94.17% +0.15%
==========================================
Files 461 476 +15
Lines 9678 9813 +135
Branches 1486 1496 +10
==========================================
+ Hits 9099 9241 +142
+ Misses 579 572 -7 ☔ View full report in Codecov by Sentry. |
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.
Nice! This seems like a good improvement over the previous manifest logic. I like the approach of different validation rules you've used.
I left some clarifying questions, nits, and some suggestions.
packages/snaps-utils/src/manifest/validators/is-snap-manifest.ts
Outdated
Show resolved
Hide resolved
packages/snaps-utils/src/manifest/validators/manifest-localization.ts
Outdated
Show resolved
Hide resolved
packages/snaps-utils/src/manifest/validators/package-json-recommended-fields.ts
Show resolved
Hide resolved
packages/snaps-utils/src/manifest/validators/package-json-recommended-fields.ts
Outdated
Show resolved
Hide resolved
packages/snaps-utils/src/manifest/validators/package-name-match.ts
Outdated
Show resolved
Hide resolved
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.
Maybe we should update the build command to have better formatted warnings and errors too, instead of just throwing an error?
$ yarn build
✖ Error: Manifest Error: The manifest is invalid.
"snap.manifest.json" "shasum" field does not match computed shasum. Got "+iXB4ursqJMaWaR3fHJYNCxM8di9xvLeYoTv9jjMfjI=", expected "+iXB4ursqJMaWWR3fHJYNCxM8di9xvLeYoTv9jjMfjI=".
at ./MetaMask/snaps/packages/snaps-webpack-plugin/dist/chunk-5IQTHQ6D.js:206106:17
Feel free to do that in a separate PR though if you prefer.
Improving the dev experience will be part of #2565 |
For some reason checkManifest calculates the checksum wrongly instead of the checksum changing
Moved superstruct to @metamask/superstruct
6d81688
to
c5b114d
Compare
fixes #2571