From 04b3d83a167d6f3eb4b1b429d608fda455166f93 Mon Sep 17 00:00:00 2001 From: Baah Kusi Date: Mon, 22 May 2023 01:48:22 +0000 Subject: [PATCH] remove .js files from version control --- .gitignore | 1 + index.js | 79 ------------------------------------------------------ test.js | 37 ------------------------- 3 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 index.js delete mode 100644 test.js diff --git a/.gitignore b/.gitignore index c6bba59..7b555b7 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,4 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* +*.js \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index edeb12c..0000000 --- a/index.js +++ /dev/null @@ -1,79 +0,0 @@ -import ora from "ora"; -import chalk from "chalk"; -import boxen from "boxen"; -function makeText(msg, config) { - var _a; - let txt = msg; - if (!config) { - return txt; - } - if (config.color || config.bgColor) { - let c = chalk; - if (config.color) { - c = c[config.color]; - } - if (config.bgColor) { - c = c[config.bgColor]; - } - txt = c(txt); - } - if (config.box || config.title) { - let b = { - borderStyle: (_a = config.box) !== null && _a !== void 0 ? _a : "single", - padding: 1, - margin: 1, - }; - if (config.title) { - b["title"] = config.title; - } - txt = boxen(txt, b); - } - return txt; -} -export default class Logger { - static log(msg, config) { - const txt = makeText(msg, config); - console.log(txt); - } - static startLog(msg, config) { - const txt = makeText(msg, config); - return ora(txt).start(); - } - static endLog(oraPtr, msg, config) { - const txt = makeText(msg, config); - switch (config === null || config === void 0 ? void 0 : config.status) { - case "warn": - oraPtr.warn(txt); - break; - case "success": - oraPtr.succeed(txt); - break; - case "info": - oraPtr.info(txt); - break; - case "fail": - oraPtr.fail(txt); - break; - default: - oraPtr.stopAndPersist({ text: txt }); - break; - } - oraPtr.stop(); - } - static error(msg, config) { - const conf = Object.assign(Object.assign({}, config), { color: "red" }); - Logger.log(msg, conf); - } - static warn(msg, config) { - const conf = Object.assign(Object.assign({}, config), { color: "yellow" }); - Logger.log(msg, conf); - } - static info(msg, config) { - const conf = Object.assign(Object.assign({}, config), { color: "blue" }); - Logger.log(msg, conf); - } - static debug(msg, config) { - const conf = Object.assign(Object.assign({}, config), { color: "green" }); - Logger.log(msg, conf); - } -} diff --git a/test.js b/test.js deleted file mode 100644 index d695838..0000000 --- a/test.js +++ /dev/null @@ -1,37 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { assert } from "chai"; -import Logger from "./index.js"; -import { describe } from "mocha"; -describe("#test", function () { - it("should log", function () { - return __awaiter(this, void 0, void 0, function* () { - Logger.log("Hi"); - Logger.log("Hello", { - color: "blue", - bgColor: "white", - box: "double", - }); - Logger.info("H"); - Logger.debug("E"); - Logger.warn("LL"); - Logger.error("O"); - Logger.info("Okay!", { - color: "yello", - }); - const logger = Logger.startLog("Downloading ..."); - yield new Promise((r) => setTimeout(r, 1000)); - Logger.endLog(logger, "Finished Downloading!"); - Logger.endLog(logger, "Finished Downloading!", { status: "success" }); - Logger.endLog(logger, "failed Downloading!", { status: "fail" }); - assert.ok("Well Done ..."); - }); - }); -});