mirror of
https://github.com/one-among-us/data.git
synced 2024-11-22 03:04:51 +08:00
[M] serve english page data
This commit is contained in:
parent
38c00aadd0
commit
ada88c5b2d
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,5 +6,6 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
.devcontainer
|
||||||
.DS_Store
|
.DS_Store
|
||||||
._*
|
._*
|
||||||
|
@ -12,3 +12,10 @@ zh_hant:
|
|||||||
born: 出生
|
born: 出生
|
||||||
died: 逝世
|
died: 逝世
|
||||||
age: 年齡
|
age: 年齡
|
||||||
|
en:
|
||||||
|
key:
|
||||||
|
alias: Alias
|
||||||
|
location: Location
|
||||||
|
born: Born
|
||||||
|
died: Left
|
||||||
|
age: Age
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node --loader ts-node/esm/transpile-only scripts/build.ts",
|
"build": "node --loader ts-node/esm/transpile-only scripts/build.ts",
|
||||||
"build-preview": "yarn build && scripts/preview.sh",
|
"build-preview": "yarn build && scripts/preview.sh",
|
||||||
"preview": "yarn build-preview && http-server dist"
|
"serve": "http-server --cors='*' dist",
|
||||||
|
"preview": "yarn build-preview && yarn serve"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mdx-js/mdx": "^2.1.5",
|
"@mdx-js/mdx": "^2.1.5",
|
||||||
|
@ -39,7 +39,7 @@ function buildPeopleInfoAndList() {
|
|||||||
const infoKeys = YAML.load(fs.readFileSync('info-i18n.yml').toString())
|
const infoKeys = YAML.load(fs.readFileSync('info-i18n.yml').toString())
|
||||||
|
|
||||||
// Compile into multiple languages
|
// Compile into multiple languages
|
||||||
for (const lang of ['', '.zh_hant']) {
|
for (const lang of ['', '.zh_hant', '.en']) {
|
||||||
|
|
||||||
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
// Compiled meta of list of people for the front page (contains keys id, name, profileUrl)
|
||||||
const peopleList: PeopleMeta[] = [];
|
const peopleList: PeopleMeta[] = [];
|
||||||
@ -114,8 +114,8 @@ function buildPeopleInfoAndList() {
|
|||||||
|
|
||||||
// Render `people/${dirname}/page.md` to `dist/people/${dirname}/page.js`.
|
// Render `people/${dirname}/page.md` to `dist/people/${dirname}/page.js`.
|
||||||
function buildPeoplePages() {
|
function buildPeoplePages() {
|
||||||
for (const { srcPath, distPath } of people) {
|
for (const { dirname, srcPath, distPath } of people) {
|
||||||
for (const lang of ['', '.zh_hant'])
|
for (const lang of ['', '.zh_hant', '.en'])
|
||||||
{
|
{
|
||||||
// Read markdown page and remove markdown meta
|
// Read markdown page and remove markdown meta
|
||||||
let markdown = metadataParser(fs.readFileSync(path.join(srcPath, `page${lang}.md`), "utf-8")).content;
|
let markdown = metadataParser(fs.readFileSync(path.join(srcPath, `page${lang}.md`), "utf-8")).content;
|
||||||
@ -124,6 +124,7 @@ function buildPeoplePages() {
|
|||||||
markdown = autocorrect.formatFor(markdown, 'markdown')
|
markdown = autocorrect.formatFor(markdown, 'markdown')
|
||||||
|
|
||||||
// Render mdx
|
// Render mdx
|
||||||
|
console.log('GENERATED: '+dirname+lang)
|
||||||
const result = renderMdx(markdown);
|
const result = renderMdx(markdown);
|
||||||
|
|
||||||
fs.ensureDirSync(distPath);
|
fs.ensureDirSync(distPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user