diff --git a/package.json b/package.json index d49d9f3b..545ffab0 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,16 @@ "bin": { "discloud": "bin/discloud" }, + "engines": { + "node": ">=20.12" + }, "scripts": { "watch": "npm-run-all -p watch:*", "watch:esbuild": "node esbuild.mjs --watch", "watch:tsc": "tsc --noEmit --watch", - "prepublish": "node esbuild.mjs --production", - "test": "npm run test:ts && tsc --outDir out && npm run test:node", + "prepublish": "npm run build", + "build": "node esbuild.mjs --production", + "test": "npm run test:ts && npm run build && npm run test:node", "test:node": "node --test \"**/test/**/*.test.?(c|m)js\"", "test:ts": "tsc --noEmit" }, @@ -28,7 +32,6 @@ "@discloudapp/util": "^0.10.5", "@inquirer/prompts": "^7.5.3", "adm-zip": "^0.5.16", - "chalk": "^5.4.1", "easy-table": "^1.2.0", "ejs": "^3.1.10", "glob": "^11.0.2", diff --git a/src/structures/print/console.ts b/src/structures/print/console.ts index bee7bdee..3068e199 100644 --- a/src/structures/print/console.ts +++ b/src/structures/print/console.ts @@ -1,7 +1,7 @@ import { type RESTApiBaseResult } from "@discloudapp/api-types/v2"; -import chalk from "chalk"; import Table from "easy-table"; import ora, { type Ora } from "ora"; +import { styleText } from "util"; import type Core from "../../core"; import { type IPrint } from "../../interfaces/print"; @@ -32,7 +32,7 @@ export default class ConsolePrint implements IPrint { bold(first: any, ...args: any) { this.#stopSpin(); - if (typeof first === "string") return console.log(chalk.bold(first), ...args); + if (typeof first === "string") return console.log(styleText("bold", first), ...args); console.log(first, ...args); } @@ -54,15 +54,15 @@ export default class ConsolePrint implements IPrint { error(first: any, ...args: any) { this.#stopSpin(); - if (typeof first === "string") return console.error(`%s ${first}`, chalk.red("[error]"), ...args); - console.error(chalk.red("[error]"), first, ...args); + if (typeof first === "string") return console.error(`%s ${first}`, styleText("red", "[error]"), ...args); + console.error(styleText("red", "[error]"), first, ...args); } info(first: any, ...args: any) { this.#stopSpin(); - if (typeof first === "string") return console.info(`%s ${first}`, chalk.blue("[info]"), ...args); - console.info(chalk.blue("[info]"), first, ...args); + if (typeof first === "string") return console.info(`%s ${first}`, styleText("blue", "[info]"), ...args); + console.info(styleText("blue", "[info]"), first, ...args); } log(...args: any) { @@ -85,8 +85,8 @@ export default class ConsolePrint implements IPrint { success(first: any, ...args: any): void { this.#stopSpin(); - if (typeof first === "string") return console.log(`%s ${first}`, chalk.green("[success]"), ...args); - console.log(chalk.green("[success]"), first, ...args); + if (typeof first === "string") return console.log(`%s ${first}`, styleText("green", "[success]"), ...args); + console.log(styleText("green", "[success]"), first, ...args); } table(objOrArray: T, excludeKeys?: any[]) { @@ -100,8 +100,8 @@ export default class ConsolePrint implements IPrint { warn(first: any, ...args: any): void { this.#stopSpin(); - if (typeof first === "string") return console.warn(`%s ${first}`, chalk.yellow("[warn]"), ...args); - console.warn(chalk.yellow("[warn]"), first, ...args); + if (typeof first === "string") return console.warn(`%s ${first}`, styleText("yellow", "[warn]"), ...args); + console.warn(styleText("yellow", "[warn]"), first, ...args); } write(text: string) { diff --git a/yarn.lock b/yarn.lock index 0fd640de..c76b5db7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -847,7 +847,7 @@ chalk@^4.0.0, chalk@^4.0.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.2.0, chalk@^5.3.0, chalk@^5.4.1: +chalk@^5.2.0, chalk@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.4.1.tgz#1b48bf0963ec158dce2aacf69c093ae2dd2092d8" integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==