update commit.ts

This commit is contained in:
2026-01-28 22:45:02 +08:00
parent e206ad2534
commit 1d0ab0f89f
2 changed files with 15 additions and 7 deletions

View File

@@ -44,12 +44,12 @@
}, },
"commit.ts": { "commit.ts": {
"script_name": "commit.ts", "script_name": "commit.ts",
"script_length": 10183, "script_length": 10363,
"script_sha256": "dbaacc60d79a923711fcc3e04f9f12d8c68dac6219bae71014b0e6e0175f0235", "script_sha256": "92a129f5d62dc4b03d59088a9664b5c5a344e1340683476250dea58d4481dddb",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/commit.ts", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/commit.ts",
"single_script_file": true, "single_script_file": true,
"publish_time": 1769318306585, "publish_time": 1769318306585,
"update_time": 1769335762181 "update_time": 1769611480899
}, },
"decode-uri-component.ts": { "decode-uri-component.ts": {
"script_name": "decode-uri-component.ts", "script_name": "decode-uri-component.ts",

View File

@@ -254,6 +254,14 @@ class ProcessBar {
} }
} }
function red(message: string): string {
return `\x1b[31m${message}\x1b[0m`;
}
function green(message: string): string {
return `\x1b[32m${message}\x1b[0m`;
}
async function checkRev(): Promise<boolean> { async function checkRev(): Promise<boolean> {
const localRev = await getGitLocalRev(); const localRev = await getGitLocalRev();
const remoteRev = await new ProcessBar("Checking rev").call( const remoteRev = await new ProcessBar("Checking rev").call(
@@ -262,7 +270,7 @@ async function checkRev(): Promise<boolean> {
}, },
); );
if (localRev === remoteRev) { if (localRev === remoteRev) {
console.log(`Check rev successfully, rev: ${localRev}`); console.log(green(`Check rev successfully, rev: ${localRev}`));
} else { } else {
throw `Check rev failed, local rev: ${localRev} vs remote rev: ${remoteRev}`; throw `Check rev failed, local rev: ${localRev} vs remote rev: ${remoteRev}`;
} }
@@ -321,9 +329,9 @@ async function main() {
} }
main().catch((err) => { main().catch((err) => {
console.error(`[ERROR] ${err}`); console.error(red(`[ERROR] ${err}`));
process.exit(0); process.exit(0);
}).then(() => process.exit(0)); }).then(() => process.exit(0));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T180902+08:00.MEUCIQC7L20KJsSMIVy9E8ce // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260128T224430+08:00.MEYCIQCBwZf7i4TLaloGJMI2
// TebyRlLx2O4rSf3Z4aGSeoXhyAIgB4KQRMs1IJz8wlNJeB3J1uQOso8+o8NzCRsjzDLlr4c= // 1lEGJACKU3pCRDUTXlU2AY5pVgIhANRpDg85DelQ5jyXlaIIDLQnrm9XRUFEQH/me/daYtTN