#!/usr/bin/env -S npx ts-node /** * Generate binary fixtures for benchmark tasks. * Usage: npx ts-node scripts/build-bench-fixtures.ts * * Generates bench/fixtures/sales.xlsx with deterministic data so that * "Q1 売上トップ3" is well-defined: ProductC > ProductA > ProductE. */ import ExcelJS from 'exceljs'; import { join } from 'path'; async function main(): Promise { const wb = new ExcelJS.Workbook(); wb.creator = 'bench-fixture-builder'; wb.created = new Date('2026-04-01T00:00:00Z'); const sheet = wb.addWorksheet('Sheet1'); sheet.columns = [ { header: '商品名', key: 'name', width: 12 }, { header: 'カテゴリ', key: 'category', width: 10 }, { header: 'Q1売上(千円)', key: 'sales', width: 14 }, ]; const rows = [ { name: 'ProductA', category: '食品', sales: 12000 }, { name: 'ProductB', category: '雑貨', sales: 8500 }, { name: 'ProductC', category: '食品', sales: 15000 }, { name: 'ProductD', category: '雑貨', sales: 9000 }, { name: 'ProductE', category: '食品', sales: 11000 }, { name: 'ProductF', category: '雑貨', sales: 7000 }, ]; for (const row of rows) sheet.addRow(row); const out = join(process.cwd(), 'bench', 'fixtures', 'sales.xlsx'); await wb.xlsx.writeFile(out); // eslint-disable-next-line no-console console.log(`Wrote ${out}`); } main().catch((err) => { // eslint-disable-next-line no-console console.error(err); process.exit(1); });