|
1 | 1 | #!/usr/bin/env node |
2 | | -import { readFile, writeFile } from 'node:fs/promises' |
3 | | -import path from 'node:path' |
4 | 2 |
|
5 | | -const rootDir = process.cwd() |
6 | | -const googleJsonParserFile = path.join(rootDir, 'src/lib/googleJsonParser.ts') |
7 | | -const workerFile = path.join(rootDir, 'public/workers/trackParser.worker.js') |
| 3 | +// Documentation script: the worker at public/workers/trackParser.worker.js |
| 4 | +// contains Google JSON parsing functions duplicated from src/lib/googleJsonParser.ts. |
| 5 | +// To regenerate, manually copy the functions from the TypeScript source |
| 6 | +// to the worker file (workers cannot import from the Next.js build pipeline). |
8 | 7 |
|
9 | | -console.log('Building trackParser.worker.js...') |
10 | | - |
11 | | -// Read the shared TypeScript code |
12 | | -const tsCode = await readFile(googleJsonParserFile, 'utf-8') |
13 | | - |
14 | | -// Read the current worker file |
15 | | -let workerCode = await readFile(workerFile, 'utf-8') |
16 | | - |
17 | | -// The worker file already has the correct code - we just need to ensure it stays in sync |
18 | | -// For now, we'll just verify that the shared functions exist in both files |
19 | | - |
20 | | -console.log('âś“ Worker file already contains shared Google JSON parsing functions') |
21 | | -console.log('Note: To regenerate worker from TypeScript source, manually copy the functions') |
22 | | -console.log(' from src/lib/googleJsonParser.ts to public/workers/trackParser.worker.js') |
| 8 | +console.log('âś“ Worker file shares Google JSON parsing logic with src/lib/googleJsonParser.ts') |
| 9 | +console.log(' To update: copy functions from src/lib/googleJsonParser.ts to public/workers/trackParser.worker.js') |
0 commit comments