@kablamo/kerosene-feature-flags
A simple assertion style feature flag for use in CI/CD deployment pipelines, especially well suited to monorepos and Trunk Based Development.
Last updated a year ago by ojkelly .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @kablamo/kerosene-feature-flags 
SYNC missed versions from official npm registry.

Kerosene Feature Flags

A simple assertion style feature flag for use in CI/CD deployment pipelines, especially well suited to monorepos and Trunk Based Development.

Feature Flags give you the ability to safely enable features in different environments, and for specific cohorts of people.

yarn add @kablamo/kerosene-feature-flags

Getting Started

With a Kerosene Feature Flag you define a flag as an assertion of conditions, and their expected values.

import { flag } from "@kablamo/kerosene-feature-flags";

const flags = {
    FEATURE123: flag(c => [
        c.condition("environment").must.be.any.of(["development", "staging"]),
        c.condition("group").must.be.exactly("users"),
    ]),
    FEATURE42: flag(c => [
        c.condition("environment").must.be.exactly("production"),
        c.condition("group").must.be.exactly("beta"),
    ]),
};

export { flags };

When you want to use the flags in your application, you import them, and execute them as a function, passing in an object with runtime information.

import { flags } from "./features";

const runtime = {
    environment: "production",
    group: "users",
    browser: "Firefox",
};

if (flags.FEATURE123(runtime)) {
    console.log("New feature");
} else {
    console.log("Old feature");
}
// output:
// New feature

if (flags.FEATURE42(runtime)) {
    console.log("New feature");
} else {
    console.log("Old feature");
}
// output:
// Old feature

Current Tags

  • 1.0.0                                ...           latest (a year ago)

6 Versions

  • 1.0.0                                ...           a year ago
  • 0.0.7                                ...           a year ago
  • 0.0.6                                ...           a year ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |