From 0a680e977b7904e7f62a8c1c0f3d533329b23fb0 Mon Sep 17 00:00:00 2001 From: Nathan Grebowiec <44781230+njgreb@users.noreply.github.com> Date: Fri, 6 Nov 2020 15:39:34 -0600 Subject: [PATCH] feat: bring back ascii banner, but make it configurable (#703) --- .env-example | 2 ++ src/banner.ts | 21 +++++++++++++++++++-- src/config.ts | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.env-example b/.env-example index c7fdce02df..2193726de4 100644 --- a/.env-example +++ b/.env-example @@ -2,6 +2,8 @@ # Read https://github.com/jef/streetmerchant#customization for help on customizing this file ############################################################################################# +ASCII_BANNER= +ASCII_COLOR= BROWSER_TRUSTED= COUNTRY= DESKTOP_NOTIFICATIONS= diff --git a/src/banner.ts b/src/banner.ts index 2f2ff0be60..54e61832cb 100644 --- a/src/banner.ts +++ b/src/banner.ts @@ -3,5 +3,22 @@ import {readFileSync} from 'fs'; const version = readFileSync('version.txt', 'utf8'); -export const banner = chalk.gray.bold(`STREETMERCHANT -${version}`); +export const banner = { + asciiVersion: ` + ██████ ▄▄▄█████▓ ██▀███ ▓█████ ▓█████▄▄▄█████▓ ███▄ ▄███▓▓█████ ██▀███ ▄████▄ ██░ ██ ▄▄▄ ███▄ █ ▄▄▄█████▓ +▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀ ▓█ ▀▓ ██▒ ▓▒▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ▓██░ ██▒▒████▄ ██ ▀█ █ ▓ ██▒ ▓▒ +░ ▓██▄ ▒ ▓██░ ▒░▓██ ░▄█ ▒▒███ ▒███ ▒ ▓██░ ▒░▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▒██▀▀██░▒██ ▀█▄ ▓██ ▀█ ██▒▒ ▓██░ ▒░ + ▒ ██▒░ ▓██▓ ░ ▒██▀▀█▄ ▒▓█ ▄ ▒▓█ ▄░ ▓██▓ ░ ▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒░▓█ ░██ ░██▄▄▄▄██ ▓██▒ ▐▌██▒░ ▓██▓ ░ +▒██████▒▒ ▒██▒ ░ ░██▓ ▒██▒░▒████▒░▒████▒ ▒██▒ ░ ▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░░▓█▒░██▓ ▓█ ▓██▒▒██░ ▓██░ ▒██▒ ░ +▒ ▒▓▒ ▒ ░ ▒ ░░ ░ ▒▓ ░▒▓░░░ ▒░ ░░░ ▒░ ░ ▒ ░░ ░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░ ▒ ░░▒░▒ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒ ░░ +░ ░▒ ░ ░ ░ ░▒ ░ ▒░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ▒ ░▒░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░ ░ +░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░░ ░ ░ ▒ ░ ░ ░ ░ + ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ + +${version}`, + render(ascii: boolean, hexColor: string) { + return chalk.hex(hexColor).bold(ascii ? this.asciiVersion : this.stringVersion); + }, + stringVersion: `STREETMERCHANT +${version}` +}; diff --git a/src/config.ts b/src/config.ts index b83b45360c..f62b7cb6be 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,12 +1,12 @@ import {banner} from './banner'; -console.info(banner); - import {config as config_} from 'dotenv'; import path from 'path'; config_({path: path.resolve(__dirname, '../.env')}); +console.info(banner.render(envOrBoolean(process.env.ASCII_BANNER, false), envOrString(process.env.BANNER_COLOR, '#808080'))); + /** * Returns environment variable, given array, or default array. *