refactor(sheet): 서버 Node 진입점을 common_util 로 옮김 — M02 화면이 sheet 폴더를 훑어 불러와 node:fs 가 브라우저로 새지 않게 (PLAN 10-2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tjoit7rxvpLMM7cafeVTo1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/* =============================================================================
|
||||
* ui_template_sheet_node.ts
|
||||
* 표 문서 풀이를 **서버가** 돌리는 진입점 — [저장] 때 정본으로 다시 풂.
|
||||
*
|
||||
* 풀이는 화면이 쓰는 `ui_template_sheet_recalc.ts` 그대로 — 여기에는 계산이 없음.
|
||||
* 파이썬 껍데기 = `common_util/common_util_sheet_recalc.py` · 번들 = `npm run build:formula`.
|
||||
*
|
||||
* 실행: node <번들> <입력.json> <출력.json>
|
||||
* 입력 { docs: SheetDoc[] }
|
||||
* 출력 { results: SheetResult[] } — 입력 차례 그대로
|
||||
* 끝 코드: 0 성공 / 2 인자 오류
|
||||
* ========================================================================== */
|
||||
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { recalcSheet } from "./ui_template_sheet_recalc";
|
||||
import type { SheetDoc } from "./ui_template_sheet_types";
|
||||
|
||||
const [inputPath, outputPath] = process.argv.slice(2);
|
||||
if (!inputPath || !outputPath) {
|
||||
console.error("사용법: node <번들> <입력.json> <출력.json>");
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const input = JSON.parse(readFileSync(inputPath, "utf8")) as { docs?: SheetDoc[] };
|
||||
const results = (input.docs ?? []).map((doc) => recalcSheet(doc));
|
||||
writeFileSync(outputPath, JSON.stringify({ results }));
|
||||
Reference in New Issue
Block a user