mirror of
https://github.com/HananoshikaYomaru/openfreebooks.git
synced 2026-11-13 13:05:51 +00:00
Update build scripts and enhance development workflow: Revise package.json to streamline build commands, replacing deprecated scripts with new chapter-specific build commands. Update CONTRIBUTING.md to clarify local development instructions and improve chapter sync processes. Enhance README.md with updated serving and build commands for better user guidance. Add new types for Bun in devDependencies and update the feed and sitemap to reflect recent content changes.
This commit is contained in:
parent
61963350e7
commit
5ac8e330ca
19 changed files with 501 additions and 125 deletions
|
|
@ -97,14 +97,24 @@ async function readJsonFile<T>(path: string): Promise<T | null> {
|
|||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
export async function validateCurriculum(): Promise<{
|
||||
curriculumFileCount: number;
|
||||
errors: ValidationError[];
|
||||
}> {
|
||||
const errors: ValidationError[] = [];
|
||||
|
||||
const catalogPath = join(DATA_DIR, "catalog.json");
|
||||
const catalog = await readJsonFile<CatalogFile>(catalogPath);
|
||||
if (!catalog || !Array.isArray(catalog.curriculums)) {
|
||||
console.error("Cannot validate curriculums: data/catalog.json must contain a curriculums array.");
|
||||
process.exit(1);
|
||||
return {
|
||||
curriculumFileCount: 0,
|
||||
errors: [
|
||||
{
|
||||
file: "catalog.json",
|
||||
message: "Cannot validate curriculums: data/catalog.json must contain a curriculums array.",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const globalCurriculums = new Set(
|
||||
|
|
@ -263,15 +273,21 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
console.error(`\n✖ Curriculum validation failed with ${errors.length} error(s):`);
|
||||
for (const error of errors) {
|
||||
return { curriculumFileCount: curriculumFiles.length, errors };
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const result = await validateCurriculum();
|
||||
if (result.errors.length > 0) {
|
||||
console.error(`\n✖ Curriculum validation failed with ${result.errors.length} error(s):`);
|
||||
for (const error of result.errors) {
|
||||
console.error(`- [${error.file}] ${error.message}`);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`✓ Curriculum validation passed for ${curriculumFiles.length} curriculum file(s).`);
|
||||
console.log(`✓ Curriculum validation passed for ${result.curriculumFileCount} curriculum file(s).`);
|
||||
}
|
||||
|
||||
main();
|
||||
if (import.meta.main) {
|
||||
void main();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue