Contributing
When a consumer app (tokenops-app, tokenops-api, etc.) depends on @tokenops/sdk during active SDK development, there are two ways to reference the local copy from the consumer's package.json.
link: — pick up rebuilds automatically
"@tokenops/sdk": "link:../tokenops-sdk"
pnpm creates a symlink into node_modules/@tokenops/sdk that points directly at the SDK's dist/ directory. After pnpm build in the SDK repo, the consumer picks up the rebuilt output immediately — no reinstall required.
Use link: during active SDK development where you're iterating quickly.
:::caution Transitive dep gotcha
link: bypasses pnpm's content-addressed dedup for the symlinked package. If the SDK and the consumer both declare viem as a dependency but at different exact versions, Node may load two copies of viem. This causes hard-to-diagnose failures (e.g. instanceof checks silently failing across module boundaries).
Fix: align the consumer's viem version to the SDK's exact version pin. Check the SDK's package.json and match it in the consumer:
// consumer package.json
"viem": "2.48.0" // must match @tokenops/sdk's devDependency pin exactly
Run pnpm install in the consumer after changing the version.
:::
file: — hermetic, snapshot install
"@tokenops/sdk": "file:../tokenops-sdk"
pnpm hard-copies the SDK's current state into its content-addressed store at install time. The consumer gets a stable, reproducible snapshot — good for CI and one-off integration tests.
The downside: rebuilding the SDK does not update the consumer's copy. You must run pnpm install --force in the consumer after every SDK rebuild.
Use file: in CI or when testing a specific SDK version without picking up ongoing changes.
Summary
link: | file: | |
|---|---|---|
| Picks up SDK rebuilds | yes (immediate) | no (requires --force reinstall) |
| Transitive dep dedup | bypassed | normal pnpm dedup |
| viem version alignment needed | yes | no |
| Recommended for | active SDK dev | CI, snapshot testing |
Workflow for active development
- In the consumer repo, set
"@tokenops/sdk": "link:../tokenops-sdk"and alignviemversions. - Run
pnpm installin the consumer. - In the SDK repo, run
pnpm buildwhenever you want the consumer to pick up changes. - No reinstall needed in the consumer — the symlink always resolves to the latest
dist/.