@@ -6,29 +6,15 @@ const glob = require("glob");
66const tempDir = path . join ( cwd , "_types" ) ;
77const files = glob . sync ( `${ tempDir } /**/*.d.ts` ) ;
88
9- const nodeModulesDir = path . join ( cwd , "node_modules" ) ;
10- const moduleFiles = glob . sync ( `${ nodeModulesDir } /**/*.d.ts` ) ;
11-
12- for ( let i = 0 ; i < files . length ; i ++ ) {
13- const filename = files [ i ] . replace ( / .* [ \/ \\ ] / , "" ) . trim ( ) ;
14- for ( let k = 0 ; k < moduleFiles . length ; k ++ ) {
15- const moduleFilename = moduleFiles [ k ] . replace ( / .* [ \/ \\ ] / , "" ) . trim ( ) ;
16- if ( filename === moduleFilename ) {
17- fs . copyFileSync ( moduleFiles [ k ] , files [ i ] ) ;
18- break ;
19- }
20- }
21- }
22-
239const outDir = path . join ( cwd , "dist" , "framework" , "types" ) ;
24- if ( fs . existsSync ( outDir ) ) {
25- fs . rmdirSync ( outDir , { recursive : true } ) ;
10+ if ( fs . existsSync ( outDir ) ) {
11+ fs . rmdirSync ( outDir , { recursive : true } ) ;
2612}
27- fs . mkdirSync ( outDir ) ;
13+ fs . mkdirSync ( outDir , { recursive : true } ) ;
2814
29- for ( let i = 0 ; i < files . length ; i ++ ) {
15+ for ( let i = 0 ; i < files . length ; i ++ ) {
3016 const filename = files [ i ] . replace ( / .* [ \/ \\ ] / , "" ) ;
3117 fs . renameSync ( files [ i ] , path . join ( outDir , filename ) ) ;
3218}
3319
34- fs . rmdirSync ( tempDir , { recursive : true } ) ;
20+ fs . rmdirSync ( tempDir , { recursive : true } ) ;
0 commit comments