diff --git a/bin/cli b/bin/cli index ddec831..a7f0482 100755 --- a/bin/cli +++ b/bin/cli @@ -24,7 +24,7 @@ const { argv } = yargs(hideBin(process.argv)) }, async (argv) => { process.on('exit', shutdown) - log('info', 'Starting precise-watcher...') + log('info', 'Starting precise-watcher') await start(argv) }) .command('stop', 'Stop watching files.', {}, () => stop()) diff --git a/src/handle-event.js b/src/handle-event.js index 15b65d5..284bcb4 100644 --- a/src/handle-event.js +++ b/src/handle-event.js @@ -125,7 +125,7 @@ module.exports = (eventName, commands, { debug(`Running ${cmd}, args: ${JSON.stringify(cmdArgs)}, options: ${JSON.stringify(cmdOptions)}.`) runCmd(cmd, cmdArgs, cmdOptions).then(async (status) => { - log('info', `${cmd} exited with status ${status}`) + log(`${status > 0 ? 'error' : 'verbose'}`, `${status > 0 ? '✕' : '✓'} ${cmd} ${cmdArgs.join(' ')}`) if (serial) { debug('Calling next command in serial...') diff --git a/src/lib/log.js b/src/lib/log.js index b66f52d..eadf04e 100644 --- a/src/lib/log.js +++ b/src/lib/log.js @@ -3,10 +3,10 @@ const colors = require('colors/safe') colors.setTheme({ silly: 'rainbow', input: 'grey', - verbose: 'cyan', + verbose: ['dim', 'magenta'], prompt: 'grey', - info: 'green', - data: 'grey', + info: 'bold', + data: 'italic', help: 'cyan', warn: 'yellow', debug: 'blue', diff --git a/src/lib/run-cmd.js b/src/lib/run-cmd.js index 7f0e2a6..cdd5d53 100644 --- a/src/lib/run-cmd.js +++ b/src/lib/run-cmd.js @@ -5,7 +5,8 @@ module.exports = async (cmd, args, options) => await new Promise((resolve, rejec const child = spawn(cmd, args, options) const { stdout, stderr } = child - log('info', `Running ${cmd}`) + log('info', `\nRunning ${cmd}`) + log('verbose', `▸ ${cmd} ${args.join(' ')}`) stdout.on('data', (data) => { log('data', data.toString()) diff --git a/src/stop.js b/src/stop.js index c299078..fc822ee 100644 --- a/src/stop.js +++ b/src/stop.js @@ -6,7 +6,7 @@ const removeAllWatchers = async (watchers) => await Promise.all( ) module.exports = async (watchers) => { - log('info', 'Stopping precise-watcher...') + log('info', '\nStopping precise-watcher') if (!watchers) { debug('Removing all watchers.') diff --git a/test/integration/cli.test.js b/test/integration/cli.test.js index b90efee..c674711 100644 --- a/test/integration/cli.test.js +++ b/test/integration/cli.test.js @@ -23,8 +23,8 @@ describe('precise-watcher', () => { expect(stderr).toBe('') expect(stdout).toBe([ - 'Starting precise-watcher...', - 'Stopping precise-watcher...' + 'Starting precise-watcher', + '\nStopping precise-watcher' ].join('\n') + '\n') }) @@ -52,8 +52,8 @@ describe('precise-watcher', () => { expect(stderr).toMatch(`Setting config to ${config}`) expect(stderr).toMatch(`Reading ${path.join(cwd, config)}`) expect(stdout).toBe([ - 'Starting precise-watcher...', - 'Stopping precise-watcher...' + 'Starting precise-watcher', + '\nStopping precise-watcher' ].join('\n') + '\n') }) @@ -63,6 +63,6 @@ describe('precise-watcher', () => { }) expect(stderr).toBe('') - expect(stdout).toBe('Stopping precise-watcher...\n') + expect(stdout).toBe('\nStopping precise-watcher\n') }) })