File tree 2 files changed +22
-1
lines changed 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,24 @@ function fixAllLinks(htmlFiles) {
281
281
return Promise . all ( writePromises ) ;
282
282
}
283
283
284
+ const PROJECT_FILE_PATH = {
285
+ 'js' : '/docs/reference/js/v8/_project.yaml' ,
286
+ 'node' : '/docs/reference/node/_project.yaml'
287
+ } ;
288
+ async function setProjectYamlPath ( api ) {
289
+ const defaultTemplatePath = path . resolve (
290
+ `${ __dirname } /theme/layouts/default.hbs`
291
+ ) ;
292
+ const defaultTemplateText = await fs . readFile ( defaultTemplatePath , 'utf8' ) ;
293
+ const projectFilePath = PROJECT_FILE_PATH [ api ] ;
294
+ console . log ( 'replacing' , projectFilePath ) ;
295
+ const replacedText = defaultTemplateText . replace (
296
+ / ( < m e t a n a m e = " p r o j e c t _ p a t h " v a l u e = " ) [ a - z A - Z 0 - 9 \/ _ \. ] + ( " \/ > ) / ,
297
+ `$1${ projectFilePath } $2`
298
+ ) ;
299
+ await fs . writeFile ( defaultTemplatePath , replacedText ) ;
300
+ }
301
+
284
302
/**
285
303
* Generate an temporary abridged version of index.d.ts used to create
286
304
* Node docs.
@@ -357,6 +375,9 @@ Promise.all([
357
375
return generateNodeSource ( ) ;
358
376
}
359
377
} )
378
+ . then ( ( ) => {
379
+ setProjectYamlPath ( apiType ) ;
380
+ } )
360
381
// Run main Typedoc process (uses index.d.ts and generated temp file above).
361
382
. then ( runTypedoc )
362
383
. then ( async output => {
Original file line number Diff line number Diff line change 4
4
<meta charset =" utf-8" >
5
5
<meta http-equiv =" X-UA-Compatible" content =" IE=edge" >
6
6
<meta name =" hide_page_heading" value =" true" />
7
- <meta name =" project_path" value =" /docs/reference/js /_project.yaml" />
7
+ <meta name =" project_path" value =" /docs/reference/node /_project.yaml" />
8
8
<meta name =" book_path" value =" /docs/reference/_book.yaml" />
9
9
<meta name =" translation" value =" disabled" />
10
10
<meta name =" page_type" value =" reference" />
You can’t perform that action at this time.
0 commit comments