@reaxi/node-detect-runtime

0.1.0 • Public • Published

node-detect-runtime

detects node runtime

useful for cli tools

  • local (node index.js)

    like executing using node filename.js directly

  • local installed (node_modules)

    npm i my-app (installed in the project package.json and local node_modules) npm exec my-app | yarn my-app

  • npx

    npx my-app

  • global

    npm i -g my-app

    my-app

usage:

import { getRuntime } from 'node-detect-runtime';

const { isGlobal } = getRuntime();

response:

{
    isLocalNode: boolean,
    isLocalInstalled:boolean,
    isNpx: boolean,
    isGlobal: boolean,
    dir: string,
    cwd: string,
    name: string,
}

/@reaxi/node-detect-runtime/

    Package Sidebar

    Install

    npm i @reaxi/node-detect-runtime

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    3.84 kB

    Total Files

    4

    Last publish

    Collaborators

    • spectralapps