@@ -80,11 +80,11 @@ export function symlinkFile(from: string, to: string, type?: string) {
80
80
}
81
81
82
82
export function createDir ( path : string ) {
83
- _recursiveMkDir ( path ) ;
83
+ return _recursiveMkDir ( path ) ;
84
84
}
85
85
86
86
87
- function _recursiveMkDir ( path : string ) {
87
+ function _recursiveMkDir ( path : string ) : Promise < void > {
88
88
if ( fs . existsSync ( path ) ) {
89
89
return Promise . resolve ( ) ;
90
90
} else {
@@ -97,11 +97,11 @@ export function copyFile(from: string, to: string) {
97
97
return _recursiveMkDir ( dirname ( to ) )
98
98
. then ( ( ) => new Promise ( ( resolve , reject ) => {
99
99
const rd = fs . createReadStream ( from ) ;
100
- rd . on ( 'error' , ( err ) => reject ( err ) ) ;
100
+ rd . on ( 'error' , ( err : Error ) => reject ( err ) ) ;
101
101
102
102
const wr = fs . createWriteStream ( to ) ;
103
- wr . on ( 'error' , ( err ) => reject ( err ) ) ;
104
- wr . on ( 'close' , ( ex ) => resolve ( ) ) ;
103
+ wr . on ( 'error' , ( err : Error ) => reject ( err ) ) ;
104
+ wr . on ( 'close' , ( ) => resolve ( ) ) ;
105
105
106
106
rd . pipe ( wr ) ;
107
107
} ) ) ;
@@ -113,8 +113,7 @@ export function writeMultipleFiles(fs: { [path: string]: string }) {
113
113
}
114
114
115
115
116
- export function replaceInFile ( filePath : string , match : string , replacement : string ) ;
117
- export function replaceInFile ( filePath : string , match : RegExp , replacement : string ) {
116
+ export function replaceInFile ( filePath : string , match : RegExp | string , replacement : string ) {
118
117
return readFile ( filePath )
119
118
. then ( ( content : string ) => writeFile ( filePath , content . replace ( match , replacement ) ) ) ;
120
119
}
0 commit comments