- 新增 Kafka 消费者实现,支持消息处理和错误处理。 - 实现 OffsetTracker 类,用于跟踪消息偏移量。 - 新增消息解析和数据库插入逻辑,支持从 Kafka 消息构建数据库行。 - 实现 UDP 数据包解析功能,支持不同类型的 UDP 消息。 - 新增 Redis 错误队列处理,支持错误重试机制。 - 实现 Redis 客户端和集成类,支持日志记录和心跳机制。 - 添加 Zod 验证模式,确保 Kafka 消息有效性。 - 新增日志记录和指标收集工具,支持系统监控。 - 添加 UUID 生成工具,支持唯一标识符生成。 - 编写处理器逻辑的单元测试,确保功能正确性。 - 配置 Vite 构建工具,支持 Node.js 环境下的构建。
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import { spawnSync } from 'child_process';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const projectRoot = path.resolve(__dirname, '..');
|
|
const targets = ['src', 'tests'];
|
|
|
|
const collectFiles = (dir) => {
|
|
if (!fs.existsSync(dir)) {
|
|
return [];
|
|
}
|
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
return entries.flatMap((entry) => {
|
|
const fullPath = path.join(dir, entry.name);
|
|
if (entry.isDirectory()) {
|
|
return collectFiles(fullPath);
|
|
}
|
|
if (entry.isFile() && fullPath.endsWith('.js')) {
|
|
return [fullPath];
|
|
}
|
|
return [];
|
|
});
|
|
};
|
|
|
|
const files = targets.flatMap((target) => collectFiles(path.join(projectRoot, target)));
|
|
|
|
const failures = [];
|
|
|
|
files.forEach((file) => {
|
|
const result = spawnSync(process.execPath, ['--check', file], { stdio: 'inherit' });
|
|
if (result.status !== 0) {
|
|
failures.push(file);
|
|
}
|
|
});
|
|
|
|
if (failures.length > 0) {
|
|
process.exit(1);
|
|
}
|