Complete BINECT-WP-0002: SDK publication readiness

Verify build output, types, and tests; document npm publish and consumer
install paths in README; add publishConfig for scoped public publish.
This commit is contained in:
2026-06-24 15:08:26 +02:00
parent bd06393262
commit 774b1d814e
3 changed files with 54 additions and 20 deletions

View File

@@ -10,9 +10,21 @@ A JavaScript/TypeScript wrapper for the [Binect API](https://app.binect.de/index
## Installation
### Option 1: Local Path Reference (Recommended)
### npm (recommended)
Since this library is not yet published to npm, reference it via local path in your `package.json`:
```bash
npm install @binect/js
```
Requires Node.js ≥ 18. The package ships pre-built `dist/` output and TypeScript declarations — no build step needed in your project.
```typescript
import { BinectClient, DocumentStatus, isShippable } from '@binect/js';
```
### Local development (before publish or when hacking on the SDK)
**Path reference** — add to your consumer `package.json`:
```json
{
@@ -22,34 +34,45 @@ Since this library is not yet published to npm, reference it via local path in y
}
```
Then run `npm install`. Adjust the path to where you cloned/placed the binect-js folder.
Then `npm install`. Adjust the path to your clone location. The SDK must be built first (`npm run build` in the binect-js directory).
### Option 2: npm link
**npm link** — for iterative SDK work:
```bash
# In the binect-js directory
cd /path/to/binect-js
npm install
npm run build
npm link
npm install && npm run build && npm link
# In your project directory
cd /path/to/your-project
# In your project
npm link @binect/js
```
### Option 3: Copy the dist folder
### Publishing (maintainers)
1. Build the library: `cd binect-js && npm install && npm run build`
2. Copy the `dist/` folder to your project
3. Import directly: `import { BinectClient } from './dist/index.js'`
### Future: npm (not yet available)
Pre-publish checklist:
```bash
npm install @binect/js
npm install
npm run clean && npm run build # produces dist/ with .js, .d.ts, source maps
npm run typecheck # strict TS, no emit
npm test # unit tests (62); e2e skips without credentials
npm pack --dry-run # verify tarball contents (dist/, LICENSE, README)
```
E2E tests against the live Binect API (optional, credential-gated):
```bash
BINECT_USERNAME=your@email.com BINECT_PASSWORD=yourpass npm run test:e2e
```
Publish to the public npm registry (scoped package `@binect/js` requires `--access public` on first publish; `publishConfig` in `package.json` sets this automatically):
```bash
npm login # npm account with @binect org access
npm publish # runs prepublishOnly → npm run build
```
After publish, consumers install with `npm install @binect/js` — see [Quick Start](#quick-start) below.
## Quick Start
```typescript

View File

@@ -42,5 +42,8 @@
},
"engines": {
"node": ">=18.0.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -4,11 +4,11 @@ type: workplan
title: "SDK publication and consumer validation"
domain: communication
repo: binect-js
status: ready
status: finished
owner: codex
topic_slug: communication
created: "2026-06-22"
updated: "2026-06-22"
updated: "2026-06-24"
state_hub_workstream_id: "e98363de-fe52-43a3-82be-df0b1a213593"
---
@@ -20,9 +20,17 @@ Prepare `@binect/js` for npm publication and validate the Explorer against live
```task
id: BINECT-WP-0002-T01
status: todo
status: done
priority: high
state_hub_task_id: "6aa6e1f6-decb-46fa-900e-62519383e971"
```
Verify build output, types, e2e tests, and document npm publish + consumer install path in README.
Result 2026-06-24:
- Build: `npm run build` produces complete `dist/` (JS, `.d.ts`, source maps for all modules).
- Types: `npm run typecheck` passes under strict TS config.
- Unit tests: 62 passed. E2E: 4 credential-gated tests skip cleanly; run with `BINECT_USERNAME` / `BINECT_PASSWORD`.
- Consumer install: validated via `npm pack` + `file:` tarball install; all public exports resolve.
- Docs: README updated with npm install (consumer), local dev paths, and maintainer publish checklist.
- Package: added `publishConfig.access: public` for scoped `@binect/js` first publish.