From 0af1f69ed20d20a7ba5f6307a71f065abf3a5684 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Tue, 5 Jul 2016 16:17:21 -0700 Subject: [PATCH] index: add quiet mode --- lib/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/index.js b/lib/index.js index e0acd72..3131409 100644 --- a/lib/index.js +++ b/lib/index.js @@ -28,7 +28,7 @@ export default class Now extends EventEmitter { this._onRetry = this._onRetry.bind(this); } - async create (path, { forceNew, forceSync }) { + async create (path, { forceNew, forceSync, quiet = false }) { this._path = path; try { @@ -139,20 +139,22 @@ export default class Now extends EventEmitter { }); if (sizeExceeded) { - console.log(`> \u001b[31mWarning!\u001b[39m ${sizeExceeded} of the files ` + + console.error(`> \u001b[31mWarning!\u001b[39m ${sizeExceeded} of the files ` + 'exceeded the limit for your plan.\n' + `> See ${chalk.underline('https://zeit.co/account')} to upgrade.`); } } - if (engines && engines.node) { - if (missingVersion) { - console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)`); + if (!quiet) { + if (engines && engines.node) { + if (missingVersion) { + console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)`); + } else { + console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (requested: ${chalk.dim(`\`${engines.node}\``)})`); + } } else { - console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (requested: ${chalk.dim(`\`${engines.node}\``)})`); + console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)`); } - } else { - console.log(`> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)`); } this._id = deployment.deploymentId;