-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tools): add/update stats scripts
- Loading branch information
1 parent
70df6eb
commit eff1959
Showing
4 changed files
with
59 additions
and
2 deletions.
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
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,43 @@ | ||
import { lower, percent, split } from "@thi.ng/strings"; | ||
import { | ||
assocObj, | ||
comp, | ||
filter, | ||
keep, | ||
map, | ||
normFrequenciesAuto, | ||
transduce, | ||
} from "@thi.ng/transducers"; | ||
import { execFileSync } from "node:child_process"; | ||
|
||
const args = | ||
"log --all --pretty=format:%ad~~%s --date=iso-strict --since=2018-01-01"; | ||
|
||
console.log(args); | ||
|
||
const commits = execFileSync("git", args.split(" ")).toString("utf8"); | ||
|
||
const xfPreproc = comp( | ||
map(lower), | ||
map((x) => x.split("~~")) | ||
); | ||
|
||
const types = transduce( | ||
comp( | ||
xfPreproc, | ||
map(([_, msg]) => /^(\w+)\(/.exec(msg)), | ||
keep(), | ||
map((x) => x[1]), | ||
filter((x) => ["feat", "refactor", "docs", "fix", "perf"].includes(x)) | ||
), | ||
normFrequenciesAuto(), | ||
split(commits) | ||
); | ||
|
||
console.log( | ||
assocObj( | ||
[...types.keys()] | ||
.sort() | ||
.map((x) => <[string, string]>[x, percent(1)(types.get(x)!)]) | ||
) | ||
); |
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,14 @@ | ||
import { files, writeText } from "@thi.ng/file-io"; | ||
import { FMT_yyyyMMdd_HHmmss } from "@thi.ng/date"; | ||
import { table } from "@thi.ng/markdown-table"; | ||
import { statSync } from "node:fs"; | ||
|
||
const stats = [...files("examples", /assets\/index-.+\.js$/)].map((x) => [ | ||
/examples\/([a-z0-9-]+)/.exec(x)![1], | ||
statSync(x).size, | ||
]); | ||
|
||
writeText( | ||
`dev/example-sizes-${FMT_yyyyMMdd_HHmmss()}.md`, | ||
table(["name", "size"], stats) | ||
); |