Skip to content

Commit 2c5af87

Browse files
committed
refactor: add various logs
1 parent 9cad03a commit 2c5af87

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Diff for: packages/core/src/lib/collect-and-persist.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function collectAndPersistReports(
2828

2929
const report = await collect(options);
3030
const sortedScoredReport = sortReport(scoreReport(report));
31+
3132
const persistResults = await persistReport(
3233
report,
3334
sortedScoredReport,

Diff for: packages/plugin-eslint/src/lib/runner/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
filePathToCliArg,
1313
objectToCliArgs,
1414
readJsonFile,
15+
ui,
1516
} from '@code-pushup/utils';
1617
import type { ESLintPluginRunnerConfig, ESLintTarget } from '../config.js';
1718
import { lint } from './lint.js';
@@ -25,6 +26,8 @@ export async function executeRunner({
2526
const { slugs, targets } =
2627
await readJsonFile<ESLintPluginRunnerConfig>(runnerConfigPath);
2728

29+
ui().logger.log(`ESLint plugin executing ${targets.length} lint targets`);
30+
2831
const linterOutputs = await targets.reduce(
2932
async (acc, target) => [...(await acc), await lint(target)],
3033
Promise.resolve<LinterOutput[]>([]),

Diff for: packages/utils/src/lib/execute-process.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { gray } from 'ansis';
12
import {
23
type ChildProcess,
34
type ChildProcessByStdio,
@@ -6,6 +7,7 @@ import {
67
spawn,
78
} from 'node:child_process';
89
import type { Readable, Writable } from 'node:stream';
10+
import { ui } from './logging.js';
911
import { calcDuration } from './reports/utils.js';
1012

1113
/**
@@ -148,6 +150,13 @@ export function executeProcess(cfg: ProcessConfig): Promise<ProcessResult> {
148150
const date = new Date().toISOString();
149151
const start = performance.now();
150152

153+
const logCommand = [command, ...(args || [])].join(' ');
154+
ui().logger.log(
155+
gray(
156+
`Executing command:\n${logCommand}\nIn working directory:\n${cfg.cwd}`,
157+
),
158+
);
159+
151160
return new Promise((resolve, reject) => {
152161
// shell:true tells Windows to use shell command for spawning a child process
153162
const spawnedProcess = spawn(command, args ?? [], {

0 commit comments

Comments
 (0)