diff options
Diffstat (limited to '.scripts/make-dev-timer.ts')
-rw-r--r-- | .scripts/make-dev-timer.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/.scripts/make-dev-timer.ts b/.scripts/make-dev-timer.ts new file mode 100644 index 000000000..4b5f8d535 --- /dev/null +++ b/.scripts/make-dev-timer.ts @@ -0,0 +1,21 @@ +// I would have made this a bash script but there isn't an easy way to track +// time in bash sub-second cross platform. +import fs from "fs"; +const start = Date.now() + 5; +const result = Bun.spawnSync(process.argv.slice(2), { + stdio: ["inherit", "inherit", "inherit"], +}); +const end = Date.now(); +const diff = (Math.max(Math.round(end - start), 0) / 1000).toFixed(3); +const success = result.exitCode === 0; +try { + const line = `${new Date().toISOString()}, ${success ? "success" : "fail"}, ${diff}\n`; + if (fs.existsSync(".scripts/make-dev-stats.csv")) { + fs.appendFileSync(".scripts/make-dev-stats.csv", line); + } else { + fs.writeFileSync(".scripts/make-dev-stats.csv", line); + } +} catch { + // Ignore +} +process.exit(result.exitCode); |