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-status

v1.3.7

Published

A command to show each env status, whether it is using for testing or available for using.

Downloads

64

Readme

env-status

codecov Commitizen friendly

This package includes below features:

  • Command for showing each env status, whether it is using for testing or available for using.
  • Commands for easing arc diff and arc land.
  • Command for identifying whether a source branch can be merged into a target branch.

Recommended git flow as below:

npx -p env-status env-status staging

Setup

  • Install

    npm install --save-dev env-status

  • Create .envstatus.js file in your project root as below.

    module.exports = {
      envs: ['production', 'staging', 'dev', 'dev1', 'dev2', 'dev3'],
      url: function (env) {
        return `https://raw.githubusercontent.com/juicecube/env-status/master/envs/${env}.json`;
      },
      gen: 'dist/env-status.json'
    };
    • envs is an array of the name of all the envs. (required)
    • url is a function returning the json file described next part. (required)
    • gen the env status file output path.
  • Everytime you publish your project, publish a json file contains blow information.

    {
      "branch": "master",
      "commit": "17f53ca090d44fd89f805425dee8f21a801a967d",
      "author": "webyom <[email protected]>",
      "date": 1561874837800
    }
    • branch is the branch you checkout when you publish your project.
    • commit is the the HEAD commit hash when you publish your project.
    • author is the HEAD commit author when you publish your project.
    • date is the timestamp when you publish your project.

Command

  • env-status

    env-status will show all the env status

    env-status

    env-status staging will show staging and production (if defined) status

    env-status staging

    env-status --init will create .envstatus.js config file in your project root.

    env-status --gen will generate the json file for publishing.

  • merge-validate

    Validate whether a source branch can be merged into target branch.

    merge-validate <srouce-branch> <target-branch>

  • env-build-validate

    Validate whether a branch can be built in current environment.

    env-build-validate

API

  • getLastCommit(now: Date): object

    Return the last commit information of current branch as below.

    {
      branch: 'master',
      commit: '197b0c4',
      author: 'webyom',
      date: 1562055960000
    }
  • getBranchName(): string

    Return current working branch name.

  • getBranchType(branch: string): string

    Return branch type, refer to BRANCH_TYPES for full possible value list.

  • fetchEnvData(env: string): Promise<object>

    Return the last commit information of current branch as below.

    {
      env: 'production',
      version: '1.1.0',
      branch: 'master',
      commit: '17f53ca090d44fd89f805425dee8f21a801a967d',
      author: 'webyom <[email protected]>',
      date: 1561874837800
    }

    or

    {
      env: 'production',
      err: 'CONFIG_UNDEFINED' // refer to FETCH_ERR for full possible value list
    }
  • isEnvAvailable(env: string): Promise<bool>

    Return a promise of bool, telling whether an env available.

  • FETCH_ERR

    {
      CONFIG_UNDEFINED: 'CONFIG_UNDEFINED',
      URL_FUNCTION_UNDEFINED: 'URL_FUNCTION_UNDEFINED',
      LOAD_ERROR: 'LOAD_ERROR',
      PARSE_RESPONSE_ERROR: 'PARSE_RESPONSE_ERROR'
    }
  • BRANCH_TYPES

    {
      SPRINT: 'SPRINT', // sprint/xxx
      SPRINT_FEATURE: 'SPRINT_FEATURE', // feat/xxx
      SPRINT_FIX: 'SPRINT_FIX', // fix/xxx
      HOTFIX: 'HOTFIX', // hotfix/xxx
      MASTER: 'MASTER', // master
      OTHERS: 'OTHERS'
    }

How to identify an env is available or using

npx -p env-status env-status staging