From 1058f10e70256d5ea51f9ac50d3c2c65bd7c390b Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:31:47 +0100 Subject: [PATCH 1/8] chore: add single export entry --- src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/index.ts diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..957009f --- /dev/null +++ b/src/index.ts @@ -0,0 +1,8 @@ +import { Logs } from "./logs"; +import { PrettyLogs } from "./pretty-logs"; +import { LogReturn, Metadata, LogLevel, LogLevelWithOk, Colors, } from "./types/log-types"; +import { cleanLogString, cleanSpyLogs } from "./utils"; +import { LOG_LEVEL, COLORS } from "./constants"; + +export type { LogReturn, Metadata, LogLevel, LogLevelWithOk, Colors }; +export { Logs, PrettyLogs, cleanLogString, cleanSpyLogs, LOG_LEVEL, COLORS }; From aca537b8457ef6a9a7e9064dc97b1929bf3f6e7d Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:32:20 +0100 Subject: [PATCH 2/8] chore: update LogLevelWithOk type --- src/pretty-logs.ts | 10 +++++----- src/types/log-types.ts | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pretty-logs.ts b/src/pretty-logs.ts index 2f0bcd5..fd89618 100644 --- a/src/pretty-logs.ts +++ b/src/pretty-logs.ts @@ -1,5 +1,5 @@ import { LOG_LEVEL, COLORS } from "./constants"; -import { Metadata, PrettyLogsWithOk, Colors } from "./types/log-types"; +import { Metadata, LogLevelWithOk, Colors } from "./types/log-types"; export class PrettyLogs { constructor() { @@ -34,7 +34,7 @@ export class PrettyLogs { this._logWithStack(LOG_LEVEL.VERBOSE, message, metadata); } - private _logWithStack(type: PrettyLogsWithOk, message: string, metaData?: Metadata | string | unknown) { + private _logWithStack(type: LogLevelWithOk, message: string, metaData?: Metadata | string | unknown) { this._log(type, message); if (typeof metaData === "string") { this._log(type, metaData); @@ -95,8 +95,8 @@ export class PrettyLogs { return !Reflect.ownKeys(obj).some((key) => typeof obj[String(key)] !== "function"); } - private _log(type: PrettyLogsWithOk, message: string | Record) { - const defaultSymbols: Record = { + private _log(type: LogLevelWithOk, message: string | Record) { + const defaultSymbols: Record = { fatal: "×", ok: "✓", error: "⚠", @@ -121,7 +121,7 @@ export class PrettyLogs { const fullLogString = logString; - const colorMap: Record = { + const colorMap: Record = { fatal: ["error", COLORS.fgRed], ok: ["log", COLORS.fgGreen], error: ["warn", COLORS.fgYellow], diff --git a/src/types/log-types.ts b/src/types/log-types.ts index 50ca812..6f25618 100644 --- a/src/types/log-types.ts +++ b/src/types/log-types.ts @@ -1,17 +1,17 @@ import { COLORS, LOG_LEVEL } from "../constants"; -type LogMessage = { raw: string; diff: string; level: LogLevel; type: PrettyLogsWithOk }; +type LogMessage = { raw: string; diff: string; level: LogLevel; type: LogLevelWithOk }; type LogFunction = (message: string, metadata?: Metadata) => void; export type Colors = (typeof COLORS)[keyof typeof COLORS]; export type LogLevel = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL]; -export type PrettyLogsWithOk = "ok" | LogLevel; +export type LogLevelWithOk = "ok" | LogLevel; export type LogParams = { consoleLog: LogFunction; logMessage: string; level: LogLevel; - type: PrettyLogsWithOk; + type: LogLevelWithOk; metadata?: Metadata; }; From d2e1ecdd8193d084d87c922491f50d1ddb28086e Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:32:53 +0100 Subject: [PATCH 3/8] chore: create tsup.config.ts --- tsup.config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tsup.config.ts diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000..c62b92d --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from "tsup" + +export default defineConfig({ + entry: ["src/index.ts"], + splitting: false, + sourcemap: true, + clean: true, + dts: true, + target: "esnext", + outDir: "dist", + format: [ + "cjs", + "esm" + ] +}) \ No newline at end of file From b3f107ec45eeb144d6c09d2ee4217284d98515a9 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:38:37 +0100 Subject: [PATCH 4/8] chore: update package.json, no sourcemap --- package.json | 42 ++++++++---------------------------------- tsup.config.ts | 2 +- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 5db25a3..258aed4 100644 --- a/package.json +++ b/package.json @@ -4,44 +4,18 @@ "description": "Ubiquity logging module with Supabase support.", "author": "Ubiquity DAO", "license": "MIT", + "main": "dist/index.js", + "types": "dist/index.d.ts", "type": "module", - "tsup": { - "entry": [ - "src/logs.ts", - "src/pretty-logs.ts" - ], - "splitting": false, - "sourcemap": true, - "clean": true, - "dts": true, - "format": ["cjs", "esm"] - }, - "files": [ - "dist/*" - ], - "main": "./dist/logs.js", - "typesVersions": { - "*": { - ".": [ - "./dist/logs.d.ts" - ], - "pretty-logs": [ - "./dist/pretty-logs.d.ts" - ] - } - }, "exports": { ".": { - "types": "./dist/logs.d.ts", - "require": "./dist/logs.cjs", - "import": "./dist/logs.js" - }, - "./pretty-logs": { - "types": "./dist/pretty-logs.d.ts", - "require": "./dist/pretty-logs.cjs", - "import": "./dist/pretty-logs.js" + "import": "./dist/index.js", + "require": "./dist/index.cjs" } }, + "files": [ + "dist/*" + ], "scripts": { "build": "tsup", "prepare": "husky install", @@ -95,4 +69,4 @@ ] }, "packageManager": "yarn@1.22.22" -} +} \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts index c62b92d..582b377 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "tsup" export default defineConfig({ entry: ["src/index.ts"], splitting: false, - sourcemap: true, + sourcemap: false, clean: true, dts: true, target: "esnext", From c6513d285fcd64bf9c517a6831bf9e3e90c21bcf Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:46:53 +0100 Subject: [PATCH 5/8] chore: formatting --- CHANGELOG.md | 13 +++++-------- package.json | 2 +- src/index.ts | 2 +- tsup.config.ts | 23 ++++++++++------------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e50783..9398daf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,21 +2,18 @@ ## [1.1.0](https://github.com/ubiquity/ubiquibot-logger/compare/v1.0.0...v1.1.0) (2024-07-02) - ### Features -* export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) -* logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) - +- export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) +- logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) ### Bug Fixes -* updated target branch for release-please.yml ([dcbdcea](https://github.com/ubiquity/ubiquibot-logger/commit/dcbdcea5a4e71de7072023c2caef432c7b984115)) +- updated target branch for release-please.yml ([dcbdcea](https://github.com/ubiquity/ubiquibot-logger/commit/dcbdcea5a4e71de7072023c2caef432c7b984115)) ## 1.0.0 (2024-07-02) - ### Features -* export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) -* logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) +- export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) +- logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) diff --git a/package.json b/package.json index 258aed4..cee5f17 100644 --- a/package.json +++ b/package.json @@ -69,4 +69,4 @@ ] }, "packageManager": "yarn@1.22.22" -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 957009f..4a3b845 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { Logs } from "./logs"; import { PrettyLogs } from "./pretty-logs"; -import { LogReturn, Metadata, LogLevel, LogLevelWithOk, Colors, } from "./types/log-types"; +import { LogReturn, Metadata, LogLevel, LogLevelWithOk, Colors } from "./types/log-types"; import { cleanLogString, cleanSpyLogs } from "./utils"; import { LOG_LEVEL, COLORS } from "./constants"; diff --git a/tsup.config.ts b/tsup.config.ts index 582b377..a942512 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,15 +1,12 @@ -import { defineConfig } from "tsup" +import { defineConfig } from "tsup"; export default defineConfig({ - entry: ["src/index.ts"], - splitting: false, - sourcemap: false, - clean: true, - dts: true, - target: "esnext", - outDir: "dist", - format: [ - "cjs", - "esm" - ] -}) \ No newline at end of file + entry: ["src/index.ts"], + splitting: false, + sourcemap: false, + clean: true, + dts: true, + target: "esnext", + outDir: "dist", + format: ["cjs", "esm"], +}); From 49271cf87d717be3accc2bf0b9cf8d8eb7a1b07a Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Sun, 7 Jul 2024 14:38:14 +0100 Subject: [PATCH 6/8] chore: changelog --- CHANGELOG.md | 10 ++++++++++ package.json | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9398daf..6c2931c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [1.1.1](https://github.com/ubiquity/ubiquibot-logger/compare/v1.0.0...v1.1.1) (2024-07-07) + +### Features + +- Improved exports via single export file ([1058f10](https://github.com/ubiquity/ubiquibot-logger/commit/1058f10e70256d5ea51f9ac50d3c2c65bd7c390b)) + +### Refactoring + +- `PrettyLogsWithOk` is now `LogLevelWithOk` ([aca537b](https://github.com/ubiquity/ubiquibot-logger/commit/aca537b8457ef6a9a7e9064dc97b1929bf3f6e7d)) + ## [1.1.0](https://github.com/ubiquity/ubiquibot-logger/compare/v1.0.0...v1.1.0) (2024-07-02) ### Features diff --git a/package.json b/package.json index cee5f17..c350960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ubiquity-dao/ubiquibot-logger", - "version": "1.1.0", + "version": "1.1.1", "description": "Ubiquity logging module with Supabase support.", "author": "Ubiquity DAO", "license": "MIT", @@ -69,4 +69,4 @@ ] }, "packageManager": "yarn@1.22.22" -} +} \ No newline at end of file From b8785d95092ebf38207c5b4856f453a162d42b7a Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:30:26 +0100 Subject: [PATCH 7/8] Revert "chore: changelog" This reverts commit 49271cf87d717be3accc2bf0b9cf8d8eb7a1b07a. --- CHANGELOG.md | 10 ---------- package.json | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c2931c..9398daf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,5 @@ # Changelog -## [1.1.1](https://github.com/ubiquity/ubiquibot-logger/compare/v1.0.0...v1.1.1) (2024-07-07) - -### Features - -- Improved exports via single export file ([1058f10](https://github.com/ubiquity/ubiquibot-logger/commit/1058f10e70256d5ea51f9ac50d3c2c65bd7c390b)) - -### Refactoring - -- `PrettyLogsWithOk` is now `LogLevelWithOk` ([aca537b](https://github.com/ubiquity/ubiquibot-logger/commit/aca537b8457ef6a9a7e9064dc97b1929bf3f6e7d)) - ## [1.1.0](https://github.com/ubiquity/ubiquibot-logger/compare/v1.0.0...v1.1.0) (2024-07-02) ### Features diff --git a/package.json b/package.json index c350960..cee5f17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ubiquity-dao/ubiquibot-logger", - "version": "1.1.1", + "version": "1.1.0", "description": "Ubiquity logging module with Supabase support.", "author": "Ubiquity DAO", "license": "MIT", @@ -69,4 +69,4 @@ ] }, "packageManager": "yarn@1.22.22" -} \ No newline at end of file +} From b09e0499b5b2cf9e7fed3e1de5d40847b5c2d8ad Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:39:46 +0100 Subject: [PATCH 8/8] chore: prettierignore changelog.md --- .prettierignore | 1 + CHANGELOG.md | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..83b6947 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +CHANGELOG.md \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9398daf..d4ca4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,16 +4,16 @@ ### Features -- export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) -- logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) +* export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) +* logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) ### Bug Fixes -- updated target branch for release-please.yml ([dcbdcea](https://github.com/ubiquity/ubiquibot-logger/commit/dcbdcea5a4e71de7072023c2caef432c7b984115)) +* updated target branch for release-please.yml ([dcbdcea](https://github.com/ubiquity/ubiquibot-logger/commit/dcbdcea5a4e71de7072023c2caef432c7b984115)) ## 1.0.0 (2024-07-02) ### Features -- export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) -- logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77)) +* export pretty-logs ([bb9e691](https://github.com/ubiquity/ubiquibot-logger/commit/bb9e691f85b7b52cd339d82e4f98fe409a801a7b)) +* logging NPM module initial port from ubiquibot refactor/general ([1ffe3d0](https://github.com/ubiquity/ubiquibot-logger/commit/1ffe3d00060e77b9eee3a0258d8baba2e5991e77))