diff --git a/packages/utils/package-lock.json b/packages/utils/package-lock.json index 53b8aef..bd91973 100644 --- a/packages/utils/package-lock.json +++ b/packages/utils/package-lock.json @@ -12,7 +12,8 @@ "@antfu/install-pkg": "^0.1.0", "@antfu/utils": "^0.3.0", "@iconify/types": "^1.0.12", - "debug": "^4.3.3" + "debug": "^4.3.3", + "kolorist": "^1.5.0" }, "devDependencies": { "@iconify/library-builder": "^1.0.4", @@ -3944,6 +3945,11 @@ "node": ">=6" } }, + "node_modules/kolorist": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.5.0.tgz", + "integrity": "sha512-pPobydIHK884YBtkS/tWSZXpSAEpcMbilyun3KL37ot935qL2HNKm/tI45i/Rd+MxdIWEhm7/LmUQzWZYK+Qhg==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -8385,6 +8391,11 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, + "kolorist": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.5.0.tgz", + "integrity": "sha512-pPobydIHK884YBtkS/tWSZXpSAEpcMbilyun3KL37ot935qL2HNKm/tI45i/Rd+MxdIWEhm7/LmUQzWZYK+Qhg==" + }, "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", diff --git a/packages/utils/package.json b/packages/utils/package.json index 89b8293..91bed94 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -153,8 +153,9 @@ "@antfu/install-pkg": "^0.1.0", "@antfu/utils": "^0.3.0", "@iconify/types": "^1.0.12", - "debug": "^4.3.3" - }, + "debug": "^4.3.3", + "kolorist": "^1.5.0" + }, "devDependencies": { "@iconify/library-builder": "^1.0.4", "@types/debug": "^4.1.7", diff --git a/packages/utils/src/loader/utils.ts b/packages/utils/src/loader/utils.ts index 75928da..15d8c4f 100644 --- a/packages/utils/src/loader/utils.ts +++ b/packages/utils/src/loader/utils.ts @@ -1,5 +1,6 @@ import { installPackage } from '@antfu/install-pkg'; import { sleep } from '@antfu/utils'; +import { cyan, yellow } from 'kolorist' export function camelize(str: string): string { return str.replace(/-([a-z0-9])/g, g => g[1].toUpperCase()); @@ -23,7 +24,7 @@ const warnned = new Set(); export function warnOnce(msg: string): void { if (!warnned.has(msg)) { warnned.add(msg); - console.warn(`[@iconify-loader] ${msg}`); + console.warn(yellow(`[@iconify-loader] ${msg}`)) } } @@ -38,7 +39,7 @@ export async function tryInstallPkg(name: string): Promise { if (!tasks[name]) { // eslint-disable-next-line no-console - console.log(`Installing ${name}...`); + console.log(cyan(`Installing ${name}...`)) tasks[name] = pending = installPackage(name, { dev: true, preferOffline: true }) .then(() => sleep(300)) // eslint-disable-next-line