mirror of
https://github.com/one-among-us/data.git
synced 2024-11-26 04:57:38 +08:00
[O] Use yaml instead of json5
This commit is contained in:
parent
3bed21c666
commit
bfd7065c0e
@ -19,7 +19,6 @@
|
|||||||
"esbuild": "^0.15.14",
|
"esbuild": "^0.15.14",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"json5": "^2.2.1",
|
|
||||||
"markdown-yaml-metadata-parser": "^3.0.0",
|
"markdown-yaml-metadata-parser": "^3.0.0",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'GLaDOSister',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "1997-01-13",
|
|
||||||
died: "2019-12-03"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['zhihu', 'https://www.zhihu.com/people/gmjyxx'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/GLaDOSister/info.yml
Normal file
7
people/GLaDOSister/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: GLaDOSister
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '1997-01-13'
|
||||||
|
died: '2019-12-03'
|
||||||
|
websites:
|
||||||
|
zhihu: https://www.zhihu.com/people/gmjyxx
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'MioCardMeow',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2005-04-02",
|
|
||||||
died: "2022-01-31"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/MiocardMeow'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/MioCardMeow/info.yml
Normal file
7
people/MioCardMeow/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: MioCardMeow
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '2005-04-02'
|
||||||
|
died: '2022-01-31'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/MiocardMeow
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'MizuharaNagisa',
|
|
||||||
profileUrl: '${path}/photos/profile.png',
|
|
||||||
info: {
|
|
||||||
born: "2002-04-19",
|
|
||||||
died: "2021-07-21"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/MizuharaNagisa'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/MizuharaNagisa/info.yml
Normal file
7
people/MizuharaNagisa/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: MizuharaNagisa
|
||||||
|
profileUrl: ${path}/photos/profile.png
|
||||||
|
info:
|
||||||
|
born: '2002-04-19'
|
||||||
|
died: '2021-07-21'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/MizuharaNagisa
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'SevenBird',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2005-02-26",
|
|
||||||
died: "2022-08-12"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/Selrayer'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/SevenBird/info.yml
Normal file
7
people/SevenBird/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: SevenBird
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '2005-02-26'
|
||||||
|
died: '2022-08-12'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/Selrayer
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'Uekawakuyuurei',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2000-12-04",
|
|
||||||
died: "2021-09-07"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/Uekawakuyuurei'],
|
|
||||||
['telegram', 'https://t.me/joinchat/65vSQ6ELb3YxN2I9'],
|
|
||||||
],
|
|
||||||
}
|
|
8
people/Uekawakuyuurei/info.yml
Normal file
8
people/Uekawakuyuurei/info.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
id: Uekawakuyuurei
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '2000-12-04'
|
||||||
|
died: '2021-09-07'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/Uekawakuyuurei
|
||||||
|
telegram: https://t.me/joinchat/65vSQ6ELb3YxN2I9
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'donotexist_A',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2002-05-07",
|
|
||||||
died: "2021-05-13"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/donotexist_A'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/donotexist_A/info.yml
Normal file
7
people/donotexist_A/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: donotexist_A
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '2002-05-07'
|
||||||
|
died: '2021-05-13'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/donotexist_A
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'gaoyanger',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2002-04-12",
|
|
||||||
died: "2020-08-27",
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/gaoyanger'],
|
|
||||||
['zhihu', 'https://www.zhihu.com/people/chen-ru-32-42'],
|
|
||||||
],
|
|
||||||
}
|
|
8
people/gaoyanger/info.yml
Normal file
8
people/gaoyanger/info.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
id: gaoyanger
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '2002-04-12'
|
||||||
|
died: '2020-08-27'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/gaoyanger
|
||||||
|
zhihu: https://www.zhihu.com/people/chen-ru-32-42
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'homoyamakaze',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "1999-11-03",
|
|
||||||
died: "2022-11-09"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['twitter', 'https://twitter.com/homoyamakaze'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/homoyamakaze/info.yml
Normal file
7
people/homoyamakaze/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: homoyamakaze
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: '1999-11-03'
|
||||||
|
died: '2022-11-09'
|
||||||
|
websites:
|
||||||
|
twitter: https://twitter.com/homoyamakaze
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'lintong',
|
|
||||||
profileUrl: '${path}/photos/profile.jpg',
|
|
||||||
info: {
|
|
||||||
born: "2000.06.01",
|
|
||||||
died: "2022.06.06"
|
|
||||||
},
|
|
||||||
websites: [
|
|
||||||
['QQ', 'https://304915994.qzone.qq.com/'],
|
|
||||||
],
|
|
||||||
}
|
|
7
people/lintong/info.yml
Normal file
7
people/lintong/info.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id: lintong
|
||||||
|
profileUrl: ${path}/photos/profile.jpg
|
||||||
|
info:
|
||||||
|
born: 2000.06.01
|
||||||
|
died: 2022.06.06
|
||||||
|
websites:
|
||||||
|
QQ: https://304915994.qzone.qq.com/
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
id: 'noname',
|
|
||||||
profileUrl: '${path}/photos/profile.png',
|
|
||||||
websites: [
|
|
||||||
['one-among-us', 'https://one-among.us'],
|
|
||||||
],
|
|
||||||
}
|
|
4
people/noname/info.yml
Normal file
4
people/noname/info.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
id: noname
|
||||||
|
profileUrl: ${path}/photos/profile.png
|
||||||
|
websites:
|
||||||
|
one-among-us: https://one-among.us
|
@ -2,7 +2,6 @@ import url from "url";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
|
|
||||||
import json5 from "json5";
|
|
||||||
import YAML from 'js-yaml';
|
import YAML from 'js-yaml';
|
||||||
import metadataParser from 'markdown-yaml-metadata-parser';
|
import metadataParser from 'markdown-yaml-metadata-parser';
|
||||||
|
|
||||||
@ -40,8 +39,8 @@ function buildPeopleInfoAndList() {
|
|||||||
|
|
||||||
// For each person
|
// For each person
|
||||||
for (const { dirname, srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
const infoFile = fs.readFileSync(path.join(srcPath, `info.json5`), "utf-8");
|
const infoFile = fs.readFileSync(path.join(srcPath, `info.yml`), "utf-8");
|
||||||
const info = json5.parse(infoFile);
|
const info = YAML.load(infoFile);
|
||||||
|
|
||||||
// Read the page.md of that language
|
// Read the page.md of that language
|
||||||
const markdown = fs.readFileSync(path.join(srcPath, `page${lang}.md`), "utf-8");
|
const markdown = fs.readFileSync(path.join(srcPath, `page${lang}.md`), "utf-8");
|
||||||
@ -50,6 +49,9 @@ function buildPeopleInfoAndList() {
|
|||||||
const mdMeta = metadataParser(markdown).metadata
|
const mdMeta = metadataParser(markdown).metadata
|
||||||
info.name = mdMeta.name
|
info.name = mdMeta.name
|
||||||
|
|
||||||
|
// Convert website dict into entries [[k, v], ...]
|
||||||
|
info.websites = Object.entries(info.websites ?? {})
|
||||||
|
|
||||||
// Convert info dict to [[key, value], ...]
|
// Convert info dict to [[key, value], ...]
|
||||||
// And add info k-v pairs from markdown to the info object in json5
|
// And add info k-v pairs from markdown to the info object in json5
|
||||||
info.info = [...Object.entries(mdMeta.info ?? {}), ...Object.entries(info.info ?? {})]
|
info.info = [...Object.entries(mdMeta.info ?? {}), ...Object.entries(info.info ?? {})]
|
||||||
|
@ -670,11 +670,6 @@ js-yaml@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
argparse "^2.0.1"
|
argparse "^2.0.1"
|
||||||
|
|
||||||
json5@^2.2.1:
|
|
||||||
version "2.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
|
|
||||||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
|
|
||||||
|
|
||||||
jsonfile@^6.0.1:
|
jsonfile@^6.0.1:
|
||||||
version "6.1.0"
|
version "6.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||||
|
Loading…
Reference in New Issue
Block a user