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

env-overlay

v1.0.14

Published

Easily see what environment you are viewing your application in via a small overlay

Downloads

98

Readme

env-overlay

Easily see what environment you are viewing your application in via a small overlay.

Lightweight (3.3K - 1.3K gzipped), easy to use and easy to customize.

  • Comes with built-in visual, but can easily be customized via options.
  • Calculates visuals for other environment names than the built-in - if none are provided via options

Examples of defaults

Local Environment Development Environment Staging Environment Demo Environment

Calculated result for "other"

Other Environment

Installation

$ npm install env-overlay --save

Usage

import { envOverlay } from 'env-overlay'

// Here assuming the environment variable NODE_ENV is set for sure
// And that it is accessible via process.env
envOverlay(process.env.NODE_ENV)

Signature

(environment: string, options?: IEnvOverlayOptions) => void

Click here to view IEnvOverlayOptions

Options

options.disallow - String or array of strings

Name(s) of environments to exclude usage of env-overlay. The module will bailout early if the the environment name given matches the string, or one of the strings, given.

Default: "production"

options.background - Object { key (env name): value (any valid CSS color) }

A map of background colors for given environment names. There are default colors for the environments "local", "development", "staging" and "demo".

Should an environment not have a matching background color key/value provided in options, then a color will be assigned based on the environment name.

All credit goes to Edd Turtle for this feature

options.text - Object { key (env name): value (any valid CSS color) }

A map of text colors for given environment names. There are default colors for the environments "local", "development", "staging" and "demo".

options.onLoaded - Function

Has the wrapper DOM node of the overlay as its argument for your DOM manipulatory pleasure.

IEnvOverlayOptions interface

The typescript interface for the options (IEnvOverlayOptions) looks like this

export interface IEnvOverlayOptions {
  corner?: 'left' | 'right'
  disallow?: string | string[]
  background?: { [key: string]: string }
  text?: { [key: string]: string }
  onLoaded?: (node: HTMLDivElement) => void
}