Socket
Socket
Sign inDemoInstall

@37bytes/environment-info

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@37bytes/environment-info

A set of utilities to enhance work with internal environments.


Version published
Maintainers
6
Created
Source

About

A set of utilities to enhance work with internal environments.

Installation

Run the following command to install the package:

npm install @37bytes/environment-info

Description

getEnvironmentInfo

A utility for retrieving information about the current application version and the current environment. When called, it returns a string.

It takes an object with the following fields as input:

ParamsTypeRequiredDescription
standstring+Stand name
versionstring-Current Application Version
commitHashstring-Current Commit
branchstring-Current Branch
isProductionboolean-Production Environment Indicator

If isProduction = true, the response will be in the form of: ${version}, otherwise, the utility will return a string in the form of: ${version}|${stand}; ${branch}#${commitHash}

Important: When determining whether it's a production environment, we use a list of internal environments, not a list of production environments.

const isProductionEnvironment = (envName: string) => {
    if (import.meta.env.DEV) {
        return false;
    }
    
    if (['test', 'stage'].includes(envName)) {
        return false;
    }
    
    return true;
}
startEnvironmentTitleWatcher

A utility for adding the stand name to the title of the browser tab. It takes one argument: standName: string

###Version History

1.0.2

  • readme updated

1.0.1

  • Initial release.

FAQs

Package last updated on 26 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc