From 1d5e3ad14a9c00f2c9ae012b84c43c245770bb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Chalk?= Date: Fri, 13 Sep 2024 17:27:40 +0200 Subject: [PATCH] feat(nx-plugin): update unicode logo in stdout --- e2e/create-cli-e2e/tests/init.e2e.test.ts | 6 +++--- packages/create-cli/README.md | 4 ++-- packages/create-cli/src/lib/utils.ts | 3 ++- .../create-cli/src/lib/utils.unit.test.ts | 4 ++-- packages/utils/src/index.ts | 21 ++++++++++--------- packages/utils/src/lib/reports/constants.ts | 2 ++ 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/e2e/create-cli-e2e/tests/init.e2e.test.ts b/e2e/create-cli-e2e/tests/init.e2e.test.ts index 6b27684dd..e5b3166cf 100644 --- a/e2e/create-cli-e2e/tests/init.e2e.test.ts +++ b/e2e/create-cli-e2e/tests/init.e2e.test.ts @@ -28,7 +28,7 @@ describe('create-cli-node', () => { expect(code).toBe(0); const cleanedStdout = removeColorCodes(stdout); expect(cleanedStdout).toContain( - '<↗> Generating @code-pushup/nx-plugin:configuration', + '<✓> Generating @code-pushup/nx-plugin:configuration', ); }); @@ -45,7 +45,7 @@ describe('create-cli-node', () => { expect(code).toBe(0); const cleanedStdout = removeColorCodes(stdout); expect(cleanedStdout).toContain( - '<↗> Generating @code-pushup/nx-plugin:configuration', + '<✓> Generating @code-pushup/nx-plugin:configuration', ); }); @@ -61,7 +61,7 @@ describe('create-cli-node', () => { expect(code).toBe(0); const cleanedStdout = removeColorCodes(stdout); expect(cleanedStdout).toContain( - '<↗> Generating @code-pushup/nx-plugin:configuration', + '<✓> Generating @code-pushup/nx-plugin:configuration', ); }); }); diff --git a/packages/create-cli/README.md b/packages/create-cli/README.md index 2f54a8d1c..85112ffe1 100644 --- a/packages/create-cli/README.md +++ b/packages/create-cli/README.md @@ -24,9 +24,9 @@ npm exec @code-pushup/create-cli It should generate the following output: ```bash -> <↗> Generating @code-pushup/nx-plugin:init +> <✓> Generating @code-pushup/nx-plugin:init -> <↗> Generating @code-pushup/nx-plugin:configuration +> <✓> Generating @code-pushup/nx-plugin:configuration CREATE code-pushup.config.ts ``` diff --git a/packages/create-cli/src/lib/utils.ts b/packages/create-cli/src/lib/utils.ts index 894eaa2fb..4a8d3931d 100644 --- a/packages/create-cli/src/lib/utils.ts +++ b/packages/create-cli/src/lib/utils.ts @@ -1,4 +1,5 @@ import { readFile, rm, stat, writeFile } from 'node:fs/promises'; +import { CODE_PUSHUP_UNICODE_LOGO } from '@code-pushup/utils'; import { NX_JSON_CONTENT, NX_JSON_FILENAME, @@ -45,7 +46,7 @@ export async function setupFile( } export function parseNxProcessOutput(output: string) { - return output.trim().replace('NX', '<↗>'); + return output.trim().replace('NX', CODE_PUSHUP_UNICODE_LOGO); } export async function setupNxContext(): Promise<{ diff --git a/packages/create-cli/src/lib/utils.unit.test.ts b/packages/create-cli/src/lib/utils.unit.test.ts index 6ec729994..ce61b9b85 100644 --- a/packages/create-cli/src/lib/utils.unit.test.ts +++ b/packages/create-cli/src/lib/utils.unit.test.ts @@ -8,8 +8,8 @@ import { } from './utils'; describe('parseNxProcessOutput', () => { - it('should replace NX with <↗>', () => { - expect(parseNxProcessOutput('NX some message')).toBe('<↗> some message'); + it('should replace NX with <✓>', () => { + expect(parseNxProcessOutput('NX some message')).toBe('<✓> some message'); }); }); diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 38c6d650c..6a15bb741 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,17 +1,14 @@ export { exists } from '@code-pushup/models'; -export { type Diff, comparePairs, matchArrayItemsByKey } from './lib/diff'; +export { comparePairs, matchArrayItemsByKey, type Diff } from './lib/diff'; export { stringifyError } from './lib/errors'; export { - type ProcessConfig, ProcessError, + executeProcess, + type ProcessConfig, type ProcessObserver, type ProcessResult, - executeProcess, } from './lib/execute-process'; export { - type CrawlFileSystemOptions, - type FileResult, - type MultipleFileResults, crawlFileSystem, directoryExists, ensureDirectoryExists, @@ -24,6 +21,9 @@ export { readJsonFile, readTextFile, removeDirectoryIfExists, + type CrawlFileSystemOptions, + type FileResult, + type MultipleFileResults, } from './lib/file-system'; export { filterItemRefsBy } from './lib/filter'; export { @@ -45,12 +45,12 @@ export { toGitPath, } from './lib/git/git'; export { - type LogResult, getCurrentBranchOrTag, getHashFromTag, getHashes, getLatestCommit, getSemverTags, + type LogResult, } from './lib/git/git.commits-and-tags'; export { groupByStatus } from './lib/group-by-status'; export { @@ -58,11 +58,12 @@ export { isPromiseRejectedResult, } from './lib/guards'; export { logMultipleResults } from './lib/log-results'; -export { type CliUi, type Column, link, ui } from './lib/logging'; +export { link, ui, type CliUi, type Column } from './lib/logging'; export { mergeConfigs } from './lib/merge-configs'; -export { type ProgressBar, getProgressBar } from './lib/progress'; +export { getProgressBar, type ProgressBar } from './lib/progress'; export { CODE_PUSHUP_DOMAIN, + CODE_PUSHUP_UNICODE_LOGO, FOOTER_PREFIX, README_LINK, TERMINAL_WIDTH, @@ -93,7 +94,6 @@ export { export { isSemver, normalizeSemver, sortSemvers } from './lib/semver'; export * from './lib/text-formats'; export { - type CliArgsObject, capitalize, countOccurrences, distinct, @@ -109,6 +109,7 @@ export { toOrdinal, toUnixNewlines, toUnixPath, + type CliArgsObject, } from './lib/transform'; export type { ExcludeNullFromPropertyTypes, diff --git a/packages/utils/src/lib/reports/constants.ts b/packages/utils/src/lib/reports/constants.ts index 7b6d7381a..c8aaf5b4d 100644 --- a/packages/utils/src/lib/reports/constants.ts +++ b/packages/utils/src/lib/reports/constants.ts @@ -13,6 +13,8 @@ export const CODE_PUSHUP_DOMAIN = 'code-pushup.dev'; export const README_LINK = 'https://github.com/code-pushup/cli#readme'; export const REPORT_HEADLINE_TEXT = 'Code PushUp Report'; +export const CODE_PUSHUP_UNICODE_LOGO = '<✓>'; + export const REPORT_RAW_OVERVIEW_TABLE_HEADERS = [ 'Category', 'Score',