Skip to content

Commit

Permalink
ちゃんとキャッシュを返すように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Gakuto1112 committed Jul 9, 2024
1 parent 7dab199 commit 3978ce8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/readme_generator/src/fbac_readme_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ class FBACReadmeGenerator extends ReadmeGenerator {

protected onInjectTagFound(tagName: string, fileLanguage: FileLanguage): string {
let text: string = super.onInjectTagFound(tagName, fileLanguage);
if(tagName == "creation_status" && this.caches[`${tagName}_${fileLanguage}`] == undefined) {
if(fs.existsSync("./src/creation_status.json")) {
console.log(tagName);
if(tagName == "creation_status") {
if(this.caches[`${tagName}_${fileLanguage}`] != undefined) return this.caches[`${tagName}_${fileLanguage}`];
else if(fs.existsSync("./src/creation_status.json")) {
try {
let characterData: CreationStatusData = JSON.parse(fs.readFileSync("./src/creation_status.json", {encoding: "utf-8"}));
if(fs.existsSync(`../README_templates/creation_status/done/${fileLanguage}.md`)) text = fs.readFileSync(`../README_templates/creation_status/done/${fileLanguage}.md`, {encoding: "utf-8"});
Expand Down Expand Up @@ -112,16 +114,13 @@ class FBACReadmeGenerator extends ReadmeGenerator {
text = text.substring(0, text.length - 1);
}
else text += `${fileLanguage == "en" ? "(There is no avatar planned to be created.)" : "(作成予定のアバターはありません。)"}`;
this.caches[`${tagName}_${fileLanguage}`] = text;
}
catch {
return "<!-- ERROR: Failed to parse \"character_status.json\" -->\n";
text = "<!-- ERROR: Failed to parse \"character_status.json\" -->\n";
}
}
else {
return "<!-- ERROR: \"character_status.json\" doesn't exist -->\n";
}

this.caches[`${tagName}_${fileLanguage}`] = text;
else text = "<!-- ERROR: \"character_status.json\" doesn't exist -->\n";
}
return text;
}
Expand Down

0 comments on commit 3978ce8

Please sign in to comment.