0.1.0 • Published 1 year ago

@adra-network/feature-flag-module v0.1.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
1 year ago

#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
0.1.0

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago