diff --git a/bin/pos-cli-deploy.js b/bin/pos-cli-deploy.js index bedb69f4..f4cb4db6 100755 --- a/bin/pos-cli-deploy.js +++ b/bin/pos-cli-deploy.js @@ -13,11 +13,12 @@ program .option('-o --old-assets-upload', 'use old assets upload strategy') .option('-p --partial-deploy', 'Partial deployment, does not remove data from directories missing from the build') .option('--dry-run', 'Validate the release on the server without applying any changes') + .option('-v, --verbose', 'Show full file paths in deploy report (default: summary only)') .action(async (environment, params) => { if (params.force) logger.Warn('-f flag is deprecated and does not do anything.'); if (params.dryRun && !process.env.DEV) { - logger.Warn('--dry-run is temporarily disabled. This feature will be enabled soon.'); + await logger.Warn('--dry-run is temporarily disabled. This feature will be enabled soon.'); process.exit(0); } @@ -39,7 +40,8 @@ program CI: process.env.CI === 'true', // TODO: Get rid off global system env, make it normal argument to function. PARTIAL_DEPLOY: !!params.partialDeploy, - DIRECT_ASSETS_UPLOAD: !params.oldAssetsUpload + DIRECT_ASSETS_UPLOAD: !params.oldAssetsUpload, + VERBOSE: !!params.verbose }); deployStrategy.run({ strategy, opts: { env, authData, params } }); diff --git a/lib/push.js b/lib/push.js index 4e0571af..202701a1 100644 --- a/lib/push.js +++ b/lib/push.js @@ -10,7 +10,7 @@ let gateway; const toCount = (val) => Array.isArray(val) ? val.length : (typeof val === 'number' ? val : 0); -const printDeployReport = (deployReport) => { +const printDeployReport = (deployReport, { verbose = false } = {}) => { if (!deployReport) return; const lines = []; @@ -27,11 +27,13 @@ const printDeployReport = (deployReport) => { ]; lines.push(` ${category}: ${parts.join(', ')}`); - if (Array.isArray(upserted)) { - upserted.forEach(p => lines.push(` + ${p}`)); - } - if (Array.isArray(deleted)) { - deleted.forEach(p => lines.push(chalk.red(` - ${p}`))); + if (verbose) { + if (Array.isArray(upserted)) { + upserted.forEach(p => lines.push(` + ${p}`)); + } + if (Array.isArray(deleted)) { + deleted.forEach(p => lines.push(chalk.red(` - ${p}`))); + } } } @@ -100,7 +102,7 @@ const push = async env => { .then(getDeploymentStatus) .then((response) => { logger.Debug('Release deployed'); - printDeployReport(response.report); + printDeployReport(response.report, { verbose: env.VERBOSE === true || env.VERBOSE === 'true' }); if (response.warning) { logger.Warn(response.warning); }