Comparing version 3.11.1 to 4.0.0-beta.1
module.exports = { | ||
env: { | ||
node: true | ||
node: true, | ||
}, | ||
extends: ['airbnb-base/legacy', 'prettier'], | ||
parserOptions: { | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
}, | ||
@@ -12,4 +12,5 @@ plugins: ['prettier'], | ||
'vars-on-top': 0, | ||
'prettier/prettier': ['error'] | ||
'no-param-reassign': 0, | ||
'prettier/prettier': ['error'], | ||
}, | ||
}; |
{ | ||
"name": "envinfo", | ||
"version": "3.11.1", | ||
"version": "4.0.0-beta.1", | ||
"description": "Info about your dev environment for debugging purposes", | ||
@@ -12,2 +12,3 @@ "repository": "https://github.com/tabrindle/envinfo", | ||
}, | ||
"engines": { "node": ">=4" }, | ||
"scripts": { | ||
@@ -17,13 +18,10 @@ "lint": "eslint src", | ||
}, | ||
"keywords": [ | ||
"development", | ||
"environment", | ||
"info", | ||
"issues", | ||
"reporting" | ||
], | ||
"keywords": ["development", "env", "environment", "info", "issues", "reporting", "diagnostics"], | ||
"dependencies": { | ||
"array-includes": "^3.0.3", | ||
"clipboardy": "^1.2.2", | ||
"glob": "^7.1.2", | ||
"minimist": "^1.2.0", | ||
"object.entries": "^1.0.4", | ||
"object.values": "^1.0.4", | ||
"os-name": "^2.0.1", | ||
@@ -30,0 +28,0 @@ "which": "^1.2.14" |
207
README.md
@@ -5,40 +5,71 @@ # envinfo | ||
## Installation & Usage | ||
## Installation | ||
Install this package globally: | ||
```sh | ||
npm install -g envinfo | ||
envinfo | ||
npm install -g envinfo || yarn global add envinfo | ||
``` | ||
## Usage | ||
`envinfo` || `npx envinfo` | ||
```bash | ||
# Outputs. | ||
Environment: | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
Node: 8.9.0 | ||
Yarn: 1.2.1 | ||
npm: 5.5.1 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 3.99 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
Watchman: 4.9.0 | ||
Docker: 17.12.0-ce, build c97c6d6 | ||
Homebrew: 1.5.2 | ||
IDEs: | ||
Android Studio: Not Found | ||
Atom: 1.23.3 | ||
VSCode: 1.19.3 | ||
Sublime Text: Build 3143 | ||
Xcode: Xcode 9.0 Build version 9A235 | ||
Android Studio: 2.3 AI-162.3934792 | ||
Languages: | ||
Bash: 3.2.57(1)-release | ||
Go: 1.9.3 | ||
PHP: 7.1.7 | ||
Python: 2.7.10 | ||
Ruby: 2.3.3p222 | ||
Browsers: | ||
Chrome: 63.0.3239.132 | ||
Chrome Canary: 66.0.3333.0 | ||
Firefox: 57.0.1 | ||
Firefox Developer Edition: 57.0 | ||
Firefox Nightly: 58.0a1 | ||
Safari: 11.0 | ||
Safari Technology Preview: 11.1 | ||
``` | ||
## Options | ||
- --packages - Optionally add packages from your package.json: takes either boolean or string in CLI and also array via API | ||
`envinfo --packages react,react-native` | ||
* --clipboard - Optionally copy directly to your clipboard with `envinfo --clipboard`. This feature uses [Clipboardy](https://www.npmjs.com/package/clipboardy) | ||
```bash | ||
Environment: | ||
* --packages - Optionally return packages from your package.json: takes either boolean or comma delimited string in CLI or array via API | ||
`envinfo --packages minimist,which` | ||
```sh | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
Node: 8.9.0 | ||
Yarn: 1.2.1 | ||
npm: 5.5.1 | ||
Watchman: 4.9.0 | ||
Xcode: Xcode 9.0 Build version 9A235 | ||
Android Studio: 2.3 AI-162.3934792 | ||
Packages: (wanted => installed) | ||
react: 16.0.0-alpha.6 => 16.0.0-alpha.6 | ||
react-native: 0.44.0 => 0.44.0 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 4.01 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
... | ||
Packages: | ||
minimist: ^1.2.0 => 1.2.0 | ||
which: ^1.2.14 => 1.3.0 | ||
``` | ||
@@ -49,72 +80,98 @@ | ||
```bash | ||
Environment: | ||
OS: macOS Sierra 10.12.5 | ||
Node: 8.1.3 | ||
Yarn: 0.27.5 | ||
npm: 5.1.0 | ||
Xcode: Xcode 8.3.3 Build version 8E3004b | ||
Android Studio: 2.3 AI-162.3934792 | ||
Packages: (wanted => installed) | ||
eslint: ^4.0.0 => 4.2.0 | ||
prettier-eslint-cli: ^4.1.1 => 4.1.1 | ||
```sh | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 4.01 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
... | ||
Packages: | ||
array-includes: ^3.0.3 => 3.0.3 | ||
clipboardy: ^1.2.2 => 1.2.2 | ||
glob: ^7.1.2 => 7.1.2 | ||
... | ||
minimist: ^1.2.0 => 1.2.0 | ||
object.entries: ^1.0.4 => 1.0.4 | ||
object.values: ^1.0.4 => 1.0.4 | ||
os-name: ^2.0.1 => 2.0.1 | ||
which: ^1.2.14 => 1.2.14 | ||
which: ^1.2.14 => 1.3.0 | ||
``` | ||
- --clipboard - Optionally copy directly to your clipboard with `envinfo --clipboard` | ||
- --cpu - Add CPU and architecture information with `envinfo --cpu` | ||
* --globalPackages - print your npm global packages versions | ||
```bash | ||
Environment: | ||
```sh | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 8.50GHz | ||
Node: 8.9.0 | ||
Yarn: 1.2.1 | ||
npm: 5.5.1 | ||
Watchman: 4.9.0 | ||
Xcode: Xcode 9.0 Build version 9A235 | ||
Android Studio: 2.3 AI-162.3934792 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 4.01 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
... | ||
Global Packages: | ||
envinfo: 4.0.0-beta.1 | ||
exp: 48.0.2 | ||
lerna: 2.7.1 | ||
npm: 5.6.0 | ||
npm-check-updates: 2.14.0 | ||
react-native-cli: 2.0.1 | ||
``` | ||
- --duplicates - will search given packages for duplicates, display in parentheses | ||
* --duplicates - will search given packages for duplicates, display in parentheses | ||
```bash | ||
Packages: (wanted => installed) | ||
minimist: ^1.2.0 => 0.0.8, 1.2.0 | ||
```sh | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 4.01 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
... | ||
Packages: | ||
minimist: ^1.2.0 => 1.2.0 (1.2.0, 0.0.8) | ||
``` | ||
- --fullTree - will traverse and print the entire dependency tree **only works when --packages is array or string | ||
* --fullTree - will traverse and print the entire flattened dependency tree (optionally also with --duplicates) | ||
```bash | ||
... | ||
Packages: (wanted => installed) | ||
abab: 1.0.4 | ||
xtend: 4.0.1 (2.0.6, 2.1.2, 2.2.0, 3.0.0) | ||
abstract-leveldown: 0.12.4 | ||
accepts: 1.3.3 | ||
... | ||
```sh | ||
System: | ||
OS: macOS High Sierra 10.13 | ||
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz | ||
Free Memory: 4.01 GB | ||
Total Memory: 16.00 GB | ||
Binaries: | ||
Node: 8.9.4 | ||
Yarn: 1.3.2 | ||
npm: 5.6.0 | ||
... | ||
Packages: | ||
... | ||
minimatch: 3.0.4 | ||
minimist: ^1.2.0 => 1.2.0 (1.2.0, 0.0.8) | ||
mkdirp: 0.5.1 | ||
... | ||
``` | ||
- --browsers - will print the versions of Chrome, Firefox and Safari if installed. | ||
## Integration | ||
```bash | ||
... | ||
Browsers: | ||
Chrome: 62.0.3202.94 | ||
Chrome Canary: 64.0.3271.0 | ||
Firefox: 57.0 | ||
Firefox Developer Edition: 57.0 | ||
Firefox Nightly: 58.0a1 | ||
Safari: 11.0 | ||
Safari Technology Preview: 11.1 | ||
... | ||
``` | ||
envinfo is live in: | ||
* [React Native](https://github.com/facebook/react-native) (`react-native info`) | ||
* [create-react-app](https://github.com/facebook/create-react-app) (`create-react-app --info`) | ||
* [Exponent Development CLI](https://github.com/expo/exp) (`exp diagnostics`) | ||
* [Solidarity](https://github.com/infinitered/solidarity) (`solidarity report`) | ||
## Contributing | ||
PRs for additional features are welcome! Run `npm run lint && npm run format` before commiting. | ||
PRs for additional features are welcome! Run `npm run lint && npm run format` before committing. | ||
This project came out of a [PR](https://github.com/facebook/react-native/pull/14428) to the React Native CLI tool - issues are reported frequently without important environment information, like Node/npm versions. | ||
envinfo is now live in react-native as of v0.48 as `react-native info`! |
#!/usr/bin/env node | ||
var envinfo = require('./envinfo.js'); | ||
var argv = require('minimist')(process.argv.slice(2)); | ||
var argv = require('minimist')(process.argv.slice(2), { | ||
boolean: ['console', 'fullTree', 'duplicates'], | ||
}); | ||
envinfo.print(argv); | ||
argv.console = true; | ||
envinfo.envinfo(argv); |
@@ -5,111 +5,67 @@ #!/usr/bin/env node | ||
var helpers = require('./helpers'); | ||
var copypasta = require('clipboardy'); | ||
const copypasta = require('clipboardy'); | ||
const helpers = require('./helpers'); | ||
const helperMap = require('./map'); | ||
const formatters = require('./formatters'); | ||
const packages = require('./packages'); | ||
const arrayincludes = require('array-includes'); | ||
const objectentries = require('object.entries'); | ||
const objectvalues = require('object.values'); | ||
if (!Object.entries) objectentries.shim(); | ||
if (!Object.values) objectvalues.shim(); | ||
if (!Array.prototype.includes) arrayincludes.shim(); | ||
module.exports.helpers = helpers; | ||
module.exports.print = function print(opts) { | ||
var options = opts || {}; | ||
var log = []; | ||
log.push(''); | ||
options.clipboard ? log.push('Environment:') : log.push('\x1b[4mEnvironment:\x1b[0m'); | ||
log.push(' OS: ' + helpers.getOperatingSystemInfo()); | ||
if (options.cpu) log.push(' CPU: ' + helpers.getCPUInfo()); | ||
log.push(' Node: ' + helpers.getNodeVersion()); | ||
log.push(' Yarn: ' + helpers.getYarnVersion()); | ||
log.push(' npm: ' + helpers.getNpmVersion()); | ||
log.push(' Watchman: ' + helpers.getWatchmanVersion()); | ||
if (!options.noNativeIDE) log.push(' Xcode: ' + helpers.getXcodeVersion()); | ||
if (!options.noNativeIDE) log.push(' Android Studio: ' + helpers.getAndroidStudioVersion()); | ||
log.push(''); | ||
if (options.browsers && process.platform === 'darwin') { | ||
options.clipboard ? log.push('Browsers:') : log.push('\x1b[4mBrowsers:\x1b[0m'); | ||
var browsers = helpers.browserBundleIdentifiers; | ||
var browserVersions = Object.keys(browsers).map(function browserMap(browser) { | ||
return ' ' + browser + ': ' + helpers.getDarwinApplicationVersion(browsers[browser]); | ||
}); | ||
log = log.concat(browserVersions); | ||
log.push(''); | ||
} | ||
if (options.packages) { | ||
var packageJson = helpers.getPackageJsonByPath('/package.json'); | ||
if (!packageJson) { | ||
log.push('ERROR: package.json not found!'); | ||
log.push(''); | ||
log = log.join('\n'); | ||
if (options.clipboard) copypasta.copy(log); | ||
console.log(log); | ||
return; | ||
} | ||
options.clipboard | ||
? log.push('Packages: (wanted => installed)') | ||
: log.push('\x1b[4mPackages:\x1b[0m (wanted => installed)'); | ||
var devDependencies = packageJson.devDependencies || {}; | ||
var dependencies = packageJson.dependencies || {}; | ||
var topLevelDependencies = Object.assign({}, devDependencies, dependencies); | ||
var packagePaths; | ||
if (options.duplicates || options.fullTree) { | ||
packagePaths = helpers.getAllPackageJsonPaths(); | ||
} | ||
var logFunction = function logFunc(dep) { | ||
var trimmedDep = dep.trim(); | ||
var wanted = topLevelDependencies[trimmedDep] || ''; | ||
var dependencyPackageJson = helpers.getPackageJsonByName(dep); | ||
var installed = dependencyPackageJson ? dependencyPackageJson.version : 'Not Found'; | ||
var duplicates = ''; | ||
if (options.duplicates) { | ||
duplicates = helpers | ||
.getModuleVersions(dep, packagePaths) | ||
.filter(depVer => depVer !== installed) | ||
.join(', '); | ||
if (duplicates) duplicates = ' (' + duplicates + ')'; | ||
} | ||
if (wanted) wanted += ' => '; | ||
log.push(' ' + trimmedDep + ': ' + wanted + installed + duplicates); | ||
module.exports.envinfo = function print(options) { | ||
const props = { | ||
System: ['OS', 'CPU', 'Free Memory', 'Total Memory'], | ||
Binaries: ['Node', 'Yarn', 'npm', 'Watchman', 'Docker', 'Homebrew'], | ||
IDEs: ['Android Studio', 'Atom', 'VSCode', 'Sublime Text', 'Xcode'], | ||
Languages: ['Bash', 'Go', 'PHP', 'Python', 'Ruby'], | ||
Browsers: [ | ||
'Chrome', | ||
'Chrome Canary', | ||
'Firefox', | ||
'Firefox Developer Edition', | ||
'Firefox Nightly', | ||
'Safari', | ||
'Safari Technology Preview', | ||
], | ||
}; | ||
const info = Object.entries(props).reduce((acc, prop) => { | ||
const key = prop[0]; | ||
const value = prop[1]; | ||
const category = { | ||
[key]: value.reduce((cat, name) => { | ||
const fn = helperMap[name.toLowerCase().replace(/\s/g, '_')]; | ||
return Object.assign(cat, { | ||
[name]: fn ? fn() : 'Unknown', | ||
}); | ||
}, {}), | ||
}; | ||
if (Array.isArray(options.packages)) { | ||
options.packages.map(logFunction); | ||
} else if (typeof options.packages === 'string') { | ||
options.packages.split(',').map(logFunction); | ||
} else if (typeof options.packages === 'boolean') { | ||
if (options.fullTree) { | ||
var allDependencies = packagePaths | ||
.map(filePath => { | ||
var json = helpers.getPackageJsonByPath(filePath); | ||
return { | ||
name: json.name, | ||
version: json.version, | ||
}; | ||
}) | ||
.reduce((acc, val) => { | ||
return Object.assign(acc, { | ||
[val.name]: acc[val.name] ? acc[val.name].concat([val.version]) : [val.version], | ||
}); | ||
}, {}); | ||
Object.keys(allDependencies).map(logFunction); | ||
} else { | ||
Object.keys(topLevelDependencies).map(logFunction); | ||
return Object.assign(acc, category); | ||
}, {}); | ||
const npmPackages = options.packages | ||
? { | ||
Packages: packages.getPackageInfo(options.packages, options), | ||
} | ||
} | ||
: {}; | ||
const npmGlobals = options.globalPackages | ||
? { | ||
'Global Packages': packages.getNpmGlobalPackages(), | ||
} | ||
: {}; | ||
const data = Object.assign(info, npmPackages, npmGlobals); | ||
const formatter = (() => { | ||
if (options.json) return formatters.json; | ||
if (options.markdown) return formatters.markdown; | ||
return formatters.table; | ||
})(); | ||
const formatted = formatter(data, { console: false }); | ||
log.push(''); | ||
} | ||
log = log.join('\n'); | ||
if (options.clipboard) copypasta.writeSync(formatted); | ||
if (options.console) console.log(formatter(data, { console: true })); // eslint-disable-line no-console | ||
if (options.clipboard) { | ||
copypasta.writeSync(log); | ||
} | ||
console.log(log); | ||
return formatted; | ||
}; |
var childProcess = require('child_process'); | ||
var fs = require('fs'); | ||
var glob = require('glob'); | ||
var os = require('os'); | ||
@@ -8,2 +6,3 @@ var osName = require('os-name'); | ||
var which = require('which'); | ||
var utils = require('./utils'); | ||
@@ -20,43 +19,8 @@ var browserBundleIdentifiers = { | ||
function uniq(arr) { | ||
return Array.from(new Set(arr)); | ||
} | ||
function requireJson(filePath) { | ||
var packageJson; | ||
if (fs.existsSync(filePath)) { | ||
try { | ||
packageJson = require(filePath); | ||
} catch (e) { | ||
return false; | ||
} | ||
return packageJson; | ||
} | ||
return false; | ||
} | ||
function getPackageJsonByName(dep) { | ||
return this.requireJson(path.join(process.cwd(), '/node_modules/', dep, '/package.json')); | ||
} | ||
function getPackageJsonByPath(filePath) { | ||
return this.requireJson(path.join(process.cwd(), filePath)); | ||
} | ||
function run(cmd) { | ||
return ( | ||
childProcess | ||
.execSync(cmd, { | ||
stdio: [0, 'pipe', 'ignore'], | ||
}) | ||
.toString() || '' | ||
).trim(); | ||
} | ||
function findDarwinApplication(id) { | ||
var appPath; | ||
try { | ||
appPath = run('mdfind "kMDItemCFBundleIdentifier=="' + id + '""').replace(/(\s)/g, '\\ '); | ||
appPath = utils.run('mdfind "kMDItemCFBundleIdentifier=="' + id + '""').replace(/(\s)/g, '\\ '); | ||
} catch (error) { | ||
appPath = false; | ||
appPath = null; | ||
} | ||
@@ -76,2 +40,17 @@ return appPath; | ||
function getDarwinApplicationVersion(bundleIdentifier) { | ||
var version; | ||
try { | ||
version = utils.run( | ||
generatePlistBuddyCommand( | ||
path.join(findDarwinApplication(bundleIdentifier), 'Contents', 'Info.plist'), | ||
['CFBundleShortVersionString'] | ||
) | ||
); | ||
} catch (error) { | ||
version = 'Not Found'; | ||
} | ||
return version; | ||
} | ||
function getAndroidStudioVersion() { | ||
@@ -81,8 +60,9 @@ var androidStudioVersion = 'Not Found'; | ||
try { | ||
androidStudioVersion = run( | ||
generatePlistBuddyCommand('/Applications/Android\\ Studio.app/Contents/Info.plist', [ | ||
'CFBundleShortVersionString', | ||
'CFBundleVersion', | ||
]) | ||
) | ||
androidStudioVersion = utils | ||
.run( | ||
generatePlistBuddyCommand('/Applications/Android\\ Studio.app/Contents/Info.plist', [ | ||
'CFBundleShortVersionString', | ||
'CFBundleVersion', | ||
]) | ||
) | ||
.split('\n') | ||
@@ -95,6 +75,6 @@ .join(' '); | ||
try { | ||
var linuxBuildNumber = run('cat /opt/android-studio/build.txt'); | ||
var linuxVersion = run( | ||
'cat /opt/android-studio/bin/studio.sh | grep "$Home/.AndroidStudio" | head -1' | ||
).match(/\d\.\d/)[0]; | ||
var linuxBuildNumber = utils.run('cat /opt/android-studio/build.txt'); | ||
var linuxVersion = utils | ||
.run('cat /opt/android-studio/bin/studio.sh | grep "$Home/.AndroidStudio" | head -1') | ||
.match(/\d\.\d/)[0]; | ||
androidStudioVersion = `${linuxVersion} ${linuxBuildNumber}`; | ||
@@ -106,8 +86,10 @@ } catch (err) { | ||
try { | ||
var windowsVersion = run( | ||
'wmic datafile where name="C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio.exe" get Version' | ||
).replace(/(\r\n|\n|\r)/gm, ''); | ||
var windowsBuildNumber = run( | ||
'type "C:\\\\Program Files\\\\Android\\\\Android Studio\\\\build.txt"' | ||
).replace(/(\r\n|\n|\r)/gm, ''); | ||
var windowsVersion = utils | ||
.run( | ||
'wmic datafile where name="C:\\\\Program Files\\\\Android\\\\Android Studio\\\\bin\\\\studio.exe" get Version' | ||
) | ||
.replace(/(\r\n|\n|\r)/gm, ''); | ||
var windowsBuildNumber = utils | ||
.run('type "C:\\\\Program Files\\\\Android\\\\Android Studio\\\\build.txt"') | ||
.replace(/(\r\n|\n|\r)/gm, ''); | ||
androidStudioVersion = `${windowsVersion} ${windowsBuildNumber}`; | ||
@@ -121,2 +103,12 @@ } catch (err) { | ||
function getAtomVersion() { | ||
var atomVersion; | ||
try { | ||
atomVersion = getDarwinApplicationVersion('com.github.atom'); | ||
} catch (error) { | ||
atomVersion = 'Not Found'; | ||
} | ||
return atomVersion; | ||
} | ||
function getCPUInfo() { | ||
@@ -132,21 +124,98 @@ var CPUInfo; | ||
function getDarwinApplicationVersion(bundleIdentifier) { | ||
var version; | ||
function getBashVersion() { | ||
var bashVersion; | ||
try { | ||
version = run( | ||
generatePlistBuddyCommand( | ||
path.join(findDarwinApplication(bundleIdentifier), 'Contents', 'Info.plist'), | ||
['CFBundleShortVersionString'] | ||
) | ||
); | ||
bashVersion = utils.run('echo $BASH_VERSION'); | ||
} catch (error) { | ||
version = 'Not Found'; | ||
bashVersion = 'Not Found'; | ||
} | ||
return version; | ||
return bashVersion; | ||
} | ||
function getPhpVersion() { | ||
var phpVersion; | ||
try { | ||
phpVersion = utils.run('php -v').split(' ', 2)[1]; | ||
} catch (error) { | ||
phpVersion = 'Not Found'; | ||
} | ||
return phpVersion; | ||
} | ||
function getDockerVersion() { | ||
var dockerVersion; | ||
try { | ||
dockerVersion = utils.run('docker --version').replace('Docker version ', ''); | ||
} catch (error) { | ||
dockerVersion = 'Not Found'; | ||
} | ||
return dockerVersion; | ||
} | ||
function getFreeMemory() { | ||
return utils.toReadableBytes(os.freemem()); | ||
} | ||
function getTotalMemory() { | ||
return utils.toReadableBytes(os.totalmem()); | ||
} | ||
function getSublimeTextVersion() { | ||
var sublimeTextVersion; | ||
try { | ||
sublimeTextVersion = getDarwinApplicationVersion('com.sublimetext.3'); | ||
} catch (error) { | ||
sublimeTextVersion = 'Not Found'; | ||
} | ||
return sublimeTextVersion; | ||
} | ||
function getHomeBrewVersion() { | ||
var homeBrewVersion; | ||
if (process.platform === 'darwin') { | ||
try { | ||
homeBrewVersion = utils | ||
.run('brew --version') | ||
.replace('Homebrew ', '') | ||
.split('\n', 1) | ||
.join(); | ||
} catch (error) { | ||
homeBrewVersion = 'Not Found'; | ||
} | ||
} else homeBrewVersion = 'N/A'; | ||
return homeBrewVersion; | ||
} | ||
function getGoVersion() { | ||
var goVersion; | ||
try { | ||
goVersion = utils | ||
.run('go version') | ||
.replace('go version go', '') | ||
.split(' ', 1) | ||
.join(); | ||
} catch (error) { | ||
goVersion = 'Not Found'; | ||
} | ||
return goVersion; | ||
} | ||
function getRubyVersion() { | ||
var rubyVersion; | ||
try { | ||
rubyVersion = utils | ||
.run('ruby --version') | ||
.replace('ruby ', '') | ||
.split(' ', 1) | ||
.join(); | ||
} catch (error) { | ||
rubyVersion = 'Not Found'; | ||
} | ||
return rubyVersion; | ||
} | ||
function getNodeVersion() { | ||
var nodeVersion; | ||
try { | ||
nodeVersion = run('node --version').replace('v', ''); | ||
nodeVersion = utils.run('node --version').replace('v', ''); | ||
} catch (error) { | ||
@@ -161,3 +230,3 @@ nodeVersion = 'Not Found'; | ||
try { | ||
npmVersion = run('npm -v'); | ||
npmVersion = utils.run('npm -v'); | ||
} catch (error) { | ||
@@ -169,2 +238,20 @@ npmVersion = 'Not Found'; | ||
function getNpmGlobalPackages() { | ||
var npmGlobalPackages; | ||
try { | ||
npmGlobalPackages = utils.run('npm list -g --depth=0 --json'); | ||
npmGlobalPackages = JSON.parse(npmGlobalPackages); | ||
npmGlobalPackages = Object.entries(npmGlobalPackages.dependencies).reduce((acc, dep) => { | ||
const name = dep[0]; | ||
const info = dep[1]; | ||
return Object.assign(acc, { | ||
[name]: info.version, | ||
}); | ||
}, {}); | ||
} catch (error) { | ||
npmGlobalPackages = 'Not Found'; | ||
} | ||
return npmGlobalPackages; | ||
} | ||
function getOperatingSystemInfo() { | ||
@@ -175,3 +262,3 @@ var operatingSystemInfo; | ||
if (process.platform === 'darwin') { | ||
operatingSystemInfo = operatingSystemInfo + ' ' + run('sw_vers -productVersion '); | ||
operatingSystemInfo = operatingSystemInfo + ' ' + utils.run('sw_vers -productVersion '); | ||
} | ||
@@ -188,3 +275,3 @@ } catch (err) { | ||
var watchmanPath = which.sync('watchman'); | ||
watchmanVersion = watchmanPath && run(watchmanPath + ' --version'); | ||
watchmanVersion = watchmanPath && utils.run(watchmanPath + ' --version'); | ||
} catch (error) { | ||
@@ -196,2 +283,30 @@ watchmanVersion = 'Not Found'; | ||
function getVSCodeVersion() { | ||
var VSCodeVersion; | ||
try { | ||
VSCodeVersion = utils | ||
.run('code --version') | ||
.split('\n', 1) | ||
.join(''); | ||
} catch (error) { | ||
VSCodeVersion = 'Not Found'; | ||
} | ||
return VSCodeVersion; | ||
} | ||
function getPythonVersion() { | ||
var pythonVersion; | ||
var pythonPath; | ||
try { | ||
pythonPath = utils.run('which python'); | ||
pythonVersion = childProcess | ||
.execFileSync(pythonPath, ['-c', 'import platform; print(platform.python_version());']) | ||
.toString() | ||
.replace(/(\r\n|\n|\r)/gm, ''); | ||
} catch (error) { | ||
pythonVersion = 'Not Found'; | ||
} | ||
return pythonVersion; | ||
} | ||
function getXcodeVersion() { | ||
@@ -204,3 +319,4 @@ var xcodeVersion; | ||
xcodePath && | ||
run(xcodePath + ' -version') | ||
utils | ||
.run(xcodePath + ' -version') | ||
.split('\n') | ||
@@ -220,3 +336,3 @@ .join(' '); | ||
try { | ||
yarnVersion = run('yarn --version'); | ||
yarnVersion = utils.run('yarn --version'); | ||
} catch (error) { | ||
@@ -228,27 +344,2 @@ yarnVersion = 'Not Found'; | ||
function getAllPackageJsonPaths() { | ||
return glob.sync('node_modules/**/package.json'); | ||
} | ||
function getModuleVersions(dependency, packagePaths) { | ||
var paths; | ||
var versions; | ||
try { | ||
paths = packagePaths.filter(function filterPackagePaths(packagePath) { | ||
return packagePath.includes(`/${dependency}/package.json`); | ||
}); | ||
versions = paths | ||
.map(function mapPathsForVersion(packageJsonPath) { | ||
var packageJson = getPackageJsonByPath(packageJsonPath); | ||
if (packageJson) return packageJson.version; | ||
return false; | ||
}) | ||
.filter(Boolean); | ||
versions = uniq(versions).sort(); | ||
} catch (error) { | ||
versions = []; | ||
} | ||
return versions; | ||
} | ||
module.exports = { | ||
@@ -258,17 +349,24 @@ browserBundleIdentifiers: browserBundleIdentifiers, | ||
generatePlistBuddyCommand: generatePlistBuddyCommand, | ||
getAllPackageJsonPaths: getAllPackageJsonPaths, | ||
getAndroidStudioVersion: getAndroidStudioVersion, | ||
getAtomVersion: getAtomVersion, | ||
getBashVersion: getBashVersion, | ||
getCPUInfo: getCPUInfo, | ||
getDarwinApplicationVersion: getDarwinApplicationVersion, | ||
getModuleVersions: getModuleVersions, | ||
getDockerVersion: getDockerVersion, | ||
getFreeMemory: getFreeMemory, | ||
getGoVersion: getGoVersion, | ||
getHomeBrewVersion: getHomeBrewVersion, | ||
getNodeVersion: getNodeVersion, | ||
getNpmGlobalPackages: getNpmGlobalPackages, | ||
getNpmVersion: getNpmVersion, | ||
getOperatingSystemInfo: getOperatingSystemInfo, | ||
getPackageJsonByName: getPackageJsonByName, | ||
getPackageJsonByPath: getPackageJsonByPath, | ||
getPhpVersion: getPhpVersion, | ||
getPythonVersion: getPythonVersion, | ||
getRubyVersion: getRubyVersion, | ||
getSublimeTextVersion: getSublimeTextVersion, | ||
getTotalMemory: getTotalMemory, | ||
getVSCodeVersion: getVSCodeVersion, | ||
getWatchmanVersion: getWatchmanVersion, | ||
getXcodeVersion: getXcodeVersion, | ||
getYarnVersion: getYarnVersion, | ||
requireJson: requireJson, | ||
uniq: uniq, | ||
}; |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
80366
13
754
176
8
2
3
+ Addedarray-includes@^3.0.3
+ Addedobject.entries@^1.0.4
+ Addedobject.values@^1.0.4
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarray-includes@3.1.8(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedobject.entries@1.1.8(transitive)
+ Addedobject.values@1.2.0(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.3(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)