-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move queue-timeout setting to CE and remove dependency on waiting queue
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env zx | ||
|
||
console.log("Fetching stats..."); | ||
|
||
const files = await globby(["**/*.{js,jsx,ts,tsx}"], { | ||
onlyFiles: true, | ||
followSymbolicLinks: false, | ||
gitignore: true, | ||
}); | ||
|
||
const stats = { ts: { count: 0, loc: 0 }, js: { count: 0, loc: 0, big: [] } }; | ||
|
||
for (const file of files) { | ||
switch (path.extname(file)) { | ||
case '.js': | ||
case '.jsx': | ||
stats.js.count++; | ||
stats.js.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; | ||
const stat = await fs.stat(file); | ||
|
||
stats.js.big.unshift({ file, size: stat.size }); | ||
|
||
break; | ||
|
||
case '.ts': | ||
case '.tsx': | ||
stats.ts.count++; | ||
stats.ts.loc += (await fs.readFile(file, 'utf-8')).split('\n').filter(s => Boolean(s.trim())).length; | ||
break; | ||
} | ||
} | ||
|
||
console.log(" JavaScript files:", stats.js.count); | ||
console.log(" TypeScript files:", stats.ts.count); | ||
console.log(" Conversion:", (stats.ts.count / (stats.js.count + stats.ts.count) * 100).toFixed(2) + "%"); | ||
|
||
console.log(); | ||
|
||
console.log(" JavaScript LOCs:", stats.js.loc); | ||
console.log(" TypeScript LOCs:", stats.ts.loc); | ||
console.log(" Conversion:", (stats.ts.loc / (stats.js.loc + stats.ts.loc) * 100).toFixed(2) + "%"); | ||
|
||
console.log(); | ||
|
||
console.log(" JavaScript biggest files:"); | ||
|
||
stats.js.big.sort((a, b) => b.size - a.size).splice(10); | ||
for (const { file, size } of stats.js.big) { | ||
console.log(" ", file, "(" + (size / 1024).toFixed(2) + "kb)"); | ||
} |