1
- const path = require ( 'path' ) ;
2
- const { themes } = require ( 'prism-react-renderer' ) ;
3
- const progress = require ( "./scripts/progress_lang.json" ) ;
1
+ import path from 'node:path' ;
2
+ import { themes } from 'prism-react-renderer' ;
3
+ import progress from "./scripts/progress_lang.json" with { type : "json" } ;
4
+ import type { Config } from '@docusaurus/types' ;
5
+ import type * as Preset from '@docusaurus/preset-classic' ;
4
6
5
7
const GITHUB_URL = 'https://github.com/pnpm/pnpm' ;
6
8
const GITHUB_SPONSOR_URL = 'https://github.com/sponsors/pnpm' ;
@@ -9,7 +11,7 @@ const TRANSLATE_URL = "https://translate.pnpm.io";
9
11
const CRYPTO_DONATIONS_HREF = '/crypto-donations' ;
10
12
const LOCALE_CI = process . env . LOCALE_CI ;
11
13
const DEFAULT_LOCALE = 'en' ;
12
- const LOCALE_FULL_CODE = {
14
+ const LOCALE_FULL_CODE : Record < string , string > = {
13
15
zh : 'zh-CN' ,
14
16
pt : 'pt-BR' ,
15
17
es : 'es-ES' ,
@@ -19,7 +21,7 @@ const PROJECT_NAME = 'pnpm.io'
19
21
20
22
const lastDocsVersion = '10.x' ;
21
23
22
- function makeEditUrl ( locale , path1 , path2 ) {
24
+ function makeEditUrl ( locale : string , path1 : string , path2 : string ) : string {
23
25
// Link to Crowdin for non-English docs
24
26
if ( locale !== DEFAULT_LOCALE ) {
25
27
return `https://translate.pnpm.io/project/pnpm/${ LOCALE_FULL_CODE [ locale ] || locale } ` ;
@@ -31,7 +33,7 @@ function makeEditUrl (locale, path1, path2) {
31
33
return `https://github.com/pnpm/${ PROJECT_NAME } /edit/main/${ path1 } /${ path2 } ` ;
32
34
}
33
35
34
- module . exports = {
36
+ const docusaurusConfig = {
35
37
"title" : "pnpm" ,
36
38
"tagline" : "Fast, disk space efficient package manager" ,
37
39
"url" : "https://pnpm.io" ,
@@ -74,7 +76,7 @@ module.exports={
74
76
"theme" : {
75
77
customCss : require . resolve ( './src/css/customTheme.css' ) ,
76
78
}
77
- }
79
+ } satisfies Preset . Options
78
80
]
79
81
] ,
80
82
"plugins" : [
@@ -293,7 +295,7 @@ module.exports={
293
295
"indexName" : "pnpm" ,
294
296
"contextualSearch" : true ,
295
297
} ,
296
- } ,
298
+ } satisfies Preset . ThemeConfig ,
297
299
i18n : {
298
300
defaultLocale : DEFAULT_LOCALE ,
299
301
locales : LOCALE_CI ? [ LOCALE_CI ] : [ 'en' , 'it' , 'zh' , 'ja' , 'ko' , 'pt' , 'zh-TW' , 'ru' , 'uk' , 'fr' , 'tr' , 'es' , 'id' ] ,
@@ -322,4 +324,6 @@ module.exports={
322
324
// de: { label: `Deutsch (${progress["de"].translationProgress}%)` },
323
325
} ,
324
326
} ,
325
- }
327
+ } satisfies Config ;
328
+
329
+ export default docusaurusConfig ;
0 commit comments