update commit.ts

This commit is contained in:
2026-01-25 18:09:16 +08:00
parent c0e6d3e7f1
commit 4ed855ea26
2 changed files with 14 additions and 20 deletions

View File

@@ -1,10 +1,10 @@
// Reference: // Reference:
// - https://docs.deno.com/runtime/fundamentals/testing/ // - https://docs.deno.com/runtime/fundamentals/testing/
import {assert} from "jsr:@std/assert/assert"; import { assert } from "jsr:@std/assert/assert";
import {assertEquals} from "jsr:@std/assert"; import { assertEquals } from "jsr:@std/assert";
import {decodeBase64, encodeBase64} from "jsr:@std/encoding/base64"; import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
import {dirname} from "https://deno.land/std@0.208.0/path/mod.ts"; import { dirname } from "https://deno.land/std@0.208.0/path/mod.ts";
// reference: https://docs.deno.com/examples/hex_base64_encoding/ // reference: https://docs.deno.com/examples/hex_base64_encoding/
// import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64"; // import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
@@ -522,12 +522,9 @@ export class ProcessBar {
this.interval = setInterval(() => { this.interval = setInterval(() => {
const dots = ".".repeat(((count++) % 10) + 1); const dots = ".".repeat(((count++) % 10) + 1);
const costMs = new Date().getTime() - startMs; const costMs = new Date().getTime() - startMs;
let time = `${costMs}ms`; const time = `${Math.floor(costMs / 1000)}s`;
if (costMs > 1000) {
time = `${Math.floor(costMs / 1000)}s`;
}
process.stderr.write(`\r${this.message} ${time} ${dots}\x1b[K`); process.stderr.write(`\r${this.message} ${time} ${dots}\x1b[K`);
}, 200); }, 500);
} }
stop(clearLine?: boolean): void { stop(clearLine?: boolean): void {
if (this.interval) { if (this.interval) {

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env runts -- --runtime-bun #!/usr/bin/env runts -- --runtime-bun
import { spawn } from "node:child_process"; import {spawn} from "node:child_process";
import { existsSync } from "node:fs"; import {existsSync} from "node:fs";
import { createInterface } from "node:readline/promises"; import {createInterface} from "node:readline/promises";
import { stdin, stdout } from "node:process"; import {stdin, stdout} from "node:process";
class ProcessOutput { class ProcessOutput {
code: number; code: number;
@@ -242,12 +242,9 @@ class ProcessBar {
this.interval = setInterval(() => { this.interval = setInterval(() => {
const dots = ".".repeat(((count++) % 10) + 1); const dots = ".".repeat(((count++) % 10) + 1);
const costMs = new Date().getTime() - startMs; const costMs = new Date().getTime() - startMs;
let time = `${costMs}ms`; const time = `${Math.floor(costMs / 1000)}s`;
if (costMs > 1000) {
time = parseInt(costMs / 1000) + "s";
}
process.stderr.write(`\r${this.message} ${time} ${dots}\x1b[K`); process.stderr.write(`\r${this.message} ${time} ${dots}\x1b[K`);
}, 200); }, 500);
} }
stop(clearLine?: boolean): void { stop(clearLine?: boolean): void {
if (this.interval) { if (this.interval) {
@@ -328,5 +325,5 @@ main().catch((err) => {
process.exit(0); process.exit(0);
}).then(() => process.exit(0)); }).then(() => process.exit(0));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T170500+08:00.MEYCIQCQaZ4intwkah4yIvBY // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T180902+08:00.MEUCIQC7L20KJsSMIVy9E8ce
// ZDtlPggRVyMKGYjB0pKf0mKLSwIhANSfiFQpRZQ4ANeLAbBUJ4YQUgDISqLpX2v7LnOnK1ki // TebyRlLx2O4rSf3Z4aGSeoXhyAIgB4KQRMs1IJz8wlNJeB3J1uQOso8+o8NzCRsjzDLlr4c=