1.0.2 • Published 8 months ago

@37bytes/environment-info v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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.
1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago