From 3d11b5729ec5336f7f9b28088d1274e9bd46af98 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Wed, 22 May 2019 23:40:28 +0530 Subject: [PATCH] Adds new info command prints local environment information --- packages/core/parcel-bundler/package.json | 1 + packages/core/parcel-bundler/src/cli.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/core/parcel-bundler/package.json b/packages/core/parcel-bundler/package.json index 427eb23c2f8..ceb57d7c1b5 100644 --- a/packages/core/parcel-bundler/package.json +++ b/packages/core/parcel-bundler/package.json @@ -47,6 +47,7 @@ "deasync": "^0.1.14", "dotenv": "^5.0.0", "dotenv-expand": "^4.2.0", + "envinfo": "^7.3.1", "fast-glob": "^2.2.2", "filesize": "^3.6.0", "get-port": "^3.2.0", diff --git a/packages/core/parcel-bundler/src/cli.js b/packages/core/parcel-bundler/src/cli.js index f65b7bb580b..36a321d2a01 100755 --- a/packages/core/parcel-bundler/src/cli.js +++ b/packages/core/parcel-bundler/src/cli.js @@ -1,5 +1,6 @@ require('v8-compile-cache'); const chalk = require('chalk'); +const envinfo = require('envinfo'); const program = require('commander'); const version = require('../package.json').version; @@ -164,6 +165,21 @@ program .option('--cache-dir ', 'set the cache directory. defaults to ".cache"') .action(bundle); +program + .command('info') + .description('Prints debugging information about the local environment') + .action(function() { + console.log(chalk.bold('\nEnvironment Info:')); + envinfo + .run({ + System: ['OS', 'CPU'], + Binaries: ['Node', 'Yarn', 'npm'], + Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'], + npmGlobalPackages: ['parcel-bundler'] + }) + .then(console.log); + }); + program .command('help [command]') .description('display help information for a command')