Skip to content

Commit

Permalink
refactor: cleanup logger exports (#434)
Browse files Browse the repository at this point in the history
* chore: yarn upgrade

* refactor: cleanup logger exports

* chore: add change sets
  • Loading branch information
mdjastrzebski committed Feb 21, 2024
1 parent b938142 commit 08ee40f
Show file tree
Hide file tree
Showing 14 changed files with 1,025 additions and 994 deletions.
8 changes: 8 additions & 0 deletions .changeset/many-cups-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@callstack/reassure-logger': minor
'@callstack/reassure-compare': patch
'@callstack/reassure-measure': patch
'@callstack/reassure-cli': patch
---

refactor: simplify `reassure-logger` package exports
2 changes: 1 addition & 1 deletion packages/reassure-cli/src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { copyFileSync, existsSync, readFileSync, appendFileSync } from 'node:fs';
import * as path from 'node:path';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import type { CommandModule } from 'yargs';
import {
CI_SCRIPT,
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-cli/src/commands/measure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { spawnSync } from 'node:child_process';
import type { CommandModule } from 'yargs';
import { compare, formatMetadata } from '@callstack/reassure-compare';
import type { PerformanceMetadata } from '@callstack/reassure-compare';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import { RESULTS_DIRECTORY, RESULTS_FILE, BASELINE_FILE } from '../constants';
import { applyCommonOptions, CommonOptions } from '../options';
import { getGitBranch, getGitCommitHash } from '../utils/git';
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-cli/src/utils/git.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import simpleGit from 'simple-git';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';

export async function getGitBranch() {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/reassure-cli/src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { logger } from '@callstack/reassure-logger';
import { configure } from '@callstack/reassure-logger';
import type { CommonOptions } from '../options';

export function configureLoggerOptions(options: CommonOptions) {
logger.configure({
configure({
silent: options.silent,
verbose: options.verbose,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-compare/src/output/console.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import type { AddedEntry, CompareResult, CompareEntry, RemovedEntry } from '../types';
import { formatCount, formatDuration, formatMetadata, formatCountChange, formatDurationChange } from '../utils/format';
import type { PerformanceMetadata } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-compare/src/output/json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs/promises';
import * as path from 'path';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import type { CompareResult } from '../types';

export async function writeToJson(filePath: string, data: CompareResult) {
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-compare/src/output/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import { headers, emphasis } from 'markdown-builder';
// @ts-ignore
import markdownTable from 'markdown-table';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import {
formatCount,
formatDuration,
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-compare/src/utils/logs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';

export let errors: string[] = [];
export let warnings: string[] = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-logger/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as logger from './logger';
export * from './logger';
export { warnOnce } from './warn-once';
4 changes: 2 additions & 2 deletions packages/reassure-measure/src/measure-renders.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { logger, warnOnce } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import { config } from './config';
import { RunResult, processRunResults } from './measure-helpers';
import { showFlagsOutputIfNeeded, writeTestStats } from './output';
Expand Down Expand Up @@ -36,7 +36,7 @@ export async function measurePerformance(
ui: React.ReactElement,
options?: MeasureRendersOptions
): Promise<MeasureResults> {
warnOnce(
logger.warnOnce(
'The `measurePerformance` function has been renamed to `measureRenders`.\n\nThe `measurePerformance` alias is now deprecated and will be removed in future releases.'
);

Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-measure/src/output.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs/promises';
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import { config } from './config';
import type { MeasureResults, MeasureType } from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/reassure-measure/src/testing-library.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@callstack/reassure-logger';
import * as logger from '@callstack/reassure-logger';
import { config, Render, Cleanup } from './config';

type TestingLibraryApi = {
Expand Down
1,983 changes: 1,003 additions & 980 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 08ee40f

Please sign in to comment.