| 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. |
Publish Config
Validated by requirePublishConfig in @trezor/requirements (packages/requirements/src/requirements/package-json/requirePublishConfig.ts).
Applies to any package with publishConfig.
Rules
- Top-level
main — required (e.g. "./src/index.ts").
files — must include "lib/".
publishConfig.main and publishConfig.types — both required.
publishConfig.exports["."].default and publishConfig.exports["."].types — must export the same files as in Rule 3.
- Wildcard exports — (
./lib/*) must be a passthrough string ("./lib/*") — an object would double the .js extension.
- Explicit (non-wildcard) exports — not shape-checked (intentional overrides). Typically used to route a directory import to its
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.
- Key order —
"types" must come before "default" in every condition object (recursive). TypeScript evaluates conditions in declaration order.