11#!/usr/bin/env node
2- import { globby } from 'globby'
32import childProcess from 'node:child_process'
4- import { existsSync } from 'node:fs'
3+ import { existsSync , globSync } from 'node:fs'
54import { mkdir , rm , writeFile } from 'node:fs/promises'
65import { join } from 'node:path'
76import { promisify } from 'node:util'
@@ -67,17 +66,14 @@ async function downloadProject(name) {
6766}
6867
6968async function readTypedoc ( ) {
70- let files = await globby ( 'lib/*.d.ts' , {
71- absolute : true ,
72- cwd : join ( PROJECTS , 'postcss' )
73- } )
69+ let files = globSync ( join ( PROJECTS , 'postcss/lib/*.d.ts' ) )
7470
7571 let app = new TypeDoc . Application ( )
7672 app . bootstrap ( {
77- entryPoints : files . flat ( ) ,
73+ entryPoints : files ,
7874 tsconfig : join ( PROJECTS , 'postcss' , 'tsconfig.json' )
7975 } )
80- app . options . setCompilerOptions ( files . flat ( ) , {
76+ app . options . setCompilerOptions ( files , {
8177 esModuleInterop : true
8278 } )
8379
@@ -281,7 +277,10 @@ function typeString(type) {
281277 '{ ' +
282278 decl . children
283279 . map ( i => {
284- if ( i . kind === ReflectionKind . Function || i . kind === ReflectionKind . Method ) {
280+ if (
281+ i . kind === ReflectionKind . Function ||
282+ i . kind === ReflectionKind . Method
283+ ) {
285284 return i . name + ': ' + functionString ( i )
286285 } else {
287286 return i . name + ': ' + typeString ( i . type )
@@ -303,7 +302,7 @@ function typeHtml(nodes, type) {
303302 . replace ( / < > / g, '' )
304303 . replace (
305304 'DeclarationProps | Declaration | AtRule | Rule | Comment | AtRuleProps' +
306- ' | RuleProps | CommentProps' ,
305+ ' | RuleProps | CommentProps' ,
307306 'ChildProps | ChildNode'
308307 )
309308 . replace (
@@ -458,9 +457,13 @@ function generateBody(nodes) {
458457 let children = type . children || [ ]
459458 if ( name === 'postcss' && node . kind === ReflectionKind . Namespace ) {
460459 children = node . children
461- } else if ( ! node . signatures ?. length && ! node . comment && ! node . children ?. length ) {
462- type = node . tryGetTargetReflection ( ) ;
463- children = type . children || [ ] ;
460+ } else if (
461+ ! node . signatures ?. length &&
462+ ! node . comment &&
463+ ! node . children ?. length
464+ ) {
465+ type = node . tryGetTargetReflection ( )
466+ children = type . children || [ ]
464467 if ( ! children . length ) return ''
465468 } else if ( name !== 'postcss' && node . kind === ReflectionKind . Namespace ) {
466469 return ''
0 commit comments