mit einem Klick
publish-config
// 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.
// 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.
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 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 | publish-config |
| description | 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. |
Validated by requirePublishConfig in @trezor/requirements (packages/requirements/src/requirements/package-json/requirePublishConfig.ts).
Applies to any package with publishConfig.
main — required (e.g. "./src/index.ts").files — must include "lib/" and "libESM/".publishConfig.main and publishConfig.types — both required.publishConfig.exports["."] — must have exact dual CJS/ESM shape (see example)../lib/*) uses an object with types and default. ESM (./libESM/*) must be a passthrough string ("./libESM/*") — an object would double the .mjs extension.index.js, e.g. "./lib/protocol-thp": { "types": "./lib/protocol-thp/index.d.ts", "default": "./lib/protocol-thp/index.js" } — without this, the wildcard would resolve to protocol-thp.js instead of protocol-thp/index.js../lib/... entry needs a matching ./libESM/... pair and vice versa."types" must come before "default" in every condition object (recursive). TypeScript evaluates conditions in declaration order."type": "module". Do not duplicate it under publishConfig.type — publishConfig would only shadow the top level with the same value at publish time, so we keep a single source of truth.{
"name": "@trezor/example",
"main": "./src/index.ts", // Rule 1
"type": "module", // Rule 9 — ESM-only packages only
"files": ["lib/", "libESM/", "CHANGELOG.md"], // Rule 2
"publishConfig": {
"main": "./lib/index.js", // Rule 3
"types": "./lib/index.d.ts", // Rule 3
"exports": {
".": {
// Rule 4: exact shape required
"import": {
"types": "./libESM/index.d.mts", // Rule 8: "types" before "default"
"default": "./libESM/index.mjs",
},
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js",
},
},
"./lib/*": {
// Rule 5: CJS wildcard — object
"types": "./lib/*.d.ts",
"default": "./lib/*.js",
},
"./libESM/*": "./libESM/*", // Rule 5: ESM wildcard — passthrough string
},
},
}