diff --git a/README.md b/README.md index 50b927b..850152a 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,30 @@ TypeScript SDK for the [iWF workflow engine](https://github.com/indeedeng/iwf). - Node.js 24 (Krypton) — see [`.nvmrc`](.nvmrc) (`nvm use`) - A running [iWF server](https://github.com/indeedeng/iwf#how-to-use) -## Install dependencies & build +## Install + +Not yet published to npm. Install from GitHub, pinned to a tag: + +```bash +npm install github:indeedeng/iwf-ts-sdk#v1.0.0-beta.1 +``` + +The package's `prepare` script compiles `dist/` during install, so the tarball npm builds +from the git clone contains the emitted JS and `.d.ts` files. This makes the install slower +than a normal npm package — it resolves the full devDependency tree (including +`@openapitools/openapi-generator-cli`) in npm's temp clone to run `tsc`. Pin a tag rather +than a branch so builds are reproducible. + +Then import from the package name: + +```ts +import { Client, Registry } from "iwf-typescript-sdk"; +``` + +## Develop on this SDK ```bash -npm install +npm install # also runs `prepare` -> compiles to dist/ npm run build # compile to dist/ npm run typecheck # type-check without emitting npm test # run the unit tests (jest + ts-jest) @@ -30,7 +50,7 @@ Implement two interfaces to define a workflow: import { ObjectWorkflow, WorkflowState, StateDef, StateDecision, CommandRequest, TimerCommand, Context, Persistence, Communication, CommandResults, -} from "iwf"; +} from "iwf-typescript-sdk"; class GreetState implements WorkflowState { get stateId() { return "greet"; } @@ -57,7 +77,7 @@ Wire them to any HTTP server (the `test/` folder has a complete Express example) ```ts import express from "express"; -import { Registry, WorkerService } from "iwf"; +import { Registry, WorkerService } from "iwf-typescript-sdk"; const registry = new Registry(); registry.addWorkflow(new GreetWorkflow()); @@ -76,7 +96,7 @@ app.listen(8802); ## Client ```ts -import { Client, Registry } from "iwf"; +import { Client, Registry } from "iwf-typescript-sdk"; const registry = new Registry(); const workflow = new GreetWorkflow(); diff --git a/package.json b/package.json index c1b278a..c4f2969 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "iwf-typescript-sdk", "private": true, - "version": "0.1.0", + "version": "1.0.0-beta.1", "main": "dist/iwf/index.js", "types": "dist/iwf/index.d.ts", "files": [ @@ -36,7 +36,7 @@ "lint:fix": "eslint . --fix --ext .ts", "format": "prettier --write .", "format:check": "prettier --check .", - "prepublishOnly": "npm run build", + "prepare": "npm run build", "preversion": "npm run lint && npm run test:ci", "version": "npm run build && git add -A dist" }, diff --git a/tsconfig.json b/tsconfig.json index 6eeb34d..242ca3a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "declaration": true, "sourceMap": true, "resolveJsonModule": true, + "rootDir": ".", "outDir": "dist" }, "include": ["iwf/**/*.ts", "gen/**/*.ts"],