Skip to content
Proyek

Unleash/unleash-node-sdk

Lihat di GitHub

Tentang

Unleash client SDK for Node.js

Alat pengembangan

Cara angka ini diukur

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
0
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

Unleash node SDK on npm npm downloads Build Status Coverage Status

unleash-node-sdk

The official Unleash SDK for Node.js. This SDK lets you evaluate feature flags in your Node.js services and applications.

Unleash is an open-source feature management platform. You can use this SDK with Unleash Enterprise or Unleash Open Source.

For complete documentation, see the Node.js SDK reference.

Requirements

  • Node.js 20 or later

Installation

npm install unleash-client

Quick start

The following example initializes the SDK and checks a feature flag:

import { startUnleash } from 'unleash-client';

const unleash = await startUnleash({
  url: 'https://<your-unleash-instance>/api/',
  appName: 'my-node-name',
  customHeaders: { Authorization: '<your-backend-token>' },
});

const enabled = unleash.isEnabled('my-feature');
if (enabled) {
  // new behavior
}

const variant = unleash.getVariant('checkout-experiment');
if (variant.name === 'blue') {
  // blue variant behavior
} else if (variant.name === 'green') {
  // green variant behavior
}

Contributing

Local development

Clone the repository and install dependencies:

git clone https://github.com/Unleash/unleash-node-sdk.git
cd unleash-node-sdk
yarn install
yarn prepare

yarn prepare sets up git hooks and builds the project. It doesn't run automatically on install because dependency lifecycle scripts are disabled (see .yarnrc) as a supply-chain hardening measure.

The client specification test data is included as a dev dependency (@unleash/client-specification). It defines a shared contract that all Unleash SDKs test against.

Running tests

yarn test        # run tests
yarn coverage    # run tests with coverage

Benchmarking

Run the feature flag evaluation benchmark:

yarn bench:isEnabled

Code style and formatting

The project uses Biome for linting and formatting:

yarn lint        # check for issues
yarn lint:fix    # auto-fix issues

Building

yarn build       # compile TypeScript to lib/

License

Apache-2.0

Jelajahi proyek terkait

Memuat…