diff --git a/dev/scripts/setup-db.js b/dev/scripts/setup-db.js index de3bd86..3721ceb 100644 --- a/dev/scripts/setup-db.js +++ b/dev/scripts/setup-db.js @@ -390,12 +390,11 @@ async function generateChampionStats() { MONGO_HOST: 'localhost' }; - // Run the match collector directly with tsx (TypeScript executor) instead of docker compose - const matchCollectorPath = path.join(__dirname, '../../match_collector/index.ts'); - execSync(`npx tsx ${matchCollectorPath}`, { + // Run the match collector + execSync(`npm run dev`, { stdio: 'inherit', env: env, - cwd: path.join(__dirname, '../..') + cwd: path.join(__dirname, '../../match_collector') }); console.log('✅ Champion stats generated'); diff --git a/match_collector/Dockerfile b/match_collector/Dockerfile index 8ffcbab..9aeb870 100644 --- a/match_collector/Dockerfile +++ b/match_collector/Dockerfile @@ -5,4 +5,4 @@ USER node COPY --chown=node:node package*.json ./ RUN npm install COPY --chown=node:node . . -CMD /bin/sh -c "node --import=tsx index.ts; sleep 20h" \ No newline at end of file +CMD ["/bin/sh", "-c", "node --import=tsx src/index.ts; sleep 20h"] \ No newline at end of file diff --git a/match_collector/package.json b/match_collector/package.json index 21e5d7c..fd1b68c 100644 --- a/match_collector/package.json +++ b/match_collector/package.json @@ -8,7 +8,8 @@ "lint": "eslint .", "lint:fix": "eslint --fix .", "format": "prettier --write .", - "format:check": "prettier --check ." + "format:check": "prettier --check .", + "dev": "node --import=tsx src/index.ts" }, "author": "", "license": "ISC", diff --git a/match_collector/api.ts b/match_collector/src/api.ts similarity index 100% rename from match_collector/api.ts rename to match_collector/src/api.ts diff --git a/match_collector/champion_stat.ts b/match_collector/src/champion_stat.ts similarity index 100% rename from match_collector/champion_stat.ts rename to match_collector/src/champion_stat.ts diff --git a/match_collector/index.ts b/match_collector/src/index.ts similarity index 100% rename from match_collector/index.ts rename to match_collector/src/index.ts diff --git a/match_collector/item_tree.ts b/match_collector/src/item_tree.ts similarity index 99% rename from match_collector/item_tree.ts rename to match_collector/src/item_tree.ts index 6272ee5..dce22fc 100644 --- a/match_collector/item_tree.ts +++ b/match_collector/src/item_tree.ts @@ -1,11 +1,12 @@ import { - PlatformCounts, REGION_KEYS, initPlatformCounts, mergePlatformCounts, singlePlatformCount } from './platform' +import type { PlatformCounts } from './platform' + type GoldAdvantageTag = 'ahead' | 'behind' | 'even' // Item tags that can be derived from purchase patterns diff --git a/match_collector/platform.ts b/match_collector/src/platform.ts similarity index 98% rename from match_collector/platform.ts rename to match_collector/src/platform.ts index 7808043..3cacac9 100644 --- a/match_collector/platform.ts +++ b/match_collector/src/platform.ts @@ -14,7 +14,7 @@ const PLATFORMS: Record = { } // Platform counts for tracking item purchases per region -type PlatformCounts = { +interface PlatformCounts { euw: number eun: number na: number @@ -91,9 +91,9 @@ function getPlatformKey(platform: string): keyof PlatformCounts | undefined { export { PLATFORMS, - PlatformCounts, PLATFORM_KEYS, REGION_KEYS, + PlatformCounts, getPlatformBaseUrl, getRegionalBaseUrl, getRegionForPlatform, diff --git a/match_collector/tsconfig.json b/match_collector/tsconfig.json index 7812f07..97a8b2e 100644 --- a/match_collector/tsconfig.json +++ b/match_collector/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { - "types": ["node"] + "types": ["node"], + "declaration": true } }