@@ -31,7 +31,7 @@ async function replacePackageCoreVersion() {
31
31
async function replacePackageJsonVersions ( ) {
32
32
const path = dest ( 'package.json' ) ;
33
33
const root = await rootPackage ;
34
- let pkg = await import ( path ) ;
34
+ const pkg = await import ( path ) ;
35
35
Object . keys ( pkg . peerDependencies ) . forEach ( peer => {
36
36
pkg . peerDependencies [ peer ] = root . dependencies [ peer ] ;
37
37
} ) ;
@@ -53,7 +53,7 @@ async function replaceSchematicVersions() {
53
53
}
54
54
55
55
function spawnPromise ( command : string , args : string [ ] ) {
56
- return new Promise ( resolve => spawn ( command , args , { stdio : 'inherit' } ) . on ( 'close' , resolve ) ) ;
56
+ return new Promise ( resolve => spawn ( command , args , { stdio : 'inherit' } ) . on ( 'close' , resolve ) ) ;
57
57
}
58
58
59
59
async function compileSchematics ( ) {
@@ -93,19 +93,19 @@ function measureLibrary() {
93
93
async function buildDocs ( ) {
94
94
// INVESTIGATE json to stdout rather than FS?
95
95
await Promise . all ( MODULES . map ( module => spawnPromise ( 'npx' , [ 'typedoc' , `./src/${ module } ` , '--json' , `./dist/typedocs/${ module } .json` ] ) ) ) ;
96
- const entries = await Promise . all ( MODULES . map ( async ( module , index ) => {
96
+ const entries = await Promise . all ( MODULES . map ( async ( module ) => {
97
97
const buffer = await readFile ( `./dist/typedocs/${ module } .json` ) ;
98
98
const typedoc = JSON . parse ( buffer . toString ( ) ) ;
99
99
// TODO infer the entryPoint from the package.json
100
100
const entryPoint = typedoc . children . find ( ( c : any ) => c . name === '"public_api"' ) ;
101
101
const allChildren = [ ] . concat ( ...typedoc . children . map ( child =>
102
102
// TODO chop out the working directory and filename
103
- child . children ? child . children . map ( c => ( { ...c , path : dirname ( child . originalName . split ( process . cwd ( ) ) [ 1 ] ) } ) ) : [ ]
103
+ child . children ? child . children . map ( c => ( { ...c , path : dirname ( child . originalName . split ( process . cwd ( ) ) [ 1 ] ) } ) ) : [ ]
104
104
) ) ;
105
105
return entryPoint . children
106
106
. filter ( c => c . name [ 0 ] !== 'ɵ' && c . name [ 0 ] !== '_' /* private */ )
107
- . map ( child => ( { ...allChildren . find ( c => child . target === c . id ) } ) )
108
- . reduce ( ( acc , child ) => ( { ...acc , [ encodeURIComponent ( child . name ) ] : child } ) , { } ) ;
107
+ . map ( child => ( { ...allChildren . find ( c => child . target === c . id ) } ) )
108
+ . reduce ( ( acc , child ) => ( { ...acc , [ encodeURIComponent ( child . name ) ] : child } ) , { } ) ;
109
109
} ) ) ;
110
110
const root = await rootPackage ;
111
111
const pipes = [ 'MonoTypeOperatorFunction' , 'OperatorFunction' , 'AuthPipe' , 'UnaryFunction' ] ;
@@ -125,11 +125,16 @@ async function buildDocs() {
125
125
return child . kindString ;
126
126
}
127
127
} ;
128
- const table_of_contents = entries . reduce ( ( acc , entry , index ) =>
129
- ( { ...acc , [ MODULES [ index ] ] : { name : ENTRY_NAMES [ index ] , exports : Object . keys ( entry ) . reduce ( ( acc , key ) => ( { ...acc , [ key ] : tocType ( entry [ key ] ) } ) , { } ) } } ) ,
128
+ const tableOfContents = entries . reduce ( ( acc , entry , index ) =>
129
+ ( {
130
+ ...acc , [ MODULES [ index ] ] : {
131
+ name : ENTRY_NAMES [ index ] ,
132
+ exports : Object . keys ( entry ) . reduce ( ( acc , key ) => ( { ...acc , [ key ] : tocType ( entry [ key ] ) } ) , { } )
133
+ }
134
+ } ) ,
130
135
{ }
131
136
) ;
132
- const afdoc = entries . reduce ( ( acc , entry , index ) => ( { ...acc , [ MODULES [ index ] ] : entry } ) , { table_of_contents } ) ;
137
+ const afdoc = entries . reduce ( ( acc , entry , index ) => ( { ...acc , [ MODULES [ index ] ] : entry } ) , { table_of_contents : tableOfContents } ) ;
133
138
return writeFile ( `./api-${ root . version } .json` , JSON . stringify ( afdoc , null , 2 ) ) ;
134
139
}
135
140
0 commit comments