mit einem Klick
packages
// How to create and structure packages in the Trezor Suite monorepo, including scopes and sizing guidance. Use when creating new packages or resolving cyclic dependencies.
// How to create and structure packages in the Trezor Suite monorepo, including scopes and sizing guidance. Use when creating new packages or resolving cyclic dependencies.
publishConfig rules for public npm packages in the Trezor Suite monorepo. Use when adding or editing publishConfig, exports, or preparing a package for npm publishing.
Use when writing component or hook tests in suite-native and need to choose between renderWithBasicProvider, renderWithStoreProvider, or store helpers like createStoreFromPreloadedState, createLightStore, or mergePreloadedState.
Generated code must be aligned with security headers (e.g. no unsave JS eval). The permissions policy is especially relevant when changing any code related with the `navigator` object.
Trigger on any mention of Trezor wallet interaction, crypto addresses, sending crypto, checking balances, signing messages, or hardware wallet operations via MCP. Also trigger when users mention configuring or troubleshooting the Trezor MCP server connection.
How to create and implement IndexedDB storage migrations in the Trezor Suite web app. Use when writing migrations that transform persisted data between Suite versions.
If-else formatting, spacing, function parameters, and conditional rendering rules for the Trezor Suite codebase. Use when writing or reviewing TypeScript/React code.
| name | packages |
| description | How to create and structure packages in the Trezor Suite monorepo, including scopes and sizing guidance. Use when creating new packages or resolving cyclic dependencies. |
Use command yarn generate-package @scope/newPackageName. For example using name @suite-common/wallet will create package in /suite-common folder. Full list of scopes:
| Scope | Folder | Description | Imports from |
|---|---|---|---|
| @trezor | /packages | Public packages (Connect, etc...) and Suite web & desktop packages (that shall be moved to @suite soon) | @suite |
| @suite-common | /suite-common | code shared between @suite and @suite native | @trezor |
| @suite-native | /suite-native | mobile Suite | @trezor and @suite-common |
| @suite | /suite | desktop & web Suite | @trezor and @suite-common |
Smaller is better.
Big packages usually lead to cyclic dependencies. Imagine this pattern:
packageA which has type FormInput and there are multiple forms in this package that need this typepackageB which also has a form that needs to use FormInput so you import it from packageApackageA but you can't because it will cause cyclic dependency.Now you have two options how to solve it:
packageB into packageA, but it will only amplify this cyclic deps issue for other packages. More things you will have in packageA, then more often you need to use packageA in other packages, but that will prevent you from importing any of that packages back into packageA because of cyclic dependency. That will force you to place everything into packageA which will grow into a monolith (that's the exact thing that happened in packages/suite).packageC which will contain this FormInput and both packageA and packageB can use it.So creating smaller packages from start is always better, because you have much lower chances to run into issue with cyclic dependencies, but not only that. Smaller packages give you better control of what you will use in other packages, you can run smaller subsets of tests, lints etc which is faster.