1.3.1 • Published 4 years ago

environment-badge v1.3.1

Weekly downloads
78
License
MIT
Repository
-
Last release
4 years ago

It's easy to get disoriented when your application runs in multiple environments. This package checks the domain & adds a simple indicator to let you know when you're not on production. It looks for the following environments out of the box:

  • Local development, at localhost or .test domains.
  • Development environments, at dev. or *-dev. subdomains.
  • QA environments, at qa. or *-qa. subdomains.
  • Preview environments, at preview. or *-preview. subdomains.

Usage

If you're building your application with Webpack, Create React App, or a similar tool, simply import this module:

require('environment-badge')();

For applications without a front-end build system, you can embed this script from unpkg:

<script
  type="text/javascript"
  src="https://unpkg.com/environment-badge@^1.0.0/dist/bundle.js"
></script>

Advanced Usage

You can customize what environments are checked for by providing an array. For example:

require('environment-badge')([
  {
    displayName: 'local',
    host: /(^localhost$|\.test$)/,
  },
  {
    displayName: 'staging',
    host: /^([a-z0-9-]*-)?staging\./,
    backgroundColor: '#000000',
    foregroundColor: '#fcd116',
  },
]);

License

© DoSomething.org. environment-badge is free software, and may be redistributed under the terms specified in the LICENSE file. The name and logo for DoSomething.org are trademarks of Do Something, Inc and may not be used without permission.

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago