@@ -7,7 +7,12 @@ import type {
7
7
PropVersionMetadata ,
8
8
} from "@docusaurus/plugin-content-docs" ;
9
9
import { CURRENT_VERSION_NAME } from "@docusaurus/plugin-content-docs/server" ;
10
- import type { LoadContext , Plugin , PluginContentLoadedActions , RouteConfig } from "@docusaurus/types" ;
10
+ import type {
11
+ LoadContext ,
12
+ Plugin ,
13
+ PluginContentLoadedActions ,
14
+ RouteConfig ,
15
+ } from "@docusaurus/types" ;
11
16
import { DEFAULT_PLUGIN_ID , normalizeUrl } from "@docusaurus/utils" ;
12
17
import { generateJson } from "./plugin/data" ;
13
18
import { extractSidebar } from "./plugin/sidebar" ;
@@ -80,14 +85,11 @@ export default function clsLoaderPlugin(
80
85
const classes = await getClassesFromFolder (
81
86
path . join ( options . projectRoot , metadata . versionLabel ) ,
82
87
metadata . versionPath + "/" ,
83
- context . generatedFilesDir ,
88
+ context . generatedFilesDir
84
89
) ;
85
90
86
91
// Generate sidebars (this runs before the main sidebar is loaded)
87
- const sidebars = extractSidebar (
88
- classes ,
89
- options . sortSidebar
90
- ) ;
92
+ const sidebars = extractSidebar ( classes , options . sortSidebar ) ;
91
93
92
94
// await fs.promises.writeFile(
93
95
// path.join(
@@ -104,6 +106,10 @@ export default function clsLoaderPlugin(
104
106
// ),
105
107
// `import type { SidebarConfig } from '@docusaurus/plugin-content-docs';\nexport = Array<SidebarConfig>;`
106
108
// );
109
+ generateClassDocs (
110
+ path . join ( context . generatedFilesDir , "cls-loader-docs" , metadata . versionLabel ) ,
111
+ classes
112
+ ) ;
107
113
108
114
return {
109
115
...metadata ,
@@ -137,7 +143,8 @@ export default function clsLoaderPlugin(
137
143
const rootRoutes = await Promise . all (
138
144
content . loadedVersions . map ( async ( loadedVersion ) => {
139
145
const version = loadedVersion . versionName ;
140
- generateClassDocs ( actions , path . join ( context . siteDir , "docs" , version ) , loadedVersion . classes ) ;
146
+ // generateClassDocs(actions, path.join(context.siteDir, "versioned_docs", `version-${loadedVersion.versionLabel}`), loadedVersion.classes);
147
+ // generateClassDocs(actions, path.join(context.generatedFilesDir, "cls-loader", version), loadedVersion.classes);
141
148
142
149
// Define version metadata for all pages. We need to use the same structure as
143
150
// "docs" so that we can utilize the same React components.
@@ -203,21 +210,17 @@ export default function clsLoaderPlugin(
203
210
204
211
const indexPermalink = normalizeUrl ( [ loadedVersion . versionPath ] ) ;
205
212
206
- if ( loadedVersion . classes . length > 1 ) {
207
- // Only write out the ApiIndex only when we have multiple packages
208
- // otherwise we will have 2 top-level entries in the route entries
209
- routes . push ( {
210
- path : indexPermalink ,
211
- exact : true ,
212
- component : path . join ( __dirname , "./components/RefIndex.js" ) ,
213
- modules : {
214
- options : optionsData ,
215
- classes : classesData ,
216
- versionMetadata,
217
- } ,
218
- sidebar : "ref" ,
219
- } ) ;
220
- }
213
+ routes . push ( {
214
+ path : indexPermalink ,
215
+ exact : true ,
216
+ component : path . join ( __dirname , "./components/RefIndex.js" ) ,
217
+ modules : {
218
+ options : optionsData ,
219
+ classes : classesData ,
220
+ versionMetadata,
221
+ } ,
222
+ sidebar : "ref" ,
223
+ } ) ;
221
224
222
225
// console.log("indexPermalink", indexPermalink);
223
226
// Wrap in the `DocVersionRoot` component:
@@ -254,4 +257,4 @@ export default function clsLoaderPlugin(
254
257
} ) ;
255
258
} ,
256
259
} ;
257
- }
260
+ }
0 commit comments