https://github.com/sidoshi/run-by
Figure out if the script is run by npm or yarn
https://github.com/sidoshi/run-by
npm npm-scripts script yarn
Last synced: about 2 months ago
JSON representation
Figure out if the script is run by npm or yarn
- Host: GitHub
- URL: https://github.com/sidoshi/run-by
- Owner: sidoshi
- License: mit
- Created: 2018-02-24T12:05:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-24T12:06:53.000Z (about 7 years ago)
- Last Synced: 2025-04-01T14:21:14.362Z (about 2 months ago)
- Topics: npm, npm-scripts, script, yarn
- Language: JavaScript
- Homepage:
- Size: 55.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# run-by
[](https://travis-ci.org/doshisid/run-by) [](https://github.com/doshisid/run-by/issues) [](http://hits.dwyl.io/doshisid/run-by) [](https://www.npmjs.com/package/run-by) [](https://www.npmjs.com/package/run-by)
> Figure out script is run by npm or yarn
## Install
```bash
npm install --save run-by
```## Usage
```js
import runBy from 'run-by'
```## API
### isYarn: boolean
True if the script is started with `yarn`
### isNpm: boolean
True if script is started with `npm`
### runner: ?string
It's value will be one of `npm`, `yarn` or null depending on how the
script has started. If the script is started with `node`, `runner` will be
`null`.### runBy(execPath: string): RunBy
It takes the exec_path env, by default is `process.env.npm_execpath`.
Returns `isYarn`, `isNpm` and `runner` depending on the `execpath`.## License
MIT © [Siddharth Doshi](https://sid.sh)