@@ -12,22 +12,30 @@ export async function outputFiles(filename: string, code: string, sourceMap?: Ba
12
12
outputLog ( filename ) ;
13
13
}
14
14
15
- export async function copyFiles ( src : string , dest : string ) {
16
- await FS . copy ( src , dest ) ;
15
+ export function copyFiles ( src : string , dest : string ) {
16
+ FS . copySync ( src , dest ) ;
17
17
outputLog ( dest ) ;
18
18
}
19
19
20
20
export function outputLog ( filename : string ) {
21
+ const pkg = getPkg ( ) ;
21
22
const extname = path . extname ( filename ) . replace ( '.' , '' ) ;
23
+ const name = `\x1b[35m ${ pkg . name } \x1b[0m` ;
22
24
if ( / \. m a p $ / . test ( filename ) ) {
23
- console . log ( `♻️ \x1b[36;1m MAP\x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
25
+ console . log ( `♻️ ${ name } \x1b[36;1m MAP\x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
24
26
} else if ( / d .t s $ / . test ( filename ) ) {
25
- console . log ( `♻️ \x1b[34;1m DTS\x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
27
+ console . log ( `♻️ ${ name } \x1b[34;1m DTS\x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
26
28
} else if ( extname == 'css' ) {
27
- console . log ( `♻️ \x1b[35;1m CSS \x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
29
+ console . log ( `♻️ ${ name } \x1b[35;1m CSS \x1b[0m┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
28
30
} else if ( extname == 'js' ) {
29
- console . log ( `♻️ \x1b[33;1m JS \x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
31
+ console . log ( `♻️ ${ name } \x1b[33;1m JS \x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
30
32
} else {
31
- console . log ( `♻️ \x1b[37;1m ${ ( extname || '***' ) . toLocaleUpperCase ( ) } \x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
33
+ console . log ( `♻️ ${ name } \x1b[37;1m ${ ( extname || '***' ) . toLocaleUpperCase ( ) } \x1b[0m ┈┈▶ \x1b[32;1m${ filename } \x1b[0m` ) ;
32
34
}
33
35
}
36
+
37
+ function getPkg ( ) {
38
+ const dir = ts . sys . getCurrentDirectory ( ) ;
39
+ const pkgPath = path . resolve ( dir , 'package.json' ) ;
40
+ return FS . readJSONSync ( pkgPath ) || { } ;
41
+ }
0 commit comments