-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist/ | ||
external/ | ||
.data | ||
.temp | ||
.vitepress/cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,65 @@ | ||
import { defineConfig } from '@koishijs/vitepress' | ||
import { resolve } from 'path' | ||
import { mkdir, rm, symlink } from 'fs/promises' | ||
|
||
const isDev = process.env.NODE_ENV === 'development' || process.env.VERCEL_ENV === 'preview' | ||
|
||
export default async () => defineConfig({ | ||
title: 'Koishi', | ||
description: '创建跨平台、可扩展、高性能的机器人', | ||
|
||
locales: { | ||
'en-US': require('./en-US'), | ||
'zh-CN': require('./zh-CN'), | ||
...(isDev ? { | ||
'zh-TW': require('./zh-TW'), | ||
'de-DE': require('./de-DE'), | ||
'fr-FR': require('./fr-FR'), | ||
'ja-JP': require('./ja-JP'), | ||
'ru-RU': require('./ru-RU'), | ||
} : {}), | ||
}, | ||
|
||
themeConfig: { | ||
indexName: 'docs', | ||
logo: '/logo.png', | ||
|
||
socialLinks: { | ||
github: 'https://github.com/koishijs/koishi', | ||
const external = [] // ['assets', 'cache'] | ||
const locales = ['en-US', 'zh-CN', 'zh-TW', 'de-DE', 'fr-FR', 'ja-JP', 'ru-RU'] | ||
|
||
export default async () => { | ||
for (const locale of locales) { | ||
await rm(resolve(__dirname, '../..', locale, 'external'), { recursive: true, force: true }) | ||
await mkdir(resolve(__dirname, '../..', locale, 'external'), { recursive: true }) | ||
} | ||
|
||
for (const name of external) { | ||
try { | ||
const root = require.resolve(`@root/${name}/package.json`) | ||
for (const locale of locales) { | ||
await symlink( | ||
resolve(root, '../docs', locale), | ||
resolve(resolve(__dirname, '../..', locale, 'external'), name), | ||
) | ||
} | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
return defineConfig({ | ||
title: 'Koishi', | ||
description: '创建跨平台、可扩展、高性能的机器人', | ||
|
||
locales: { | ||
'en-US': require('./en-US'), | ||
'zh-CN': require('./zh-CN'), | ||
...(isDev ? { | ||
'zh-TW': require('./zh-TW'), | ||
'de-DE': require('./de-DE'), | ||
'fr-FR': require('./fr-FR'), | ||
'ja-JP': require('./ja-JP'), | ||
'ru-RU': require('./ru-RU'), | ||
} : {}), | ||
}, | ||
}, | ||
|
||
sitemap: { | ||
hostname: 'https://koishi.chat', | ||
}, | ||
themeConfig: { | ||
indexName: 'docs', | ||
logo: '/logo.png', | ||
|
||
socialLinks: { | ||
github: 'https://github.com/koishijs/koishi', | ||
}, | ||
}, | ||
|
||
sitemap: { | ||
hostname: 'https://koishi.chat', | ||
}, | ||
|
||
vite: { | ||
optimizeDeps: { | ||
include: ['xss'], | ||
vite: { | ||
optimizeDeps: { | ||
include: ['xss'], | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters