feat(messenger): add generate-action-types CLI tool as subpath export#8264
Draft
cryptodev-2s wants to merge 9 commits intomainfrom
Draft
feat(messenger): add generate-action-types CLI tool as subpath export#8264cryptodev-2s wants to merge 9 commits intomainfrom
generate-action-types CLI tool as subpath export#8264cryptodev-2s wants to merge 9 commits intomainfrom
Conversation
Extract `scripts/generate-method-action-types.ts` into a publishable CLI package so it can be reused across repositories. - Scaffold `@metamask/messenger-generate-action-types` with bin entry - Split script into modular source files (parse, generate, check, fix) - Use named TypeScript imports, optional ESLint peer dependency - Update 44 consuming packages to use the new binary - Update package template, CODEOWNERS, teams.json, eslint config - Add ESLint config exception for Node.js module imports - Regenerate all action type files with updated header - Delete old `scripts/generate-method-action-types.ts`
The binary requires a build step before it can be used. Using tsx to run the source TypeScript directly avoids this dependency.
Move the CLI tool into @metamask/messenger as a subpath export instead of a separate package. This keeps the library lightweight while making the codegen available via optional peer dependencies. - Move source files to packages/messenger/src/generate-action-types/ - Add ./generate-action-types subpath export and bin entry - typescript, yargs, eslint are optional peerDependencies - @metamask/utils added as dependency (needed by codegen) - Remove standalone @metamask/messenger-generate-action-types package - Update 44 consuming packages to point to new location - Revert CODEOWNERS, teams.json, tsconfig, README changes
- Remove unused `MethodInfo.signature` field - Remove redundant `ControllerInfo.exposedMethods` (derivable from methods) - Extract shared ESLint types to `types.ts`, deduplicate across check/fix - Combine eslint/eslintStatic params into single `ESLint | null` object - Inline single-use `capitalize()` helper - Remove unused `Identifier` type import and `extractMethodSignature`
@metamask/messenger-generate-action-types packagegenerate-action-types CLI tool as subpath export
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The script
scripts/generate-method-action-types.tsgenerates TypeScript action type files for controllers/services that defineMESSENGER_EXPOSED_METHODS. It was a monorepo-local script invoked viatsx ../../scripts/generate-method-action-types.tsfrom 44 packages.This PR moves it into
@metamask/messengeras a subpath export (@metamask/messenger/generate-action-types), keeping the library lightweight while making the codegen reusable in other repositories.What changed:
generate-action-types/subdirectory underpackages/messenger/src/with modular source files (parse-controller.ts,generate-content.ts,check.ts,fix.ts,cli.ts)./generate-action-typessubpath export andmessenger-generate-action-typesbin entry to@metamask/messengertypescript,yargs, andeslintare optional peer dependencies — only needed when using the codegen tool. The coreMessengerlibrary remains zero-dependency.tsx ../../packages/messenger/src/generate-action-types/cli.tsscripts/generate-method-action-types.ts*-method-action-types.tsfiles with updated headerReferences
No related issues.
Checklist