Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/npm-cli-version
Get the currently installed npm version
https://github.com/shinnn/npm-cli-version
async javascript nodejs npm promise version
Last synced: 22 days ago
JSON representation
Get the currently installed npm version
- Host: GitHub
- URL: https://github.com/shinnn/npm-cli-version
- Owner: shinnn
- License: isc
- Created: 2017-05-29T11:22:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-08T01:29:32.000Z (almost 6 years ago)
- Last Synced: 2024-10-30T03:44:57.372Z (2 months ago)
- Topics: async, javascript, nodejs, npm, promise, version
- Language: JavaScript
- Homepage:
- Size: 178 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-cli-version
[![npm version](https://img.shields.io/npm/v/npm-cli-version.svg)](https://www.npmjs.com/package/npm-cli-version)
[![Build Status](https://travis-ci.com/shinnn/npm-cli-version.svg?branch=master)](https://travis-ci.com/shinnn/npm-cli-version)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/npm-cli-version.svg)](https://coveralls.io/github/shinnn/npm-cli-version?branch=master)Get the currently installed [`npm` CLI](https://github.com/npm/cli) version
```javascript
const npmCliVersion = require('npm-cli-version');(async () => {
await npmCliVersion(); //=> '5.5.1'
})();
```Unlike the [prior](https://github.com/ngryman/npm-v) [arts](https://github.com/vvo/npm-version), it doesn't [execute](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) `npm --version` in a child process.
## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install npm-cli-version
```## API
```javascript
const npmCliVersion = require('npm-cli-version');
```### npmCliVersion()
Return: `Promise`
## Related projects
* [parse-npm-version](https://github.com/shinnn/parse-npm-version) — Similar to this module, but returns a `Promise` for a [node-semver](https://github.com/npm/node-semver) object instead
* [npm-cli-dir](https://github.com/shinnn/npm-cli-dir) — Resolve the directory path where `npm` CLI is installed. Used by this module.## License
[ISC License](./LICENSE) © 2018 - 2019 Shinnosuke Watanabe