@adra-network/feature-flag-module
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

#Feature Flag Module

npm version npm downloads License Nuxt

Feature flag module for doing amazing things.

Quick Setup

For the plugin to be blocking, you need to add the following to your nuxt.config.ts file:

// nuxt.config.ts
ssr: false;
  1. Add @adra-network/feature-flag-module dependency to your project
# Using npm
npm install --save-dev @adra-network/feature-flag-module
  1. Add @adra-network/feature-flag-module to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ["@adra-network/feature-flag-module"],
});
  1. Optional - Configure the module via nuxt.config.ts
// nuxt.config.ts
{
    adraFeatureFlag: {
    /**
    * Mock the feature flag service for local development
    * Always returns true when calling useFlag()
    *
    * @default false
    */
        mock: boolean,
    /**
     * Your API key for the feature flag service
     * Required
     * @default process.env.FEATURE_FLAG_API_KEY
     */
        apiKey: string,
    /**
     * The URL for the feature flag service
     * Required
     * @default process.env.FEATURE_FLAG_URL
     */
        url: string,
    /**
     * The name of your application as registered in the feature flag service
     * @default process.env.APP_NAME
     */
        appName: string,
    /**
     * The interval in seconds at which the feature flags should be refreshed
     * @default 60
     */
        refreshInterval: number,
    }
}

That's it! You can now use Feature Flag Module in your Nuxt app ✨

For your conveniance the module will automatically inject the useFlag function into your Vue components.

<template>
  <SomeComponent v-if="featureEnabled" />
</template>

<script setup lang="ts">
const featureEnabled = useFlag(<flag-name>);
</script>

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

Readme

Keywords

none

Package Sidebar

Install

npm i @adra-network/feature-flag-module

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

9.15 kB

Total Files

13

Last publish

Collaborators

  • relocate7140
  • francoisauclair911