Files
HolodoriCalc/scripts/finalize-pages-build.mjs
T
dal4segno 049e37bcff
Publish GitHub Pages output / publish (push) Successful in 47s
feat: show playable charts with score hover and special-start markers
2026-09-29 23:12:18 +09:00

52 lines
2.0 KiB
JavaScript

import { readFile, rm, writeFile } from 'node:fs/promises';
import path from 'node:path';
const output = path.resolve('pages-dist');
const htmlPath = path.join(output, 'index.html');
const scriptPath = path.join(output, 'assets', 'app.js');
const stylePath = path.join(output, 'assets', 'app.css');
let html = await readFile(htmlPath, 'utf8');
html = html.replace(/<script type="module" crossorigin src=/g, '<script defer src=');
html = html.replace(/<link rel="stylesheet" crossorigin href=/g, '<link rel="stylesheet" href=');
await writeFile(htmlPath, html);
let script = await readFile(scriptPath, 'utf8');
script = script.replaceAll('/icons/', './icons/');
await writeFile(scriptPath, script);
let style = await readFile(stylePath, 'utf8');
style = style.replaceAll('/icons/', '../icons/');
style += `
.description-stat-icon { display: none !important; }
.stat-badge .stat-icon,
.filter-options label .stat-icon {
width: auto !important;
height: auto !important;
background: none !important;
mask: none !important;
-webkit-mask: none !important;
font-size: 12px;
font-weight: 800;
line-height: 1;
}
.stat-badge .stat-icon-performance::after,
.filter-options label .stat-icon-performance::after { content: '퍼포먼스'; }
.stat-badge .stat-icon-technique::after,
.filter-options label .stat-icon-technique::after { content: '테크닉'; }
.stat-badge .stat-icon-sense::after,
.filter-options label .stat-icon-sense::after { content: '센스'; }
`;
await writeFile(stylePath, style);
// 점수 채보는 app.js에 포함된다. 별도로 불러오는 시각화 채보는 보존한다.
await rm(path.join(output, 'data', 'charts'), { recursive: true, force: true });
await rm(path.join(output, 'VERSION.txt'), { force: true });
await writeFile(path.join(output, 'README.txt'), `홀로도리 계산기
서비스: https://doricalc-holo.live/
이 파일들은 GitHub Pages 배포용으로 자동 생성되었습니다.
계산과 사용자 데이터 저장은 사용자의 브라우저에서 처리됩니다.
`);