This project uses Changesets for version management and publishing to npm as @0dotxyz/p0-ts-sdk.
- npm account with publish access to
@0dotxyz/p0-ts-sdk - Node >= 18, pnpm installed
Push all changes to a separate branch. Make sure the working tree is clean — nothing uncommitted.
git checkout -b release/vX.X.X
git status # should be cleanBuild the SDK and make sure examples still run:
pnpm build
pnpm test:run
cd examples && npx tsx 01-deposit.tsLocal link test with the app — in the app's package.json, temporarily point the SDK dependency to your local build:
"@repo/marginfi-client-v2": "file:../../../p0-ts-sdk"Adjust the relative path if the app lives elsewhere. Run the app and verify things work end-to-end. Revert this change before committing.
pnpm changesetSelect the bump type:
| Type | When to use | Example |
|---|---|---|
patch |
Bug fixes, docs, internal refactors | 2.1.1 → 2.1.2 |
minor |
New features, backwards compatible | 2.1.1 → 2.2.0 |
major |
Breaking API changes | 2.1.1 → 3.0.0 |
Write a descriptive summary when prompted, or edit the generated .changeset/<random-name>.md file afterwards to improve the description.
pnpm changeset versionThis updates package.json version, writes to CHANGELOG.md, and deletes consumed changeset files. Review the diff to make sure it looks correct.
git add .
git commit -m "chore: release v2.2.0"Use format: chore: release vX.X.X (or chore: release vX.X.X-alpha.X — short description for pre-releases).
git tag v2.2.0Use the same version string: vX.X.X (or vX.X.X-alpha.X for pre-releases).
npm login
npm whoami # verify you're the right userpnpm build
npm publishFor stable releases, this automatically tags as latest on npm.
For alpha/pre-releases, use --tag alpha (see Alpha Releases below).
npm dist-tag ls @0dotxyz/p0-ts-sdkConfirm latest (or alpha) points to the version you just published.
Check the package page: https://www.npmjs.com/package/@0dotxyz/p0-ts-sdk
Verify: correct version, correct files in the tarball, README renders properly.
git push origin release/vX.X.X --follow-tagsOpen a PR to merge into main if your workflow requires it.
Generate a local tarball and compare its hash with what npm received:
# Generate local tarball
npm pack
# Hash it
shasum -a 256 0dotxyz-p0-ts-sdk-*.tgz
# Compare with npm's reported hash
npm view @0dotxyz/p0-ts-sdk dist.integrityThe hashes should match (npm uses base64-encoded sha512 by default — use shasum -a 512 and compare manually, or just verify the tarball contents look right with tar -tzf *.tgz).
Use alpha releases to test breaking changes or new features before promoting to stable.
- Version format:
X.X.X-alpha.N(e.g.2.2.0-alpha.0,2.2.0-alpha.1) - Publish with
--tag alphaso it does NOT becomelatest - Consumers install with:
npm install @0dotxyz/p0-ts-sdk@alpha
# 1. Create changeset as usual
pnpm changeset # select minor/major/patch as appropriate
# 2. Enter pre-release mode (changesets feature)
pnpm changeset pre enter alpha
# 3. Apply version — this produces e.g. 2.2.0-alpha.0
pnpm changeset version
# 4. Commit and tag
git add .
git commit -m "chore: release v2.2.0-alpha.0 — new oracle integration"
git tag v2.2.0-alpha.0
# 5. Publish with alpha tag (IMPORTANT: --tag alpha)
pnpm build
npm publish --tag alpha
# 6. Verify
npm dist-tag ls @0dotxyz/p0-ts-sdk
# Should show: alpha: 2.2.0-alpha.0
# latest: 2.1.1 (unchanged)
# 7. Push
git push origin <branch> --follow-tagsRepeat steps 1-7 — changesets will auto-increment the pre-release number (alpha.0 → alpha.1 → ...).
# Exit pre-release mode
pnpm changeset pre exit
# Version as stable
pnpm changeset version
# Commit, tag, publish as a normal stable release (steps 5-11 above)
git add .
git commit -m "chore: release v2.2.0"
git tag v2.2.0
pnpm build
npm publish
git push origin <branch> --follow-tagsYou can also manually move the latest tag if needed:
npm dist-tag add @0dotxyz/p0-ts-sdk@2.2.0 latest"You need to be logged in to publish" — Run npm login.
"You do not have permission to publish" — Ensure your npm account has access to the @0dotxyz org.
"Version already exists" — You already published this version. Bump again with pnpm changeset version or manually edit package.json.
Accidental publish — You can unpublish within 72 hours: npm unpublish @0dotxyz/p0-ts-sdk@X.X.X (discouraged — prefer publishing a fix version instead).
Wrong dist-tag — Fix with: npm dist-tag add @0dotxyz/p0-ts-sdk@X.X.X <correct-tag>