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

ld-scheduler

v1.5.0

Published

Schedule launch darkly flags on or off

Downloads

8

Readme

ld-scheduler

npm version npm downloads npm npm

A library to schedule launch darkly feature flag deployment :alarm_clock:

So you use Launch Darkly for feature flagging and a/b testing which is very cool. Why this package then you ask?

Once you have created your feature flags in launch darkly, and then developed and tested your feature, you are now ready to deploy your code to production. You will then also need to turn on your feature flags in production. You can do this at deploy time, either manually through the dashboard or programmatically through the launch darkly rest apis. However, what if your feature needs to be deployed at a later time? You need to decouple the deployment of your app from the deployment of your features. Enter ld-scheduler.

You can now create flags in launch darkly and then set a date and time you want the kill switch to be turned on or off. This decouples your app deployment from feature deployment. No one should stay up past midnight just to turn on/off the kill switch.

  • Schedule feature flags on or off at an exact date and time (useful for zero dark thirty deployments)
  • Decouple code deployment from feature deployment
  • Works with slack! Ld-scheduler posts a message to slack when it successfully updates (or fails to update) your flags!

Installation

yarn add ld-scheduler

or the old school way

npm i --save ld-scheduler

Quickstart

  1. Create a new node project and set it up with babel. You'll need babel-register, babel-polyfill and babel-preset-latest. See here for example.

  2. In your main code file, import ld-scheduler and call the runEveryXSeconds function. If you don't use slack (you should!) you don't have to specify the slack property. By default, ld-scheduler polls launch darkly every 60 seconds:

    import ldScheduler from 'ld-scheduler';
       
    ldScheduler.runEveryXSeconds({
      environment: 'test',
      apiKey: 'your-secret-api-key',
      slack: 'your-slack-webhook-url'
    });
  3. Tag your feature flag. In launch darkly's dashboard, under the Settings tab of your feature flag, under Tags, add one or more "scheduled" tags, each prefixed with an environment name. For example, if you have both a test and production environment, you will need 2 tags: 'test-scheduled' and 'production-scheduled'. Still in the Settings tab, under Description, add the following JSON object:

    {
       "taskType": "killSwitch",
       "value": true,
       "targetDeploymentDateTime": "2017-02-27 22:00 +11:00",
       "description": "Test flag for dev"
    }

    where

    • taskType is killSwitch
    • value is true (kill switch on) or false (kill switch off)
    • targetDeploymentDateTime must be in the format of YYYY-MM-DD HH:mm Z Note: the utc offset is important otherwise moment will use the host's timezone.
    • description is a textual string for the purpose of human readability

    The screenshot below is an example configuration:

    ld-scheduler-flag-settings

  4. Run your project and watch magic happens!

Example

Check example for a fully working example. Remember you'll need to enter your own launch darkly api key and your own slack url (if you use slack).