npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-feature-controls

v5.1.1

Published

Hot plug your features.

Downloads

207

Readme

ember-feature-controls

CI Ember Observer Score License: MIT

Hot plug your features: ember-feature-controls provides an administration panel to enable or disable feature flags.

Demo is available here: https://dazzlingfugu.github.io/ember-feature-controls/.

Compatibility

  • Ember.js v4.8 or above
  • Ember CLI v4.8 or above
  • Node.js v18 or above

Installation

ember install ember-feature-controls

Usage

This addon works with ember-feature-flags. It displays an administration panel to enable or disable feature flags.

Screenshot

Within a template

The addon provides a component <FeatureControls /> to add in a template of your app. This component basically displays the table with actions buttons.

<FeatureControls />

Options

<FeatureControls @showRefresh={{false}} @showReset={{false}} />
  • showRefresh: Show the refresh button, true by default
  • showReset: Show the refresh button, true by default

Within the router

You can configure a route for feature-controls in your app. This will add a route under the name features-list and the path features by default. You can use an object as second parameter to configure the route like any route in your app. For example:

// app/router.ts
import EmberRouter from "@ember/routing/router";
import config from "dummy/config/environment";
import featureControlsRouteSetup from "ember-feature-controls/route-setup";

export default class Router extends EmberRouter {
  location = config.locationType;
  rootURL = config.rootURL;
}

Router.map(function () {
  featureControlsRouteSetup(this, { path: "__features" });
});

Configuration

config.featureFlags

Define a set of custom feature flags by defining the featureFlags property in config/environment.js.

Then, you can configure a set of metadata for your feature flags by defining the property featureControls. This is an easy way to change settings for a given environment. For example:

// config/environment.js
module.exports = function (environment) {
  var ENV = {
    featureFlags: {
      "show-spinners": true,
      "download-cats": false,
    },
    featureControls: {
      useLocalStorage: true,
      metadata: [
        {
          key: "show-spinners",
          description: "Show spinners",
        },
        {
          key: "download-cats",
          description: "Add button to download cats image",
          reload: true,
        },
        {
          key: "easter-egg",
          hide: true,
        },
      ],
    },
  };

  return ENV;
};

About useLocalStorage: this property is not mandatory, but setting it to true register the new value of some flag in the local storage. This way, the values for all flags remain the same after refreshing your application.

About reload: this property is not mandatory. It forces the browser to reload if this flag change. This is needed for flags involved in the setup of your application.

About hide: this property is not mandatory. It forces to hide the feature flag in the listing.

Contributing

See the Contributing guide for details.

Contributors

License

This project is licensed under the MIT License.