@liquidweb-dev/annyong
v0.1.5
Published
`@liquidweb-dev/annyong` — typed HTTP request SDKs for two APIs maintained by Liquid Web:
Downloads
592
Readme
annyong
@liquidweb-dev/annyong — typed HTTP request SDKs for two APIs maintained by Liquid Web:
- Liquid Web API (
https://api.liquidweb.com) — supports HTTP basic auth or bearer tokens. Liquid Web publishes a bespoke docs format at/docs/jsonrather than OpenAPI. - Nocworx API — already publishes an OpenAPI spec.
The two SDKs are kept architecturally separate: there is no merged top-level surface, only sub-path imports.
Install (consumer)
npm install @liquidweb-dev/annyong
# or: bun add @liquidweb-dev/annyongimport { accountAuthToken } from '@liquidweb-dev/annyong/lw';
import { someNocworxOperation } from '@liquidweb-dev/annyong/nocworx';How it's built
LW bespoke docs JSON ─► convert-liquidweb-openapi.ts ─► liquidweb-openapi.json ─┐
├─► @hey-api/openapi-ts ─► lw/ + nocworx/ ─► tsc ─► dist/
Nocworx OpenAPI spec ─────────────────────────────────────► nocworx-openapi.json ──┘- Liquid Web → OpenAPI.
convert-liquidweb-openapi.tsfetcheshttps://api.liquidweb.com/docs/jsonand converts LW's bespoke types to OpenAPI 3.0.3 (liquidweb-openapi.json). Nocworx skips this step. - OpenAPI → SDK.
@hey-api/openapi-ts(configured inopenapi-ts.config.ts) generates the typed SDK intolw/andnocworx/. - SDK → publishable package.
tsc -p tsconfig.build.jsonemits.js+.d.tstodist/. A postbuild script mergespackage-dist.jsonoverrides intodist/package.jsonand copiesREADME.md.
Dev commands
| Command | What it does |
| --- | --- |
| bun install | Install dependencies |
| bun run generateLwOpenApi | Regenerate liquidweb-openapi.json from LW's docs |
| bun run openapi-ts | Regenerate lw/ and nocworx/ SDKs from the OpenAPI specs |
| bun run build | prebuild (clear dist/) + tsc emit + postbuild (write dist/package.json + copy README) |
| bun run docs:dev | Start the docs site (Astro) at http://localhost:3000 |
| bun run docs:build | Build the static docs site to docs/dist/ |
| bun run docs:preview | Serve the built docs at http://localhost:3000 |
bun run generateLwOpenApi accepts flags after --:
bun run generateLwOpenApi -- --version <bleed|v1|...> # default: bleed
bun run generateLwOpenApi -- --out ./liquidweb-openapi.jsonIf LW adds new bespoke types the converter doesn't recognize, the script logs them at the end of the run. Add real schemas to COMPONENTS (with constraints) or to STRING_TYPES (intentional plain-string fallback) in convert-liquidweb-openapi.ts.
Publish
The repo's root package.json is private: true. Publishing happens from dist/:
bun run build
cd dist
npm publishdist/package.json is generated at build time from the merge of root package.json + package-dist.json, with scripts and devDependencies stripped.
Docs site
docs/ is a static Astro site that documents the SDK. It generates a page per operation (~1135), per named type alias (~414), and a per-operation playground that hits the API live via the SDK's client.
Source of truth for the docs is the generated SDK code itself (lw/gen/sdk.gen.ts + lw/gen/types.gen.ts), parsed at build time via the TypeScript Compiler API. Operations come from sdk.gen.ts (function name → method + URL); request/response shapes come from the type aliases in types.gen.ts walked into a uniform Node tree. JSDoc descriptions are preserved.
Build output is fully static (docs/dist/) — host on any CDN. Dev/preview server binds to port 3000 (so the LW dev API's CORS allowlist accepts it).
Stack
Bun + TypeScript + Astro (docs site). Generator: @hey-api/openapi-ts.
