Skip to content

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:

ModeWhen to use
Monorepo workspace:Wallet app lives in (or links) this repo — no publish needed.
Private npmSeparate 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 ​

PackageVersion fieldOn disk todayNotes
@aw-chat/corepackages/coredist/ (compiled JS + .d.ts)Must build before publish.
@aw-chat/webpackages/websrc/ TypeScriptHost needs a bundler that compiles TS from node_modules (Vite does).
@aw-chat/react-nativepackages/react-nativesrc/ TypeScriptMetro 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 ​

  1. Create a private registry (GitLab Package Registry, Verdaccio, GitHub Packages, …).

  2. Point the scope at it. Example root .npmrc in 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}
  3. Same .npmrc (or CI job env) in consuming wallet apps so pnpm add @aw-chat/web resolves.

  4. Update repository.url in each of packages/{core,web,react-native}/package.json to 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-checks

Order 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-image

Then 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) ​

  1. 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 a tsc (or tsup) build and point main / exports at dist/ like @aw-chat/core.
  2. There is no Changesets / CHANGELOG automation yet — bump versions by hand (or add Changesets when you want a formal release train).
  3. Do not publish @aw-chat/server, @aw-chat/admin, or examples/* (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 />.

AW Chat SDK — integration & platform handoff docs.