From d9ad6d2a9e4122528ac086060e019835cc5a1ece Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Fri, 6 Sep 2024 13:02:19 -0600 Subject: [PATCH 1/4] fix: use CI mode if DEBUG is set --- src/multi-stage-output.tsx | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/multi-stage-output.tsx b/src/multi-stage-output.tsx index b2a4f02..2000004 100644 --- a/src/multi-stage-output.tsx +++ b/src/multi-stage-output.tsx @@ -17,11 +17,34 @@ import {Design, RequiredDesign, constructDesignParams} from './design.js' import {StageStatus, StageTracker} from './stage-tracker.js' import {readableTime} from './utils.js' -// Taken from https://github.com/sindresorhus/is-in-ci -const isInCi = - env.CI !== '0' && - env.CI !== 'false' && - ('CI' in env || 'CONTINUOUS_INTEGRATION' in env || Object.keys(env).some((key) => key.startsWith('CI_'))) +function isTruthy(value: string | undefined): boolean { + return Boolean(value) && value !== '0' && value !== 'false' +} + +/** + * Determines whether the CI mode should be used. + * + * If the MSO_DISABLE_CI_MODE environment variable is set to a truthy value, CI mode will be disabled. + * + * If the CI environment variable is set, CI mode will be enabled. + * + * If the DEBUG environment variable is set, CI mode will be enabled. + * + * @returns {boolean} True if CI mode should be used, false otherwise. + */ +function shouldUseCIMode(): boolean { + if (isTruthy(env.MSO_DISABLE_CI_MODE)) return false + // Inspired by https://github.com/sindresorhus/is-in-ci + if ( + isTruthy(env.CI) && + ('CI' in env || 'CONTINUOUS_INTEGRATION' in env || Object.keys(env).some((key) => key.startsWith('CI_'))) + ) + return true + if (isTruthy(env.DEBUG)) return true + return false +} + +const isInCi = shouldUseCIMode() export type MultiStageOutputOptions> = { /** From 0a23260576760f07ef24d910bcd1a21a9d9bce19 Mon Sep 17 00:00:00 2001 From: svc-cli-bot Date: Fri, 6 Sep 2024 21:02:49 +0000 Subject: [PATCH 2/4] chore(release): 0.5.2-qa.0 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9fec17..67b3b12 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oclif/multi-stage-output", "description": "Terminal output for oclif commands with multiple stages", - "version": "0.5.1", + "version": "0.5.2-qa.0", "author": "Salesforce", "bugs": "https://github.com/oclif/multi-stage-output/issues", "dependencies": { From 85965fac7576bc6875a466c5e85346cbc650133c Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Mon, 9 Sep 2024 09:09:37 -0600 Subject: [PATCH 3/4] fix: improve CI check --- src/multi-stage-output.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/multi-stage-output.tsx b/src/multi-stage-output.tsx index 2000004..b386225 100644 --- a/src/multi-stage-output.tsx +++ b/src/multi-stage-output.tsx @@ -18,7 +18,7 @@ import {StageStatus, StageTracker} from './stage-tracker.js' import {readableTime} from './utils.js' function isTruthy(value: string | undefined): boolean { - return Boolean(value) && value !== '0' && value !== 'false' + return value !== '0' && value !== 'false' } /** @@ -33,14 +33,14 @@ function isTruthy(value: string | undefined): boolean { * @returns {boolean} True if CI mode should be used, false otherwise. */ function shouldUseCIMode(): boolean { - if (isTruthy(env.MSO_DISABLE_CI_MODE)) return false + if (env.MSO_DISABLE_CI_MODE && isTruthy(env.MSO_DISABLE_CI_MODE)) return false // Inspired by https://github.com/sindresorhus/is-in-ci if ( isTruthy(env.CI) && ('CI' in env || 'CONTINUOUS_INTEGRATION' in env || Object.keys(env).some((key) => key.startsWith('CI_'))) ) return true - if (isTruthy(env.DEBUG)) return true + if (env.DEBUG && isTruthy(env.DEBUG)) return true return false } From cda2e0251ecf617a361cb5ab2d05265d6f6443e0 Mon Sep 17 00:00:00 2001 From: svc-cli-bot Date: Wed, 11 Sep 2024 20:52:35 +0000 Subject: [PATCH 4/4] chore(release): 0.5.4-qa.0 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd23e00..efebc2b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oclif/multi-stage-output", "description": "Terminal output for oclif commands with multiple stages", - "version": "0.5.3", + "version": "0.5.4-qa.0", "author": "Salesforce", "bugs": "https://github.com/oclif/multi-stage-output/issues", "dependencies": {