chore: Update generate-method-action-types script to be used in a single package#7983
chore: Update generate-method-action-types script to be used in a single package#7983GuillaumeRx wants to merge 5 commits intomainfrom
generate-method-action-types script to be used in a single package#7983Conversation
d1723db to
3de1c1e
Compare
| description: | ||
| 'Optional path to a specific folder where a controller is located (defaults to src/)', | ||
| default: 'src', | ||
| }) |
There was a problem hiding this comment.
Positional argument won't parse without command context
Medium Severity
The .positional('path', ...) method in yargs only works inside a .command() builder function. Called at the top level like this, yargs won't bind command-line positional arguments to argv.path. Any custom path passed as a positional arg (e.g., tsx script.ts --fix ./custom-src) will be silently ignored, and the value will either be the default 'src' or undefined depending on internal yargs behavior. If undefined, path.resolve(process.cwd(), undefined) would throw a TypeError. This needs either a default command ($0) wrapping the positional, or conversion to a regular .option().
cryptodev-2s
left a comment
There was a problem hiding this comment.
The changes looks good to me! just one more suggestion can we add this to all packages and add a constraints too here https://github.com/MetaMask/core/blob/main/yarn.config.cjs#L41 ?


Explanation
This updates the
generate-method-action-typesto be used in a single package context rather than at the root of the monorepo.It also adds a positional arg that represents the path of the controller folder. It allows to define a path when the controller is not in the expected
src/folder.(It's expected that it doesn't find any definition for
profile-sync-controller)References
Checklist
Note
Low Risk
Build/lint tooling changes only; main risk is CI/dev workflow breakage if a package’s controller sources aren’t under the expected
srcpath or if workspace script wiring is misconfigured.Overview
Updates
generate-method-action-typesto run in a single package context instead of scanning the whole monorepo: the script now accepts a positionalpath(defaultsrc) and only searches that directory forMESSENGER_EXPOSED_METHODS.Wires this into the repo by changing the root
generate-method-action-typesscript toyarn workspaces foreach ... run generate-method-action-types, and adding per-packagegenerate-method-action-typesscripts (plustsxdevDependency updates / lockfile entries) so each workspace can invoke the shared generator directly.Written by Cursor Bugbot for commit 3de1c1e. This will update automatically on new commits. Configure here.