generated from coulomb/repo-seed
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:
57
README.md
57
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user