@@ -6,10 +6,10 @@ import { WalkEntry } from "https://deno.land/
[email protected] /fs/_util.ts";
6
6
function searchFilesNames ( {
7
7
skip,
8
8
} : // limiter,
9
- {
10
- skip ?: RegExp | RegExp [ ] ;
11
- // limiter: AsyncCurrentLimiter;
12
- } ) {
9
+ {
10
+ skip ?: RegExp | RegExp [ ] ;
11
+ // limiter: AsyncCurrentLimiter;
12
+ } ) {
13
13
console . log ( "type check start!" ) ;
14
14
15
15
const entry_iter = walk ( "." , {
@@ -27,19 +27,17 @@ if (import.meta.main) {
27
27
28
28
async function parallel_check (
29
29
entry_iter : AsyncIterableIterator < WalkEntry > ,
30
- limiter : AsyncCurrentLimiter ,
30
+ limiter : AsyncCurrentLimiter
31
31
) {
32
32
const stack : string [ ] = [ ] ;
33
33
34
34
const ps : Array < Promise < void > > = [ ] ;
35
35
for await ( const entry of entry_iter ) {
36
- console . log ( entry . path ) ;
37
36
if ( stack . length < 15 ) {
38
37
stack . push ( entry . path ) ;
39
38
} else {
40
39
ps . push ( limiter . run ( ( ) => runDenoCheck ( [ ...stack , entry . path ] ) ) ) ;
41
40
stack . length = 0 ;
42
- // console.log({ status, stdout, stderr });
43
41
}
44
42
}
45
43
if ( stack . length ) {
@@ -52,18 +50,20 @@ async function start() {
52
50
const limiter = new AsyncLimiterClass ( navigator . hardwareConcurrency ) ;
53
51
const args = parse ( Deno . args ) ;
54
52
console . log ( args ) ;
55
- const skip = typeof args . skip === "string"
56
- ? new RegExp ( String ( args . skip ) )
57
- : Array . isArray ( args . skip )
58
- ? args . skip . map ( ( s ) => new RegExp ( s ) )
59
- : undefined ;
53
+ const skip =
54
+ typeof args . skip === "string"
55
+ ? new RegExp ( String ( args . skip ) )
56
+ : Array . isArray ( args . skip )
57
+ ? args . skip . map ( ( s ) => new RegExp ( s ) )
58
+ : undefined ;
60
59
const entry_iter = searchFilesNames ( { skip } ) ;
61
60
await parallel_check ( entry_iter , limiter ) ;
62
61
console . log ( "type check Done!" ) ;
63
62
}
64
63
65
64
async function runDenoCheck ( stack : string [ ] ) {
66
65
const cmd = [ "deno" , "check" , "--unstable" , ...stack ] ;
66
+ console . log ( cmd ) ;
67
67
const process = Deno . run ( {
68
68
cmd : cmd ,
69
69
stderr : "piped" ,
@@ -77,7 +77,7 @@ async function runDenoCheck(stack: string[]) {
77
77
const decoder = new TextDecoder ( ) ;
78
78
const out = decoder . decode ( stdout ) ;
79
79
const err = decoder . decode ( stderr ) ;
80
- console . log ( cmd , status , out , err ) ;
80
+ console . log ( status , out , err ) ;
81
81
process . close ( ) ;
82
82
if ( ! status . success ) {
83
83
throw new Error ( "type check failed:" + out + err ) ;
0 commit comments