From 878a7bd752d2062459442ce66965971f0aeac70b Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Mon, 16 Nov 2020 17:30:32 +0100 Subject: [PATCH] disable colors in ci mode --- CHANGELOG.md | 4 ++-- src/index.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8645c8..38e58fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.24 +## 0.25 -- Exit code on failure +- disable color in CI mode diff --git a/src/index.ts b/src/index.ts index a97c418..4879376 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import 'colors' +import colors from 'colors' import { program } from 'commander' import { setCIMode } from 'clitastic' @@ -17,7 +17,7 @@ import install from './handlers/install' import { uninstall } from './handlers/uninstall' import { upgrade } from './handlers/upgrade' -export const VERSION = '0.24' +export const VERSION = '0.25' export const INSTALL_DIR = '/usr/local/bin' let requireConfig: boolean = true @@ -111,7 +111,9 @@ const { verbose, config: configFile, ci } = program.parse(process.argv) export const VERBOSE = verbose export let config: Config setCIMode(ci) -;(async () => { +if (ci) colors.disable() + +async function main() { try { const lock = readLock() if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red) @@ -129,4 +131,5 @@ setCIMode(ci) } finally { unlock() } -})() +} +main()