mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-12-26 20:26:00 +08:00
27 lines
730 B
TypeScript
27 lines
730 B
TypeScript
import { ConfigEntry } from "../types"
|
|
import { statSync, writeFileSync } from "fs";
|
|
import { resolve } from "path"
|
|
import { data } from "../data";
|
|
import { trimEnd } from "../utils";
|
|
|
|
export default function doc(path: string): void {
|
|
if (!statSync(resolve(path, 'mkdocs.yml'))) {
|
|
console.error('Check your path');
|
|
return;
|
|
}
|
|
if (!statSync(resolve(path, 'docs/user/settings.md'))) {
|
|
console.error('Check your path');
|
|
return;
|
|
}
|
|
|
|
const targetPath = resolve(path, 'data/brec_settings.json')
|
|
|
|
const text = buildJson(data)
|
|
|
|
writeFileSync(targetPath, text, { encoding: 'utf8' });
|
|
}
|
|
|
|
function buildJson(data: ConfigEntry[]): string {
|
|
return JSON.stringify(data, null, 2);
|
|
}
|