From 5b833d1668dc5858b7dbfdaf187975d22a4c2330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Tue, 23 Jun 2020 16:30:12 +0200 Subject: [PATCH] feat(build-name): add build-name option BREAKING CHANGE: --externalBuildId is now --external-build-id --- README.md | 19 ++++++++++--------- src/config.js | 2 +- src/index.js | 12 ++++++------ src/upload.js | 6 +++--- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5b9ba94..89e814f 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,19 @@ Commands: ### Upload ```sh -Usage: argos upload [options] +Usage: index upload [options] Upload screenshots Options: - -T, --token Repository token - -C, --commit Git commit - -B, --branch Git branch - --externalBuildId [string] ID of the build (batch mode only) - --batchCount [int] Number of batches expected (batch mode) - --ignore List of glob files to ignore (ex: "**/*.png,**/diff.jpg") - -h, --help output usage information + -T, --token Repository token + -C, --commit Git commit + -B, --branch Git branch + --external-build-id [string] ID of the build (batch mode only) + --batchCount [int] Number of batches expected (batch mode) + --build-name [string] Name of the build + --ignore List of glob files to ignore (ex: "**/*.png,**/diff.jpg") + -h, --help display help for command ``` ### Cancel @@ -49,7 +50,7 @@ Cancel the build (batch mode only) Options: -T, --token Repository token - --externalBuildId [string] ID of the build (batch mode only) + --external-build-id [string] ID of the build (batch mode only) -h, --help output usage information ``` diff --git a/src/config.js b/src/config.js index 5226bf3..2a493cf 100644 --- a/src/config.js +++ b/src/config.js @@ -38,7 +38,7 @@ const config = convict({ default: '', env: 'ARGOS_BATCH_COUNT', }, - name: { + buildName: { doc: 'Build name', format: String, default: '', diff --git a/src/index.js b/src/index.js index b0ab45c..257afcc 100644 --- a/src/index.js +++ b/src/index.js @@ -13,12 +13,12 @@ updateNotifier({ pkg }).notify() initializeErrorReporter() if (process.env.NODE_ENV !== 'production') { - process.on('exit', code => { + process.on('exit', (code) => { console.info(`exit code: ${code}`) }) } -const list = value => value.split(',') +const list = (value) => value.split(',') program.version(pkg.version) @@ -28,13 +28,13 @@ program .option('-T, --token ', 'Repository token') .option('-C, --commit ', 'Git commit') .option('-B, --branch ', 'Git branch') - .option('--externalBuildId [string]', 'ID of the build (batch mode only)') + .option('--external-build-id [string]', 'ID of the build (batch mode only)') .option( '--batchCount [int]', 'Number of batches expected (batch mode)', parseInt, ) - .option('--name [string]', 'Name of the build') + .option('--build-name [string]', 'Name of the build') .option( '--ignore ', 'List of glob files to ignore (ex: "**/*.png,**/diff.jpg")', @@ -78,8 +78,8 @@ program .command('cancel') .description('Cancel the build (batch mode only)') .option('-T, --token ', 'Repository token') - .option('--externalBuildId [string]', 'ID of the build (batch mode only)') - .action(async command => { + .option('--external-build-id [string]', 'ID of the build (batch mode only)') + .action(async (command) => { console.log(`=== argos-cli: canceling build`) let json diff --git a/src/upload.js b/src/upload.js index 18a7367..3a54f2f 100644 --- a/src/upload.js +++ b/src/upload.js @@ -19,7 +19,7 @@ async function upload(options) { branch: branchOption, commit: commitOption, externalBuildId: externalBuildIdOption, - name: nameOption, + buildName: buildNameOption, batchCount: batchCountOption, } = options @@ -35,9 +35,9 @@ async function upload(options) { externalBuildIdOption || config.get('externalBuildId') || environment.externalBuildId - const name = nameOption || config.get('name') || environment.name const batchCount = batchCountOption || config.get('batchCount') || environment.batchCount + const name = buildNameOption || config.get('buildName') if (environment.ci) { displayInfo(`identified \`${environment.ci}\` environment`) @@ -94,7 +94,7 @@ async function upload(options) { token, externalBuildId, batchCount, - names: screenshots.map(screenshot => screenshot.name), + names: screenshots.map((screenshot) => screenshot.name), }), )