Skip to content

Commit 61706e0

Browse files
committed
ref: logging in cli tools
1 parent 4f52ccd commit 61706e0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

tools/fix-dts.mts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { readdir, readFile, writeFile, lstat } from "node:fs/promises";
22
import { join, resolve } from "node:path";
3+
import k from "kleur";
4+
5+
const dtsPath = resolve("./dist/lib/");
36

47
/** Adds two spaces to the end of each line in JSDoc comments to preserve the meticulous line breaks */
58
async function addTrailingSpaces(filePath: string) {
@@ -30,4 +33,11 @@ async function processRecursive(directory: string) {
3033
}
3134
}
3235

33-
processRecursive("./dist/lib");
36+
try {
37+
await processRecursive(dtsPath);
38+
39+
console.log(k.green(`Fixed all .d.ts files in ${k.reset(`'${dtsPath}'`)}`));
40+
}
41+
catch(err) {
42+
console.error(k.red(`Encountered error while fixing .d.ts files in ${k.reset(`'${dtsPath}'`)}:\n`), err);
43+
}

tools/post-build-global.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { access, constants as fsconstants, readFile, writeFile } from "node:fs/promises";
22
import { resolve } from "node:path";
3+
import k from "kleur";
34
import pkg from "../package.json" with { type: "json" };
45

56
const { exit } = process;
@@ -43,7 +44,7 @@ async function run() {
4344
.replace(/^\s*'use strict';\s*(\r?\n){1,2}/gm, "");
4445

4546
await writeFile(iifeBundlePath, finalBundle, "utf8");
46-
console.log(`\x1b[32mGlobal bundle at path \x1b[0m'${iifeBundlePath}'\x1b[32m has been updated\x1b[0m`);
47+
console.log(k.green(`Successfully updated global bundle at path ${k.reset(`'${iifeBundlePath}'`)}\n`));
4748

4849
setImmediate(() => exit(0));
4950
}

0 commit comments

Comments
 (0)