chore: use @metamask/messenger CLI for action type generation#3934
chore: use @metamask/messenger CLI for action type generation#3934cryptodev-2s wants to merge 3 commits intomainfrom
Conversation
Replace local scripts/generate-method-action-types.mts with the messenger-generate-action-types CLI from @metamask/messenger@^1.1.0. - Delete 773-line duplicated script - Bump @metamask/messenger to ^1.1.0 in all packages - Update snaps-controllers generate script to use CLI - Regenerate all 7 action type files
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3934 +/- ##
=======================================
Coverage 98.56% 98.56%
=======================================
Files 426 426
Lines 12316 12316
Branches 1935 1935
=======================================
Hits 12139 12139
Misses 177 177 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-controllers", | ||
| "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-controllers", | ||
| "generate-method-action-types": "tsx ../../scripts/generate-method-action-types.mts", | ||
| "generate-method-action-types": "messenger-generate-action-types", |
There was a problem hiding this comment.
This doesn't seem to work. It looks like we need to pass either --check or --fix.
Also... I wonder if "generate" was the right word to use for the executable. It seems that what we've really written is a linter. The other thing is that we are not checking all action types, just method action types. So I wonder if messenger-lint-method-action-types would have been a better name. Hmm 🤔
Regardless, I think we should have two package scripts here:
messenger-action-types:check(callsmessenger-generate-action-types --check)messenger-action-types:fix(callsmessenger-generate-action-types --check)
And we should make sure that messenger-action-types:check is called in lint, and messenger-action-types:fix is called in lint:fix.
Lastly I think we should update yarn.config.cjs so that we can easily apply these changes across all packages.
What do you think?
There was a problem hiding this comment.
It works exactly the same way it used to: the options are passed from the root package.json, not from the workspaces.
I see what you mean, though. However, this would mean I need to update @metamask/messenger, since it now instructs people to run yarn generate-method-action-types --fix.
| }, | ||
| "resolutions": { | ||
| "@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch", | ||
| "@metamask/messenger": "^1.1.0", |
There was a problem hiding this comment.
Why do we need a resolution ?
Description
Replace the local
scripts/generate-method-action-types.mts(773 lines) with themessenger-generate-action-typesCLI shipped in@metamask/messenger@^1.1.0.@metamask/messengerto^1.1.0in all packagesChecklist
Note
Low Risk
Low risk: this is a tooling/dependency update that swaps a local codegen script for the upstream
@metamask/messengerCLI and only regenerates type files with header changes.Overview
Switches method action type generation from the repo-local
scripts/generate-method-action-types.mtsto themessenger-generate-action-typesCLI shipped by@metamask/messenger.Bumps
@metamask/messengerto^1.1.0across the monorepo (plus a rootresolutionspin), removes the deleted generator script, and regenerates the affected*-method-action-types.tsoutputs (content unchanged aside from the auto-generated header comment).Written by Cursor Bugbot for commit d2afb44. This will update automatically on new commits. Configure here.