44import { themes as prismThemes } from 'prism-react-renderer' ;
55import type { Config } from '@docusaurus/types' ;
66import 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'
811
912// The node.js modules cannot be used in modules imported in browser code:
1013// webpack < 5 used to include polyfills for node.js core modules by default.
@@ -19,17 +22,17 @@ import fs from 'node:fs';
1922
2023function getCustomFields ( ) {
2124 const pwd = fileURLToPath ( import . meta. url ) ;
22- // logger.info (pwd);
25+ // console.log (pwd);
2326
2427 // First get the version from the top package.json.
2528 const topFilePath = path . join ( path . dirname ( path . dirname ( pwd ) ) , 'package.json' ) ;
26- // logger.info (filePath);
29+ // console.log (filePath);
2730 const topFileContent = fs . readFileSync ( topFilePath ) ;
2831
2932 const topPackageJson = JSON . parse ( topFileContent . toString ( ) ) ;
3033 const jsonVersion = topPackageJson . version . replace ( / [ . - ] p r e / , '' ) ;
3134
32- logger . info ( `package version: ${ topPackageJson . version } ` ) ;
35+ console . log ( `package version: ${ topPackageJson . version } ` ) ;
3336
3437 // Remove the first part, up to the last dot.
3538 const npmSubversion = jsonVersion . replace ( / ^ .* [ . ] / , '' ) ;
@@ -46,7 +49,7 @@ function getCustomFields() {
4649 let rootPackageJson
4750 try {
4851 const rootFilePath = path . join ( path . dirname ( path . dirname ( pwd ) ) , 'build-assets' , 'package.json' ) ;
49- // logger.info (filePath);
52+ // console.log (filePath);
5053 const rootFileContent = fs . readFileSync ( rootFilePath ) ;
5154 rootPackageJson = JSON . parse ( rootFileContent . toString ( ) ) ;
5255 } catch ( error ) {
@@ -81,7 +84,7 @@ function getCustomFields() {
8184// ----------------------------------------------------------------------------
8285
8386const customFields = getCustomFields ( ) ;
84- logger . info ( customFields ) ;
87+ console . log ( ' customFields: ' + util . inspect ( customFields ) ) ;
8588
8689// ----------------------------------------------------------------------------
8790
@@ -182,65 +185,7 @@ const config: Config = {
182185 [
183186 // https://docusaurus.io/docs/next/api/plugins/@docusaurus /plugin-client-redirects#redirects
184187 '@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- to : '/docs/developer' ,
201- from : '/docs/developer-info'
202- } ,
203- {
204- to : '/docs/maintainer' ,
205- from : '/docs/maintainer-info'
206- } ,
207- {
208- to : '/docs/user' ,
209- from : '/docs/user-info'
210- }
211- ] ,
212- createRedirects ( existingPath ) {
213- logger . info ( existingPath ) ;
214- // if (existingPath.includes('/evenimente')) {
215- // // logger.info(`to ${existingPath} from ${existingPath.replace('/evenimente', '/events')}`);
216- // // Redirect from /events/X to /evenimente/X
217- // return [
218- // existingPath.replace('/evenimente', '/events')
219- // ];
220- // } else if (existingPath.includes('/amintiri')) {
221- // // logger.info(`to ${existingPath} from ${existingPath.replace('/amintiri', '/blog')}`);
222- // // Redirect from /blog/Z to /amintiri/X
223- // return [
224- // existingPath.replace('/amintiri', '/blog')
225- // ];
226- // }
227- // return undefined; // Return a falsy value: no redirect created
228- // },
229- if ( existingPath . includes ( '/user-info' ) ) {
230- return [
231- existingPath . replace ( '/user-info' , '/user' )
232- ] ;
233- } else if ( existingPath . includes ( '/developer-info' ) ) {
234- return [
235- existingPath . replace ( '/developer-info' , '/developer' )
236- ] ;
237- } else if ( existingPath . includes ( '/maintainer-info' ) ) {
238- return [
239- existingPath . replace ( '/maintainer-info' , '/maintainer' )
240- ] ;
241- }
242- }
243- }
188+ redirects
244189 ] ,
245190 './src/plugins/SelectReleasesPlugin' ,
246191 ] ,
0 commit comments