Appearance
Publishing the SDK (private npm)
How to ship @aw-chat/* client packages to your private npm registry so the wallet apps can pnpm add / npm install them like normal dependencies.
This is optional. Two integration modes work:
| Mode | When to use |
|---|---|
Monorepo workspace: | Wallet app lives in (or links) this repo — no publish needed. |
| Private npm | Separate host apps install @aw-chat/web / @aw-chat/react-native from your registry. |
Server (@aw-chat/server) and admin (@aw-chat/admin) are not npm libraries — deploy them as services/images (Deployment).
What gets published
| Package | Version field | On disk today | Notes |
|---|---|---|---|
@aw-chat/core | packages/core | dist/ (compiled JS + .d.ts) | Must build before publish. |
@aw-chat/web | packages/web | src/ TypeScript | Host needs a bundler that compiles TS from node_modules (Vite does). |
@aw-chat/react-native | packages/react-native | src/ TypeScript | Metro resolves TS from node_modules as usual. |
publishConfig.access is restricted — packages are meant for a private registry, not the public npmjs.com.
Keep the three package versions equal (today 0.2.33). Also keep CORE_VERSION in packages/core/src/index.ts in sync with that version.
One-time registry setup
Create a private registry (GitLab Package Registry, Verdaccio, GitHub Packages, …).
Point the scope at it. Example root
.npmrcin this repo (do not commit tokens):ini@aw-chat:registry=https://gitlab.example.com/api/v4/projects/<id>/packages/npm/ //gitlab.example.com/api/v4/projects/<id>/packages/npm/:_authToken=${NPM_TOKEN}Same
.npmrc(or CI job env) in consuming wallet apps sopnpm add @aw-chat/webresolves.Update
repository.urlin each ofpackages/{core,web,react-native}/package.jsonto your GitLab (or leave it — metadata only).
Release checklist (every version)
From the monorepo root:
bash
# 1) Bump versions in lockstep
# packages/core/package.json
# packages/web/package.json
# packages/react-native/package.json
# packages/core/src/index.ts → CORE_VERSION = "x.y.z"
# 2) Verify
pnpm install
pnpm --filter @aw-chat/core build
pnpm typecheck
pnpm test
# 3) Publish — use pnpm (rewrites workspace:^ → real version in the tarball)
pnpm --filter @aw-chat/core publish --no-git-checks
pnpm --filter @aw-chat/web publish --no-git-checks
pnpm --filter @aw-chat/react-native publish --no-git-checksOrder matters: core first, then web / react-native (they depend on @aw-chat/core).
Auth: set NPM_TOKEN (or run pnpm login --registry <url> once locally).
--no-git-checks is fine when publishing from CI or a clean export without tags. Prefer tagging v0.2.34 in git when you do have history.
Why pnpm publish, not raw npm publish
@aw-chat/web and @aw-chat/react-native declare:
json
"@aw-chat/core": "workspace:^"pnpm publish rewrites that to the concrete version in the published tarball. Plain npm publish can leave workspace: in the package and break installs.
Consuming from the wallet app
bash
pnpm add @aw-chat/web
# or
pnpm add @aw-chat/react-native react-native-svg react-native-fast-imageThen integrate as in Quick start. Pass a fixed API origin allowlist in production:
tsx
<AWChat
serverUrl="https://chat-api.example.com"
allowedServerUrls={["https://chat-api.example.com"]}
/* … */
/>Call teardown() on logout so push tokens unregister (Push).
Current packaging caveats (read before first publish)
- web / RN ship TypeScript source, not a prebuilt
dist. That is OK for Vite and Metro hosts. It is not ideal if a consumer expects plain CJS/ESM JS with no TS pipeline. Hardening later: add atsc(ortsup) build and pointmain/exportsatdist/like@aw-chat/core. - There is no Changesets / CHANGELOG automation yet — bump versions by hand (or add Changesets when you want a formal release train).
- Do not publish
@aw-chat/server,@aw-chat/admin, orexamples/*(private: true).
Smoke test after publish
bash
mkdir /tmp/aw-chat-smoke && cd /tmp/aw-chat-smoke
echo '@aw-chat:registry=https://YOUR_REGISTRY/' > .npmrc
pnpm init
pnpm add @aw-chat/web@x.y.z
node -e "import('@aw-chat/core').then(m => console.log(m.CORE_VERSION))"Then open the web example or a minimal Vite app with <AWChat demo />.