@@ -7,42 +7,42 @@ import fs from 'node:fs';
7
7
const resetColor = '\x1b[0m' ;
8
8
9
9
export const Colors = {
10
- reset : ( text ) => `${ text } ${ resetColor } ` ,
11
- bright : ( text ) => `\x1b[1m${ text } ${ resetColor } ` ,
12
- dim : ( text ) => `\x1b[2m${ text } ${ resetColor } ` ,
13
- underscore : ( text ) => `\x1b[4m${ text } ${ resetColor } ` ,
14
- blink : ( text ) => `\x1b[5m${ text } ${ resetColor } ` ,
15
- reverse : ( text ) => `\x1b[7m${ text } ${ resetColor } ` ,
16
- hidden : ( text ) => `\x1b[8m${ text } ${ resetColor } ` ,
17
-
18
- black : ( text ) => `\x1b[30m${ text } ${ resetColor } ` ,
19
- red : ( text ) => `\x1b[31m${ text } ${ resetColor } ` ,
20
- green : ( text ) => `\x1b[32m${ text } ${ resetColor } ` ,
21
- yellow : ( text ) => `\x1b[33m${ text } ${ resetColor } ` ,
22
- blue : ( text ) => `\x1b[34m${ text } ${ resetColor } ` ,
23
- magenta : ( text ) => `\x1b[35m${ text } ${ resetColor } ` ,
24
- cyan : ( text ) => `\x1b[36m${ text } ${ resetColor } ` ,
25
- white : ( text ) => `\x1b[37m${ text } ${ resetColor } ` ,
26
-
27
- bgBlack : ( text ) => `\x1b[40m${ text } ${ resetColor } ` ,
28
- bgRed : ( text ) => `\x1b[41m${ text } ${ resetColor } ` ,
29
- bgGreen : ( text ) => `\x1b[42m${ text } ${ resetColor } ` ,
30
- bgYellow : ( text ) => `\x1b[43m${ text } ${ resetColor } ` ,
31
- bgBlue : ( text ) => `\x1b[44m${ text } ${ resetColor } ` ,
32
- bgMagenta : ( text ) => `\x1b[45m${ text } ${ resetColor } ` ,
33
- bgCyan : ( text ) => `\x1b[46m${ text } ${ resetColor } ` ,
34
- bgWhite : ( text ) => `\x1b[47m${ text } ${ resetColor } ` ,
10
+ reset : ( text : string ) => `${ text } ${ resetColor } ` ,
11
+ bright : ( text : string ) => `\x1b[1m${ text } ${ resetColor } ` ,
12
+ dim : ( text : string ) => `\x1b[2m${ text } ${ resetColor } ` ,
13
+ underscore : ( text : string ) => `\x1b[4m${ text } ${ resetColor } ` ,
14
+ blink : ( text : string ) => `\x1b[5m${ text } ${ resetColor } ` ,
15
+ reverse : ( text : string ) => `\x1b[7m${ text } ${ resetColor } ` ,
16
+ hidden : ( text : string ) => `\x1b[8m${ text } ${ resetColor } ` ,
17
+
18
+ black : ( text : string ) => `\x1b[30m${ text } ${ resetColor } ` ,
19
+ red : ( text : string ) => `\x1b[31m${ text } ${ resetColor } ` ,
20
+ green : ( text : string ) => `\x1b[32m${ text } ${ resetColor } ` ,
21
+ yellow : ( text : string ) => `\x1b[33m${ text } ${ resetColor } ` ,
22
+ blue : ( text : string ) => `\x1b[34m${ text } ${ resetColor } ` ,
23
+ magenta : ( text : string ) => `\x1b[35m${ text } ${ resetColor } ` ,
24
+ cyan : ( text : string ) => `\x1b[36m${ text } ${ resetColor } ` ,
25
+ white : ( text : string ) => `\x1b[37m${ text } ${ resetColor } ` ,
26
+
27
+ bgBlack : ( text : string ) => `\x1b[40m${ text } ${ resetColor } ` ,
28
+ bgRed : ( text : string ) => `\x1b[41m${ text } ${ resetColor } ` ,
29
+ bgGreen : ( text : string ) => `\x1b[42m${ text } ${ resetColor } ` ,
30
+ bgYellow : ( text : string ) => `\x1b[43m${ text } ${ resetColor } ` ,
31
+ bgBlue : ( text : string ) => `\x1b[44m${ text } ${ resetColor } ` ,
32
+ bgMagenta : ( text : string ) => `\x1b[45m${ text } ${ resetColor } ` ,
33
+ bgCyan : ( text : string ) => `\x1b[46m${ text } ${ resetColor } ` ,
34
+ bgWhite : ( text : string ) => `\x1b[47m${ text } ${ resetColor } ` ,
35
35
} ;
36
36
37
- export function write ( message ) {
37
+ export function write ( message : any ) {
38
38
process . stdout . write ( message ) ;
39
39
process . stdout . write ( '\n' ) ;
40
40
}
41
41
42
42
/**
43
43
* @returns {never }
44
44
*/
45
- export function panic ( message ) {
45
+ export function panic ( message : any ) {
46
46
write ( Colors . red ( `Error: ${ message } ` ) ) ;
47
47
process . exit ( 1 ) ;
48
48
}
@@ -72,7 +72,7 @@ const possibleFileNames = [
72
72
'commandkit.cts' ,
73
73
] ;
74
74
75
- export async function findCommandKitConfig ( src ) {
75
+ export async function findCommandKitConfig ( src : string ) {
76
76
const cwd = process . cwd ( ) ;
77
77
const locations = src
78
78
? [ join ( cwd , src ) ]
@@ -89,7 +89,7 @@ export async function findCommandKitConfig(src) {
89
89
panic ( `Could not locate commandkit config from ${ cwd } ` ) ;
90
90
}
91
91
92
- function ensureTypeScript ( target ) {
92
+ function ensureTypeScript ( target : string ) {
93
93
const isTypeScript = / \. ( c | m ) t s x ? $ / . test ( target ) ;
94
94
95
95
if ( isTypeScript && ! process . features . typescript ) {
@@ -99,7 +99,7 @@ function ensureTypeScript(target) {
99
99
}
100
100
}
101
101
102
- async function loadConfigInner ( target ) {
102
+ async function loadConfigInner ( target : string ) {
103
103
const isJSON = target . endsWith ( '.json' ) ;
104
104
105
105
await ensureExists ( target ) ;
@@ -109,17 +109,18 @@ async function loadConfigInner(target) {
109
109
/**
110
110
* @type {import('..').CommandKitConfig }
111
111
*/
112
+ // @ts -ignore
112
113
const config = await import ( `file://${ target } ` , {
113
114
assert : isJSON ? { type : 'json' } : undefined ,
114
115
} ) . then ( ( conf ) => conf . default || conf ) ;
115
116
116
117
return config ;
117
118
}
118
119
119
- async function ensureExists ( loc ) {
120
+ async function ensureExists ( loc : string ) {
120
121
await fs . promises . access ( loc , fs . constants . F_OK ) ;
121
122
}
122
123
123
- export function erase ( dir ) {
124
+ export function erase ( dir : string ) {
124
125
rimrafSync ( dir ) ;
125
126
}
0 commit comments