Skip to content

Commit 6c32c1e

Browse files
authored
chore: refactor services and update related tests (#69)
1 parent 09bb5ae commit 6c32c1e

29 files changed

Lines changed: 1066 additions & 58 deletions

examples/accurate-engine-example.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import { tmpdir } from 'node:os';
1111
import { join } from 'node:path';
1212

13-
import { ModestBenchConfigurationManager } from '../src/config/manager.js';
14-
import { BenchmarkFileLoader } from '../src/core/loader.js';
1513
import { AccurateEngine } from '../src/index.js';
16-
import { ModestBenchProgressManager } from '../src/progress/manager.js';
17-
import { ModestBenchReporterRegistry } from '../src/reporters/registry.js';
18-
import { FileHistoryStorage } from '../src/storage/history.js';
14+
import { ModestBenchConfigurationManager } from '../src/services/config-manager.js';
15+
import { BenchmarkFileLoader } from '../src/services/file-loader.js';
16+
import { FileHistoryStorage } from '../src/services/history-storage.js';
17+
import { ModestBenchProgressManager } from '../src/services/progress-manager.js';
18+
import { ModestBenchReporterRegistry } from '../src/services/reporter-registry.js';
1919

2020
const main = async () => {
2121
console.log('🎯 AccurateEngine Example\n');

src/bootstrap.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* @packageDocumentation
66
*/
77

8-
import { ModestBenchConfigurationManager } from './config/manager.js';
98
import { type ModestBenchEngine } from './core/engine.js';
109
import { TinybenchEngine } from './core/engines/index.js';
11-
import { BenchmarkFileLoader } from './core/loader.js';
12-
import { ModestBenchProgressManager } from './progress/manager.js';
13-
import { ModestBenchReporterRegistry } from './reporters/registry.js';
14-
import { FileHistoryStorage } from './storage/history.js';
10+
import { ModestBenchConfigurationManager } from './services/config-manager.js';
11+
import { BenchmarkFileLoader } from './services/file-loader.js';
12+
import { FileHistoryStorage } from './services/history-storage.js';
13+
import { ModestBenchProgressManager } from './services/progress-manager.js';
14+
import { ModestBenchReporterRegistry } from './services/reporter-registry.js';
1515

1616
/**
1717
* Initializes the ModestBench engine with default dependencies.

src/index.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
*/
88

99
export { bootstrap as modestbench } from './bootstrap.js';
10-
// Configuration management
11-
export { ModestBenchConfigurationManager } from './config/manager.js';
1210

13-
// Core engine and loader
11+
// Core engine
1412
export { ModestBenchEngine } from './core/engine.js';
1513
export { AccurateEngine, TinybenchEngine } from './core/engines/index.js';
1614

17-
export { BenchmarkFileLoader } from './core/loader.js';
18-
1915
// Statistical utilities
2016
export {
2117
calculateStatistics,
@@ -26,21 +22,21 @@ export {
2622
// Error classes
2723
export * from './errors/index.js';
2824

29-
// Progress tracking
30-
export { ModestBenchProgressManager } from './progress/manager.js';
3125
// Reporters
3226
export { CsvReporter } from './reporters/csv.js';
3327
export { HumanReporter } from './reporters/human.js';
3428
export { JsonReporter } from './reporters/json.js';
3529

30+
// Services
31+
export { ModestBenchConfigurationManager } from './services/config-manager.js';
32+
export { BenchmarkFileLoader } from './services/file-loader.js';
33+
export { FileHistoryStorage } from './services/history-storage.js';
34+
export { ModestBenchProgressManager } from './services/progress-manager.js';
3635
export {
3736
BaseReporter,
3837
CompositeReporter,
3938
ModestBenchReporterRegistry,
40-
} from './reporters/registry.js';
41-
42-
// Storage
43-
export { FileHistoryStorage } from './storage/history.js';
39+
} from './services/reporter-registry.js';
4440

4541
// Export all types
4642
export * from './types/index.js';

src/reporters/csv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
} from '../types/index.js';
1919

2020
import { ReporterOutputError } from '../errors/index.js';
21-
import { BaseReporter } from './registry.js';
21+
import { BaseReporter } from '../services/reporter-registry.js';
2222

2323
/**
2424
* CSV column definitions for task results

src/reporters/human.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import type {
1515
TaskResult,
1616
} from '../types/index.js';
1717

18+
import { BaseReporter } from '../services/reporter-registry.js';
1819
import { ansiChars, colors } from '../utils/ansi.js';
19-
import { BaseReporter } from './registry.js';
2020

2121
/**
2222
* Human-readable console reporter with colorized output

src/reporters/json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
} from '../types/index.js';
1818

1919
import { ReporterOutputError } from '../errors/index.js';
20-
import { BaseReporter } from './registry.js';
20+
import { BaseReporter } from '../services/reporter-registry.js';
2121

2222
/**
2323
* JSON output structure for benchmark results

src/reporters/simple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
TaskResult,
1616
} from '../types/index.js';
1717

18-
import { BaseReporter } from './registry.js';
18+
import { BaseReporter } from '../services/reporter-registry.js';
1919

2020
/**
2121
* Basic symbols for plain text output
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import type {
1818
ValidationWarning,
1919
} from '../types/index.js';
2020

21+
import { safeParseConfig } from '../config/schema.js';
2122
import { ErrorCodes } from '../constants.js';
2223
import { ConfigLoadError, ConfigValidationError } from '../errors/index.js';
23-
import { safeParseConfig } from './schema.js';
2424

2525
/**
2626
* Get the default reporter based on TTY status and environment
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import {
2222
BENCHMARK_FILE_EXTENSIONS,
2323
BENCHMARK_FILE_PATTERN,
2424
} from '../constants.js';
25+
import { benchmarkFileSchema } from '../core/benchmark-schema.js';
2526
import {
2627
FileDiscoveryError,
2728
FileLoadError,
2829
StructureValidationError,
2930
} from '../errors/index.js';
30-
import { benchmarkFileSchema } from './benchmark-schema.js';
3131

3232
/**
3333
* File change notification for watch functionality

0 commit comments

Comments
 (0)