Files
HolodoriCalc/scripts/finalize-pages-build.mjs
T
dal4segno 89e9976ce9
Publish GitHub Pages output / publish (push) Successful in 38s
feat: improve card catalog and add outfit effect filters
2026-10-07 17:36:22 +09:00

32 lines
1.3 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.replace(/url\((['"]?)\/icons\//g, 'url($1../icons/');
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 배포용으로 자동 생성되었습니다.
계산과 사용자 데이터 저장은 사용자의 브라우저에서 처리됩니다.
`);