@adra-network/feature-flag-module
v0.1.0
Published
Feature flag module
Downloads
8
Readme
#Feature Flag Module
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;
- Add
@adra-network/feature-flag-module
dependency to your project
# Using npm
npm install --save-dev @adra-network/feature-flag-module
- Add
@adra-network/feature-flag-module
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: ["@adra-network/feature-flag-module"],
});
- 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