4
4
import { themes as prismThemes } from 'prism-react-renderer' ;
5
5
import type { Config } from '@docusaurus/types' ;
6
6
import type * as Preset from '@docusaurus/preset-classic' ;
7
- import logger from '@docusaurus/logger' ;
7
+ // import logger from '@docusaurus/logger';
8
+ import util from 'node:util' ;
9
+
10
+ import { redirects } from './docusaurus-config-redirects'
8
11
9
12
// The node.js modules cannot be used in modules imported in browser code:
10
13
// webpack < 5 used to include polyfills for node.js core modules by default.
@@ -19,17 +22,17 @@ import fs from 'node:fs';
19
22
20
23
function getCustomFields ( ) {
21
24
const pwd = fileURLToPath ( import . meta. url ) ;
22
- // logger.info (pwd);
25
+ // console.log (pwd);
23
26
24
27
// First get the version from the top package.json.
25
28
const topFilePath = path . join ( path . dirname ( path . dirname ( pwd ) ) , 'package.json' ) ;
26
- // logger.info (filePath);
29
+ // console.log (filePath);
27
30
const topFileContent = fs . readFileSync ( topFilePath ) ;
28
31
29
32
const topPackageJson = JSON . parse ( topFileContent . toString ( ) ) ;
30
33
const jsonVersion = topPackageJson . version . replace ( / [ . - ] p r e / , '' ) ;
31
34
32
- logger . info ( `package version: ${ topPackageJson . version } ` ) ;
35
+ console . log ( `package version: ${ topPackageJson . version } ` ) ;
33
36
34
37
// Remove the first part, up to the last dot.
35
38
const npmSubversion = jsonVersion . replace ( / ^ .* [ . ] / , '' ) ;
@@ -46,7 +49,7 @@ function getCustomFields() {
46
49
let rootPackageJson
47
50
try {
48
51
const rootFilePath = path . join ( path . dirname ( path . dirname ( pwd ) ) , 'build-assets' , 'package.json' ) ;
49
- // logger.info (filePath);
52
+ // console.log (filePath);
50
53
const rootFileContent = fs . readFileSync ( rootFilePath ) ;
51
54
rootPackageJson = JSON . parse ( rootFileContent . toString ( ) ) ;
52
55
} catch ( error ) {
@@ -81,7 +84,7 @@ function getCustomFields() {
81
84
// ----------------------------------------------------------------------------
82
85
83
86
const customFields = getCustomFields ( ) ;
84
- logger . info ( customFields ) ;
87
+ console . log ( ' customFields: ' + util . inspect ( customFields ) ) ;
85
88
86
89
// ----------------------------------------------------------------------------
87
90
@@ -182,40 +185,7 @@ const config: Config = {
182
185
[
183
186
// https://docusaurus.io/docs/next/api/plugins/@docusaurus /plugin-client-redirects#redirects
184
187
'@docusaurus/plugin-client-redirects' ,
185
- {
186
- // fromExtensions: ['html', 'htm'], // /myPage.html -> /myPage
187
- // toExtensions: ['exe', 'zip'], // /myAsset -> /myAsset.zip (if latter exists)
188
- redirects : [
189
- // // /docs/oldDoc -> /docs/newDoc
190
- // {
191
- // to: '/docs/newDoc',
192
- // from: '/docs/oldDoc',
193
- // },
194
- // // Redirect from multiple old paths to the new path
195
- // {
196
- // to: '/docs/newDoc2',
197
- // from: ['/docs/oldDocFrom2019', '/docs/legacyDocFrom2016'],
198
- // },
199
- ] ,
200
- createRedirects ( existingPath ) {
201
- logger . info ( existingPath ) ;
202
- // if (existingPath.includes('/evenimente')) {
203
- // // logger.info(`to ${existingPath} from ${existingPath.replace('/evenimente', '/events')}`);
204
- // // Redirect from /events/X to /evenimente/X
205
- // return [
206
- // existingPath.replace('/evenimente', '/events')
207
- // ];
208
- // } else if (existingPath.includes('/amintiri')) {
209
- // // logger.info(`to ${existingPath} from ${existingPath.replace('/amintiri', '/blog')}`);
210
- // // Redirect from /blog/Z to /amintiri/X
211
- // return [
212
- // existingPath.replace('/amintiri', '/blog')
213
- // ];
214
- // }
215
- // return undefined; // Return a falsy value: no redirect created
216
- // },
217
- }
218
- }
188
+ redirects
219
189
] ,
220
190
'./src/plugins/SelectReleasesPlugin' ,
221
191
] ,
0 commit comments