Migrate deploy-lftp script to tsx
Also change assets directory to `assets` and add default `.htaccess` file
This commit is contained in:
parent
405ad38f5d
commit
d01594f456
19 changed files with 172 additions and 97 deletions
|
|
@ -7,7 +7,7 @@ The Noto Sans and Noto Serif typefaces are copyrighted to the Noto Project Autho
|
|||
|
||||
The generic SVG icons were created by Font Awesome and are distributed under the CC-BY-4.0 license.
|
||||
|
||||
All third-party trademarks belong to their respective owners, and I'm not affiliated with any of them.
|
||||
All third-party trademarks and attributed characters belong to their respective owners, and I'm not affiliated with any of them.
|
||||
`.trim();
|
||||
|
||||
export const GET: APIRoute = () => {
|
||||
|
|
|
|||
|
|
@ -11,49 +11,29 @@ const [stories, games, tagCategories] = await Promise.all([
|
|||
const tagsSet = new Set<string>();
|
||||
const draftOnlyTagsSet = new Set<string>();
|
||||
const seriesCollection = await getCollection("series");
|
||||
stories
|
||||
.filter((story) => !story.data.isDraft)
|
||||
.forEach((story) => {
|
||||
story.data.tags.forEach((tag) => {
|
||||
tagsSet.add(tag);
|
||||
});
|
||||
// Add tags from non-drafts to set; then, add tags only from drafts to separate set
|
||||
[stories, games]
|
||||
.flat()
|
||||
.sort((a, b) => (a.data.isDraft ? 1 : b.data.isDraft ? -1 : 0))
|
||||
.forEach((value) => {
|
||||
if (value.data.isDraft) {
|
||||
value.data.tags.forEach((tag) => {
|
||||
if (!tagsSet.has(tag)) {
|
||||
draftOnlyTagsSet.add(tag);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
value.data.tags.forEach((tag) => {
|
||||
tagsSet.add(tag);
|
||||
});
|
||||
}
|
||||
});
|
||||
games
|
||||
.filter((game) => !game.data.isDraft)
|
||||
.forEach((game) => {
|
||||
game.data.tags.forEach((tag) => {
|
||||
tagsSet.add(tag);
|
||||
});
|
||||
});
|
||||
stories
|
||||
.filter((story) => story.data.isDraft)
|
||||
.forEach((story) => {
|
||||
story.data.tags.forEach((tag) => {
|
||||
if (!tagsSet.has(tag)) {
|
||||
draftOnlyTagsSet.add(tag);
|
||||
}
|
||||
});
|
||||
});
|
||||
games
|
||||
.filter((game) => game.data.isDraft)
|
||||
.forEach((game) => {
|
||||
game.data.tags.forEach((tag) => {
|
||||
if (!tagsSet.has(tag)) {
|
||||
draftOnlyTagsSet.add(tag);
|
||||
}
|
||||
});
|
||||
});
|
||||
const uncategorizedTagsSet = new Set(tagsSet);
|
||||
|
||||
const uncategorizedTagsSet = new Set(tagsSet);
|
||||
const categorizedTags: Array<[string, string, string[]]> = tagCategories
|
||||
.sort((a, b) => a.data.index - b.data.index)
|
||||
.map((category) => {
|
||||
const tagList = category.data.tags.map((tag) => {
|
||||
if (typeof tag === "string") {
|
||||
return tag;
|
||||
}
|
||||
return tag["eng"]!;
|
||||
});
|
||||
const tagList = category.data.tags.map((tag) => (typeof tag === "string" ? tag : tag["eng"]!));
|
||||
tagList.forEach((tag, index) => {
|
||||
if (index !== tagList.findLastIndex((val) => tag == val)) {
|
||||
throw new Error(`Duplicated tag "${tag}" found in multiple tag-categories`);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@ type Params = {
|
|||
};
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
const [stories, games, series] = await Promise.all([getCollection("stories"), getCollection("games"), getCollection("series")]);
|
||||
const [stories, games, series] = await Promise.all([
|
||||
getCollection("stories"),
|
||||
getCollection("games"),
|
||||
getCollection("series"),
|
||||
]);
|
||||
const seriesTags = new Set(series.map((s) => s.data.name));
|
||||
const tags = new Set<string>();
|
||||
stories.forEach((story) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue