Skip to content

Commit 12b2a58

Browse files
committed
update: use node API in distributed config files
1 parent f33687c commit 12b2a58

File tree

7 files changed

+56
-35
lines changed

7 files changed

+56
-35
lines changed

docs/en/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'en-US',
69
description: 'Vite & Vue powered static site generator.',
710

@@ -22,7 +25,7 @@ export default {
2225
copyright: 'Copyright © 2019-present Evan You'
2326
}
2427
}
25-
} as UserConfig<DefaultTheme.Config>
28+
})
2629

2730
function nav(): DefaultTheme.NavItem[] {
2831
return [
@@ -37,7 +40,7 @@ function nav(): DefaultTheme.NavItem[] {
3740
activeMatch: '/reference/'
3841
},
3942
{
40-
text: vitepress.version,
43+
text: pkg.version,
4144
items: [
4245
{
4346
text: 'Changelog',

docs/es/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'es-CO',
69
description: 'Generador de Sitios Estaticos desarrollado con Vite y Vue.',
710

@@ -48,7 +51,7 @@ export default {
4851
darkModeSwitchTitle: 'Cambiar a modo oscuro',
4952
skipToContentLabel: 'Saltar al contenido'
5053
}
51-
} as UserConfig<DefaultTheme.Config>
54+
})
5255

5356
function nav(): DefaultTheme.NavItem[] {
5457
return [
@@ -63,7 +66,7 @@ function nav(): DefaultTheme.NavItem[] {
6366
activeMatch: '/es/reference/'
6467
},
6568
{
66-
text: vitepress.version,
69+
text: pkg.version,
6770
items: [
6871
{
6972
text: 'Registro de cambios',

docs/fa/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
title: 'ویت‌پرس',
69
lang: 'fa-IR',
710
description: 'Vite & Vue powered static site generator.',
@@ -66,7 +69,7 @@ export default {
6669
},
6770
siteTitle: 'ویت‌پرس'
6871
}
69-
} as UserConfig<DefaultTheme.Config>
72+
})
7073

7174
function nav(): DefaultTheme.NavItem[] {
7275
return [
@@ -81,7 +84,7 @@ function nav(): DefaultTheme.NavItem[] {
8184
activeMatch: '/reference/'
8285
},
8386
{
84-
text: vitepress.version,
87+
text: pkg.version,
8588
items: [
8689
{
8790
text: 'Changelog',

docs/ko/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'ko-KR',
69
description: 'Vite 및 Vue 기반 정적 사이트 생성기.',
710

@@ -44,7 +47,7 @@ export default {
4447
darkModeSwitchTitle: '다크 모드로 변경',
4548
skipToContentLabel: '본문으로 건너뛰기'
4649
}
47-
} as UserConfig<DefaultTheme.Config>
50+
})
4851

4952
function nav(): DefaultTheme.NavItem[] {
5053
return [
@@ -59,7 +62,7 @@ function nav(): DefaultTheme.NavItem[] {
5962
activeMatch: '/ko/reference/'
6063
},
6164
{
62-
text: vitepress.version,
65+
text: pkg.version,
6366
items: [
6467
{
6568
text: '변경 로그',

docs/pt/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'pt-BR',
69
description: 'Gerador de Site Estático desenvolvido com Vite e Vue.',
710

@@ -48,7 +51,7 @@ export default {
4851
darkModeSwitchTitle: 'Mudar para Modo Escuro',
4952
skipToContentLabel: 'Pular para o Conteúdo'
5053
}
51-
} as UserConfig<DefaultTheme.Config>
54+
})
5255

5356
function nav(): DefaultTheme.NavItem[] {
5457
return [
@@ -63,7 +66,7 @@ function nav(): DefaultTheme.NavItem[] {
6366
activeMatch: '/pt/reference/'
6467
},
6568
{
66-
text: vitepress.version,
69+
text: pkg.version,
6770
items: [
6871
{
6972
text: 'Registro de Mudanças',

docs/ru/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'ru-RU',
69
description: 'Генератор статических сайтов на основе Vite и Vue.',
710

@@ -42,7 +45,7 @@ export default {
4245
langMenuLabel: 'Изменить язык',
4346
skipToContentLabel: 'Перейти к содержимому'
4447
}
45-
}
48+
})
4649

4750
function nav(): DefaultTheme.NavItem[] {
4851
return [
@@ -57,7 +60,7 @@ function nav(): DefaultTheme.NavItem[] {
5760
activeMatch: '/ru/reference/'
5861
},
5962
{
60-
text: vitepress.version,
63+
text: pkg.version,
6164
items: [
6265
{
6366
text: 'Изменения',

docs/zh/config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { type DefaultTheme, type UserConfig } from 'vitepress'
2-
import vitepress from 'vitepress/package.json'
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
33

4-
export default {
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export default defineConfig({
58
lang: 'zh-Hans',
69
description: '由 Vite 和 Vue 驱动的静态站点生成器',
710

@@ -55,7 +58,7 @@ export default {
5558
darkModeSwitchTitle: '切换到深色模式',
5659
skipToContentLabel: '跳转到内容'
5760
}
58-
} as UserConfig<DefaultTheme.Config>
61+
})
5962

6063
function nav(): DefaultTheme.NavItem[] {
6164
return [
@@ -70,7 +73,7 @@ function nav(): DefaultTheme.NavItem[] {
7073
activeMatch: '/zh/reference/'
7174
},
7275
{
73-
text: vitepress.version,
76+
text: pkg.version,
7477
items: [
7578
{
7679
text: '更新日志',

0 commit comments

Comments
 (0)