diff --git a/bin/now-deploy b/bin/now-deploy index 09404e8..21f9771 100755 --- a/bin/now-deploy +++ b/bin/now-deploy @@ -10,6 +10,7 @@ import bytes from 'bytes'; import chalk from 'chalk'; import minimist from 'minimist'; import Now from '../lib'; +import toHumanPath from '../lib/utils/to-human-path'; import ms from 'ms'; import { handleError, error } from '../lib/error'; @@ -139,7 +140,7 @@ async function sync (token) { const start = Date.now(); if (!quiet) { - console.log(`> Deploying "${path}"`); + console.log(`> Deploying ${chalk.bold(toHumanPath(path))}`); } const now = new Now(apiUrl, token, { debug }); diff --git a/lib/error.js b/lib/error.js index 08ade63..52d5777 100644 --- a/lib/error.js +++ b/lib/error.js @@ -21,6 +21,6 @@ export function handleError (err) { } } -export function error (msg) { - console.error(`> ${chalk.red('Error')} ${msg}`); +export function error (err) { + console.error(`> ${chalk.red('Error!')} ${err}`); } diff --git a/lib/utils/to-human-path.js b/lib/utils/to-human-path.js new file mode 100644 index 0000000..a8533c9 --- /dev/null +++ b/lib/utils/to-human-path.js @@ -0,0 +1,14 @@ +import { resolve } from 'path'; + +// cleaned-up `$HOME` (i.e.: no trailing slash) +const HOME = resolve(process.env.HOME); + +/** + * Attempts to show the given path in + * a human-friendly form. For example, + * `/Users/rauchg/test.js` becomes `~/test.js` + */ + +export default function toHumanPath (path) { + return path.replace(HOME, '~'); +}