Skip to content

Commit

Permalink
ref: logging in cli tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Sv443 committed Jan 11, 2025
1 parent 4f52ccd commit 61706e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion tools/fix-dts.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { readdir, readFile, writeFile, lstat } from "node:fs/promises";
import { join, resolve } from "node:path";
import k from "kleur";

const dtsPath = resolve("./dist/lib/");

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

processRecursive("./dist/lib");
try {
await processRecursive(dtsPath);

console.log(k.green(`Fixed all .d.ts files in ${k.reset(`'${dtsPath}'`)}`));
}
catch(err) {
console.error(k.red(`Encountered error while fixing .d.ts files in ${k.reset(`'${dtsPath}'`)}:\n`), err);
}
3 changes: 2 additions & 1 deletion tools/post-build-global.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { access, constants as fsconstants, readFile, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import k from "kleur";
import pkg from "../package.json" with { type: "json" };

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

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

setImmediate(() => exit(0));
}
Expand Down

0 comments on commit 61706e0

Please sign in to comment.