Comparing version 4.0.1 to 4.0.2
{ | ||
"name": "envinfo", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Info about your dev environment for debugging purposes", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/tabrindle/envinfo", |
@@ -10,3 +10,3 @@ # envinfo | ||
Install this package globally: | ||
To use as a CLI tool, install this package globally: | ||
@@ -17,4 +17,14 @@ ```sh | ||
## Usage | ||
Or, use without installing with npx: | ||
`npx envinfo` | ||
To use as a library in another project: | ||
```sh | ||
npm install envinfo || yarn add envinfo | ||
``` | ||
## CLI Usage | ||
`envinfo` || `npx envinfo` | ||
@@ -79,4 +89,70 @@ | ||
## Options | ||
## Programmatic Usage | ||
Envinfo takes a configuration object and returns a string (optionally yaml, json or markdown) | ||
```javascript | ||
import envinfo from 'envinfo'; | ||
console.log( | ||
envinfo.run( | ||
{ | ||
System: ['OS', 'CPU'], | ||
Binaries: ['Node', 'Yarn', 'npm'], | ||
Browsers: ['Chrome', 'Firefox', 'Safari'], | ||
npmPackages: ['styled-components', 'babel-plugin-styled-components'], | ||
}, | ||
{ json: true } | ||
) | ||
); | ||
``` | ||
``` | ||
{ | ||
"System": { | ||
"OS": "macOS High Sierra 10.13", | ||
"CPU": "x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" | ||
}, | ||
"Binaries": { | ||
"Node": "8.9.4", | ||
"Yarn": "1.3.2", | ||
"npm": "5.6.0" | ||
}, | ||
"Browsers": { | ||
"Chrome": "65.0.3325.146", | ||
"Firefox": 58.0, | ||
"Safari": 11.0 | ||
}, | ||
"npmPackages": { | ||
"styled-components": { | ||
"wanted": "^3.2.1", | ||
"installed": "3.2.1" | ||
}, | ||
"babel-plugin-styled-components": { | ||
"wanted": "^1.5.1", | ||
"installed": "1.5.1" | ||
} | ||
} | ||
} | ||
``` | ||
All of envinfo's helpers are also exported for use. You can use envinfo as a whole, or just the parts that you need, like this: | ||
```javascript | ||
import { helpers } from 'envinfo' | ||
const OS = helpers.getOperatingSystemInfo(); | ||
const docker = helpers.getDockerVersion(); | ||
console.log({ OS, docker }); | ||
``` | ||
``` | ||
{ | ||
OS: 'macOS High Sierra 10.13' | ||
docker: '17.12.0-ce, build c97c6d6' | ||
} | ||
``` | ||
## CLI Options | ||
* --clipboard - Optionally copy directly to your clipboard with `envinfo --clipboard`. This feature uses [Clipboardy](https://www.npmjs.com/package/clipboardy) | ||
@@ -86,3 +162,3 @@ | ||
`envinfo --npmPackages=minimist,which` | ||
`envinfo --npmPackages minimist,which` | ||
@@ -101,3 +177,3 @@ ```sh | ||
`envinfo --system --binaries --npmGlobalPackages` | ||
`envinfo --npmGlobalPackages` | ||
@@ -137,2 +213,3 @@ ```sh | ||
* [Solidarity](https://github.com/infinitered/solidarity) (`solidarity report`) | ||
* [styled-components](https://github.com/styled-components/styled-components) ((ISSUE_TEMPLATE.md)) | ||
@@ -139,0 +216,0 @@ ## Contributing |
@@ -36,4 +36,5 @@ 'use strict'; | ||
function main(props, options) { | ||
// set props to passed in props or default all capabilites | ||
// set props to passed in props or default all capabilities | ||
const defaults = Object.keys(props).length > 0 ? props : capabilities; | ||
options = options || {}; | ||
@@ -78,2 +79,4 @@ // get data by iterating and calling helper functions | ||
if (options.all) return main(Object.assign({}, capabilities, { npmPackages: true }), options); | ||
// if raw, parse the row options and skip to main | ||
if (options.raw) return main(JSON.parse(options.raw), options); | ||
// generic function to make sure passed option exists in capability list | ||
@@ -99,4 +102,4 @@ // TODO: This will eventually be replaced with a better fuzzy finder. | ||
// envinfo.run({ system: [os, cpu], fullTree: true }) | ||
function run(options) { | ||
main(options.props, options); | ||
function run(args, options) { | ||
return main(args, options); | ||
} | ||
@@ -103,0 +106,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
395910
995
215