From 2c292e0f922ea6ea3ea4d8422424301aa79eca2d Mon Sep 17 00:00:00 2001 From: Roy Riojas Date: Sat, 4 Feb 2017 23:41:52 -0500 Subject: [PATCH] REF: (Breaking change) blessed and blessed-contrib modules are optional --- README.md | 2 +- package.json | 4 ++-- source/src/main.js | 24 ++++++++++++++++++++++-- source/src/options.js | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 742c40f..3ff020c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ npm i -g shell-executor Usage: shell-exec [options] cmd1, cmd2, ... cmdn Options: - -d, --dashboard Show the processes in a nice dashboard if space allows it. No more than 9 commands are allowed in this mode + -d, --dashboard Show the processes in a nice dashboard if space allows it. No more than 9 commands are allowed in this mode. Requires the install of blessed@0.1.81 and blessed-contrib@4.7.5 -b, --bail Stop execution as soon as one of the task exit with an exit code different than 0 or an error happened -o, --sortOutput Sort the stdout and stderr output from the commands -h, --help Show this help diff --git a/package.json b/package.json index b79387d..49aa2ce 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,8 @@ "babel-preset-es2015": "6.18.0", "babel-preset-react": "6.16.0", "babel-preset-stage-0": "6.16.0", + "blessed": "0.1.81", + "blessed-contrib": "4.7.5", "changelogx": "2.0.1", "eslint": "3.13.1", "eslint-config-airbnb": "14.0.0", @@ -70,8 +72,6 @@ "watch-spawn": "2.0.0" }, "dependencies": { - "blessed": "0.1.81", - "blessed-contrib": "4.7.5", "clix": "2.2.1", "dispatchy": "1.0.3", "es6-promise": "4.0.5", diff --git a/source/src/main.js b/source/src/main.js index 2c19960..bf29f20 100644 --- a/source/src/main.js +++ b/source/src/main.js @@ -1,5 +1,3 @@ -import { getGridAndScreen, setProcessLogToGrid } from './grid'; - const exec = require('child_process').exec; const path = require('path'); const nodeProcess = require('./process'); @@ -35,6 +33,28 @@ const printFailed = entries => module.exports = { _executeCommandsInDashboard(program, cmds) { + let gridModule; + + try { + // eslint-disable-next-line + gridModule = require('./grid'); + } catch (err) { + program.error(` + + Cannot load the grid module. ared blessed and blessed-contrib installed? + + try doing: + + npm i blessed@0.1.81 blessed-contrib@4.7.5 + + or with yarn + + yarn add blessed@0.1.81 blessed-contrib@4.7.5 + `); + } + + + const { getGridAndScreen, setProcessLogToGrid } = gridModule; const { grid, screen } = getGridAndScreen(); const count = cmds.length; diff --git a/source/src/options.js b/source/src/options.js index 1cf951f..608e14c 100644 --- a/source/src/options.js +++ b/source/src/options.js @@ -13,7 +13,7 @@ module.exports = { option: 'dashboard', alias: 'd', type: 'Boolean', - description: 'Show the processes in a nice dashboard if space allows it', + description: 'Show the processes in a nice dashboard if space allows it. No more than 9 commands are allowed in this mode. Requires the install of blessed@0.1.81 and blessed-contrib@4.7.5', }, { option: 'bail',