@mks2508/better-logger 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/dist/Logger.d.ts +976 -0
  2. package/dist/Logger.d.ts.map +1 -0
  3. package/dist/ScopedLogger.d.ts +74 -0
  4. package/dist/ScopedLogger.d.ts.map +1 -0
  5. package/dist/chunks/Logger-CKqzXDh3.js +2 -0
  6. package/dist/chunks/Logger-CKqzXDh3.js.map +1 -0
  7. package/dist/chunks/Logger-D_vuKP4l.js +4511 -0
  8. package/dist/chunks/Logger-D_vuKP4l.js.map +1 -0
  9. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
  10. package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
  11. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
  12. package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
  13. package/dist/chunks/cli-module-B-njrTWb.js +2 -0
  14. package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
  15. package/dist/chunks/cli-module-Cx7qotPY.js +390 -0
  16. package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
  17. package/dist/chunks/color-converter-CCSQRztd.js +2 -0
  18. package/dist/chunks/color-converter-CCSQRztd.js.map +1 -0
  19. package/dist/chunks/color-converter-_Xdmsy7E.js +462 -0
  20. package/dist/chunks/color-converter-_Xdmsy7E.js.map +1 -0
  21. package/dist/chunks/environment-C1xxvc8l.js +1127 -0
  22. package/dist/chunks/environment-C1xxvc8l.js.map +1 -0
  23. package/dist/chunks/environment-Cprkw3g9.js +4 -0
  24. package/dist/chunks/environment-Cprkw3g9.js.map +1 -0
  25. package/dist/chunks/formatting-DMJxYq9o.js +380 -0
  26. package/dist/chunks/formatting-DMJxYq9o.js.map +1 -0
  27. package/dist/chunks/formatting-DpKxCsXq.js +2 -0
  28. package/dist/chunks/formatting-DpKxCsXq.js.map +1 -0
  29. package/dist/cli/CommandProcessor.d.ts +100 -0
  30. package/dist/cli/CommandProcessor.d.ts.map +1 -0
  31. package/dist/cli/commands/ConfigCommand.d.ts +14 -0
  32. package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
  33. package/dist/cli/commands/ExportCommand.d.ts +48 -0
  34. package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
  35. package/dist/cli/commands/HistoryCommand.d.ts +47 -0
  36. package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
  37. package/dist/cli/commands/StatusCommand.d.ts +30 -0
  38. package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
  39. package/dist/cli/commands/ThemeCommand.d.ts +30 -0
  40. package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
  41. package/dist/cli/help.d.ts +12 -0
  42. package/dist/cli/help.d.ts.map +1 -0
  43. package/dist/cli/index.d.ts +15 -0
  44. package/dist/cli/index.d.ts.map +1 -0
  45. package/{src/cli-module.ts → dist/cli-module.d.ts} +2 -8
  46. package/dist/cli-module.d.ts.map +1 -0
  47. package/dist/cli-primitives/box.d.ts +11 -0
  48. package/dist/cli-primitives/box.d.ts.map +1 -0
  49. package/dist/cli-primitives/cli-table.d.ts +11 -0
  50. package/dist/cli-primitives/cli-table.d.ts.map +1 -0
  51. package/dist/cli-primitives/divider.d.ts +11 -0
  52. package/dist/cli-primitives/divider.d.ts.map +1 -0
  53. package/dist/cli-primitives/header.d.ts +12 -0
  54. package/dist/cli-primitives/header.d.ts.map +1 -0
  55. package/{src/cli-primitives/index.ts → dist/cli-primitives/index.d.ts} +1 -1
  56. package/dist/cli-primitives/index.d.ts.map +1 -0
  57. package/dist/cli-primitives/server-fallback.d.ts +25 -0
  58. package/dist/cli-primitives/server-fallback.d.ts.map +1 -0
  59. package/dist/cli-primitives/spinner.d.ts +47 -0
  60. package/dist/cli-primitives/spinner.d.ts.map +1 -0
  61. package/dist/cli-primitives/step.d.ts +11 -0
  62. package/dist/cli-primitives/step.d.ts.map +1 -0
  63. package/dist/cli.cjs +2 -0
  64. package/dist/cli.cjs.map +1 -0
  65. package/dist/cli.js +12 -0
  66. package/dist/cli.js.map +1 -0
  67. package/dist/constants.d.ts +235 -0
  68. package/dist/constants.d.ts.map +1 -0
  69. package/dist/core.cjs +2 -0
  70. package/dist/core.cjs.map +1 -0
  71. package/dist/core.d.ts +127 -0
  72. package/dist/core.d.ts.map +1 -0
  73. package/dist/core.js +291 -0
  74. package/dist/core.js.map +1 -0
  75. package/dist/example.d.ts +18 -0
  76. package/dist/example.d.ts.map +1 -0
  77. package/dist/exports-module.d.ts +196 -0
  78. package/dist/exports-module.d.ts.map +1 -0
  79. package/dist/exports.cjs +2 -0
  80. package/dist/exports.cjs.map +1 -0
  81. package/dist/exports.js +238 -0
  82. package/dist/exports.js.map +1 -0
  83. package/dist/handlers/AnalyticsLogHandler.d.ts +8 -0
  84. package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
  85. package/dist/handlers/ExportLogHandler.d.ts +100 -0
  86. package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
  87. package/dist/handlers/FileLogHandler.d.ts +33 -0
  88. package/dist/handlers/FileLogHandler.d.ts.map +1 -0
  89. package/dist/handlers/RemoteLogHandler.d.ts +11 -0
  90. package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
  91. package/{src/handlers/index.ts → dist/handlers/index.d.ts} +2 -2
  92. package/dist/handlers/index.d.ts.map +1 -0
  93. package/dist/hooks/HookManager.d.ts +21 -0
  94. package/dist/hooks/HookManager.d.ts.map +1 -0
  95. package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -0
  96. package/dist/hooks/index.d.ts.map +1 -0
  97. package/dist/index.cjs +2 -0
  98. package/dist/index.cjs.map +1 -0
  99. package/dist/index.d.ts +161 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +627 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/main.d.ts +2 -0
  104. package/dist/main.d.ts.map +1 -0
  105. package/dist/serializers/SerializerRegistry.d.ts +16 -0
  106. package/dist/serializers/SerializerRegistry.d.ts.map +1 -0
  107. package/{src/serializers/index.ts → dist/serializers/index.d.ts} +1 -0
  108. package/dist/serializers/index.d.ts.map +1 -0
  109. package/dist/styling/LogStyleBuilder.d.ts +146 -0
  110. package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
  111. package/dist/styling/SemanticStyles.d.ts +178 -0
  112. package/dist/styling/SemanticStyles.d.ts.map +1 -0
  113. package/dist/styling/SmartPresets.d.ts +22 -0
  114. package/dist/styling/SmartPresets.d.ts.map +1 -0
  115. package/dist/styling/StyleBuilder.d.ts +140 -0
  116. package/dist/styling/StyleBuilder.d.ts.map +1 -0
  117. package/dist/styling/StyleCache.d.ts +42 -0
  118. package/dist/styling/StyleCache.d.ts.map +1 -0
  119. package/dist/styling/banners.d.ts +42 -0
  120. package/dist/styling/banners.d.ts.map +1 -0
  121. package/dist/styling/index.d.ts +10 -0
  122. package/dist/styling/index.d.ts.map +1 -0
  123. package/dist/styling/themes.d.ts +7 -0
  124. package/dist/styling/themes.d.ts.map +1 -0
  125. package/dist/styling-module.d.ts +178 -0
  126. package/dist/styling-module.d.ts.map +1 -0
  127. package/dist/styling.cjs +2 -0
  128. package/dist/styling.cjs.map +1 -0
  129. package/dist/styling.js +146 -0
  130. package/dist/styling.js.map +1 -0
  131. package/dist/terminal/color-converter.d.ts +73 -0
  132. package/dist/terminal/color-converter.d.ts.map +1 -0
  133. package/dist/terminal/formatter.d.ts +20 -0
  134. package/dist/terminal/formatter.d.ts.map +1 -0
  135. package/dist/terminal/terminal-renderer.d.ts +77 -0
  136. package/dist/terminal/terminal-renderer.d.ts.map +1 -0
  137. package/dist/transports/ConsoleTransport.d.ts +9 -0
  138. package/dist/transports/ConsoleTransport.d.ts.map +1 -0
  139. package/dist/transports/FileTransport.d.ts +15 -0
  140. package/dist/transports/FileTransport.d.ts.map +1 -0
  141. package/dist/transports/HttpTransport.d.ts +16 -0
  142. package/dist/transports/HttpTransport.d.ts.map +1 -0
  143. package/dist/transports/TransportManager.d.ts +14 -0
  144. package/dist/transports/TransportManager.d.ts.map +1 -0
  145. package/{src/transports/index.ts → dist/transports/index.d.ts} +1 -0
  146. package/dist/transports/index.d.ts.map +1 -0
  147. package/{src/types/core.ts → dist/types/core.d.ts} +25 -62
  148. package/dist/types/core.d.ts.map +1 -0
  149. package/{src/types/handlers.ts → dist/types/handlers.d.ts} +5 -15
  150. package/dist/types/handlers.d.ts.map +1 -0
  151. package/{src/types/hooks.ts → dist/types/hooks.d.ts} +3 -12
  152. package/dist/types/hooks.d.ts.map +1 -0
  153. package/dist/types/index.d.ts +11 -0
  154. package/dist/types/index.d.ts.map +1 -0
  155. package/{src/types/serializers.ts → dist/types/serializers.d.ts} +1 -6
  156. package/dist/types/serializers.d.ts.map +1 -0
  157. package/{src/types/transports.ts → dist/types/transports.d.ts} +2 -7
  158. package/dist/types/transports.d.ts.map +1 -0
  159. package/dist/utils/adapter.d.ts +48 -0
  160. package/dist/utils/adapter.d.ts.map +1 -0
  161. package/dist/utils/ansi-colors.d.ts +156 -0
  162. package/dist/utils/ansi-colors.d.ts.map +1 -0
  163. package/dist/utils/environment-detector.d.ts +45 -0
  164. package/dist/utils/environment-detector.d.ts.map +1 -0
  165. package/dist/utils/environment.d.ts +47 -0
  166. package/dist/utils/environment.d.ts.map +1 -0
  167. package/dist/utils/formatting.d.ts +58 -0
  168. package/dist/utils/formatting.d.ts.map +1 -0
  169. package/dist/utils/index.d.ts +8 -0
  170. package/dist/utils/index.d.ts.map +1 -0
  171. package/dist/utils/opentui-detection.d.ts +34 -0
  172. package/dist/utils/opentui-detection.d.ts.map +1 -0
  173. package/dist/utils/output.d.ts +46 -0
  174. package/dist/utils/output.d.ts.map +1 -0
  175. package/dist/utils/stackTrace.d.ts +6 -0
  176. package/dist/utils/stackTrace.d.ts.map +1 -0
  177. package/dist/utils/timestamps.d.ts +20 -0
  178. package/dist/utils/timestamps.d.ts.map +1 -0
  179. package/{src/writers/BufferWriter.ts → dist/writers/BufferWriter.d.ts} +16 -77
  180. package/dist/writers/BufferWriter.d.ts.map +1 -0
  181. package/{src/writers/index.ts → dist/writers/index.d.ts} +1 -1
  182. package/dist/writers/index.d.ts.map +1 -0
  183. package/package.json +5 -1
  184. package/.claude/settings.local.json +0 -48
  185. package/.github/workflows/ci-quality.yml +0 -357
  186. package/.github/workflows/docs-demo.yml +0 -119
  187. package/.github/workflows/releases-core.yml +0 -512
  188. package/.github/workflows/releases-full.yml +0 -582
  189. package/.github/workflows-backup/ci.yml +0 -221
  190. package/.github/workflows-backup/nightly.yml +0 -196
  191. package/.github/workflows-backup/release-optimized.yml +0 -373
  192. package/.github/workflows-backup/release.yml +0 -269
  193. package/.release-notes-0.2.0.md +0 -129
  194. package/.yamllint +0 -28
  195. package/CHANGELOG.json +0 -1120
  196. package/CHANGELOG.md +0 -209
  197. package/CLAUDE.md +0 -217
  198. package/demo.html +0 -847
  199. package/docs/API.md +0 -918
  200. package/docs/CORE.md +0 -264
  201. package/docs/DEVELOPMENT.md +0 -731
  202. package/docs/EXPORTS.md +0 -467
  203. package/docs/PACKAGES.md +0 -244
  204. package/docs/STYLING.md +0 -405
  205. package/docs/_config.yml +0 -36
  206. package/docs/index.md +0 -179
  207. package/examples/README.md +0 -208
  208. package/examples/basic-logging.js +0 -75
  209. package/examples/data-export.js +0 -234
  210. package/examples/package.json +0 -16
  211. package/examples/performance-timing.js +0 -170
  212. package/examples/simplified-api.js +0 -124
  213. package/examples/styling-themes.js +0 -207
  214. package/index.html +0 -358
  215. package/packages/core/package.json +0 -57
  216. package/packages/exports/package.json +0 -41
  217. package/packages/nodejs-opentui/README.md +0 -232
  218. package/packages/nodejs-opentui/package.json +0 -72
  219. package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
  220. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
  221. package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
  222. package/packages/nodejs-opentui/src/index.ts +0 -133
  223. package/packages/nodejs-opentui/src/types.ts +0 -158
  224. package/packages/nodejs-opentui/tsconfig.json +0 -20
  225. package/packages/styling/package.json +0 -41
  226. package/playground/demo-all.ts +0 -95
  227. package/playground/demo-box.ts +0 -85
  228. package/playground/demo-levels.ts +0 -56
  229. package/playground/demo-real-world.ts +0 -98
  230. package/playground/demo-spinner.ts +0 -77
  231. package/playground/demo-steps.ts +0 -72
  232. package/playground/demo-table.ts +0 -83
  233. package/project-utils/README.md +0 -172
  234. package/project-utils/auto-release-gemini.ts +0 -1193
  235. package/project-utils/auto-release-ui.ts +0 -1329
  236. package/project-utils/commit-generator.ts +0 -1385
  237. package/project-utils/commit-ui.ts +0 -264
  238. package/project-utils/git-utils.ts +0 -199
  239. package/project-utils/github-release-manager.ts +0 -466
  240. package/project-utils/project-config.ts +0 -260
  241. package/project-utils/prompt-templates.js +0 -345
  242. package/project-utils/prompt-templates.ts +0 -422
  243. package/project-utils/version-manager.ts +0 -1078
  244. package/src/Logger.ts +0 -1858
  245. package/src/ScopedLogger.ts +0 -256
  246. package/src/cli/CommandProcessor.ts +0 -248
  247. package/src/cli/commands/ConfigCommand.ts +0 -93
  248. package/src/cli/commands/ExportCommand.ts +0 -276
  249. package/src/cli/commands/HistoryCommand.ts +0 -117
  250. package/src/cli/commands/StatusCommand.ts +0 -112
  251. package/src/cli/commands/ThemeCommand.ts +0 -88
  252. package/src/cli/help.ts +0 -127
  253. package/src/cli/index.ts +0 -71
  254. package/src/cli-primitives/box.ts +0 -86
  255. package/src/cli-primitives/cli-table.ts +0 -62
  256. package/src/cli-primitives/divider.ts +0 -17
  257. package/src/cli-primitives/header.ts +0 -18
  258. package/src/cli-primitives/server-fallback.ts +0 -54
  259. package/src/cli-primitives/spinner.ts +0 -133
  260. package/src/cli-primitives/step.ts +0 -22
  261. package/src/constants.ts +0 -313
  262. package/src/core.ts +0 -397
  263. package/src/example.ts +0 -210
  264. package/src/exports-module.ts +0 -311
  265. package/src/handlers/AnalyticsLogHandler.ts +0 -22
  266. package/src/handlers/ExportLogHandler.ts +0 -610
  267. package/src/handlers/FileLogHandler.ts +0 -169
  268. package/src/handlers/RemoteLogHandler.ts +0 -42
  269. package/src/hooks/HookManager.ts +0 -177
  270. package/src/index.ts +0 -395
  271. package/src/main.ts +0 -196
  272. package/src/serializers/SerializerRegistry.ts +0 -173
  273. package/src/style.css +0 -96
  274. package/src/styling/LogStyleBuilder.ts +0 -355
  275. package/src/styling/SemanticStyles.ts +0 -380
  276. package/src/styling/SmartPresets.ts +0 -288
  277. package/src/styling/StyleBuilder.ts +0 -319
  278. package/src/styling/StyleCache.ts +0 -131
  279. package/src/styling/banners.ts +0 -168
  280. package/src/styling/index.ts +0 -27
  281. package/src/styling/themes.ts +0 -235
  282. package/src/styling-module.ts +0 -244
  283. package/src/terminal/color-converter.ts +0 -315
  284. package/src/terminal/formatter.ts +0 -242
  285. package/src/terminal/terminal-renderer.ts +0 -342
  286. package/src/transports/ConsoleTransport.ts +0 -28
  287. package/src/transports/FileTransport.ts +0 -53
  288. package/src/transports/HttpTransport.ts +0 -56
  289. package/src/transports/TransportManager.ts +0 -130
  290. package/src/types/index.ts +0 -83
  291. package/src/typescript.svg +0 -1
  292. package/src/utils/adapter.ts +0 -291
  293. package/src/utils/ansi-colors.ts +0 -333
  294. package/src/utils/environment-detector.ts +0 -170
  295. package/src/utils/environment.ts +0 -94
  296. package/src/utils/formatting.ts +0 -332
  297. package/src/utils/index.ts +0 -33
  298. package/src/utils/opentui-detection.ts +0 -138
  299. package/src/utils/output.ts +0 -227
  300. package/src/utils/stackTrace.ts +0 -144
  301. package/src/utils/timestamps.ts +0 -80
  302. package/src/vite-env.d.ts +0 -1
  303. package/test-core-browser.html +0 -237
  304. package/test-core-node.js +0 -63
  305. package/tests/test-conflict-resolution.ts +0 -391
  306. package/tests/validate-workflows.sh +0 -131
  307. package/tests/yaml-autofix.sh +0 -146
  308. package/tsconfig.json +0 -50
  309. package/vite.config.ts +0 -256
  310. /package/{public → dist}/vite.svg +0 -0
@@ -1,731 +0,0 @@
1
- ---
2
- layout: default
3
- title: Development Guide
4
- permalink: /DEVELOPMENT/
5
- ---
6
-
7
- # 🛠️ Development Guide
8
-
9
- Complete guide for contributing to Better Logger, including development scripts, use cases, and best practices.
10
-
11
- ## 📋 Table of Contents
12
-
13
- - [Development Setup](#development-setup)
14
- - [Available Scripts](#available-scripts)
15
- - [Use Cases & Patterns](#use-cases--patterns)
16
- - [Architecture Overview](#architecture-overview)
17
- - [Testing Strategy](#testing-strategy)
18
- - [Release Process](#release-process)
19
-
20
- ---
21
-
22
- ## 🚀 Development Setup
23
-
24
- ### Prerequisites
25
-
26
- - **Bun** 1.0+ (Primary runtime - https://bun.sh)
27
- - **Node.js** 18+ (Backup compatibility)
28
- - **Git** 2.30+
29
-
30
- ### Initial Setup
31
-
32
- ```bash
33
- # Clone the repository
34
- git clone https://github.com/MKS2508/advanced-logger.git
35
- cd advanced-logger
36
-
37
- # Install dependencies with Bun
38
- bun install
39
-
40
- # Build all modules
41
- bun run build:all
42
-
43
- # Run development server
44
- bun run dev
45
- ```
46
-
47
- ### Quick Start (Automated)
48
-
49
- ```bash
50
- # Complete setup and first commit
51
- bun install
52
- bun run type-check # Verify setup
53
- bun run build:all # Build all modules
54
- bun run commit:auto # AI-powered first commit
55
- ```
56
-
57
- ### Environment Variables
58
-
59
- Create a `.env.local` file for local development:
60
-
61
- ```bash
62
- # Optional: Analytics/monitoring endpoints for testing
63
- ANALYTICS_ENDPOINT=http://localhost:8080/analytics
64
- LOG_ENDPOINT=http://localhost:8080/logs
65
-
66
- # Development flags
67
- DEBUG_MODE=true
68
- ENABLE_SOURCE_MAPS=true
69
- ```
70
-
71
- ---
72
-
73
- ## 📜 Available Scripts
74
-
75
- ### 🏗️ Build Scripts
76
-
77
- ```bash
78
- # Modular build system with Bun runtime
79
- bun run build:full # Complete bundle with all modules
80
- bun run build:core # Core logging only (minimal size)
81
- bun run build:styling # Styling + theming features
82
- bun run build:exports # Export handlers (file, remote, analytics)
83
- bun run build:all # All modules + full build
84
-
85
- # Traditional build scripts
86
- bun run build # Alias for build:full
87
- bun run clean # Clean dist/ and packages/*/dist/
88
- bun run type-check # TypeScript validation
89
- ```
90
-
91
- ### 🤖 Automated Development Workflow
92
-
93
- ```bash
94
- # Commit automation (with Gemini AI)
95
- bun run commit:auto # Auto-generate commit, stage, and push
96
- bun run commit:ui # Interactive commit UI
97
-
98
- # Version management
99
- bun run version:auto # Auto-detect version type from commits
100
- bun run version:patch # 0.2.0 → 0.2.1
101
- bun run version:minor # 0.2.0 → 0.3.0
102
- bun run version:major # 0.2.0 → 1.0.0
103
-
104
- # Pre-release channels
105
- bun run version:alpha # 0.2.0 → 0.2.1-alpha.0
106
- bun run version:beta # 0.2.0 → 0.2.1-beta.0
107
- bun run version:stable # 0.2.1-alpha.0 → 0.2.1
108
-
109
- # Release automation
110
- bun run release:github # Create GitHub release with assets
111
- bun run release:auto # Full release with Gemini AI analysis
112
- ```
113
-
114
- ### 🚀 Complete Workflow Scripts
115
-
116
- ```bash
117
- # Development workflows
118
- bun run workflow:commit # commit:auto
119
- bun run workflow:release # version:auto + build:all + release:github
120
- bun run workflow:full # commit:auto + release:full
121
-
122
- # Production release workflows
123
- bun run release:full # version:auto + build:all + release:github + publish
124
- ```
125
-
126
- ### 🧪 Testing & Quality Scripts
127
-
128
- ```bash
129
- # Testing
130
- bun run test # Run test suite
131
- bun run test:performance # Performance benchmarks
132
- bun run test:visual # Visual regression tests
133
- bun run size-limit # Bundle size analysis
134
-
135
- # CI/CD compatibility
136
- bun run ci:build # Build all modules
137
- bun run ci:test # Run tests in CI
138
- ```
139
-
140
- ### 📦 Publishing Scripts
141
-
142
- ```bash
143
- # NPM Registry (Production)
144
- bun run ci:publish # Publish to public NPM
145
-
146
- # GitHub Packages (Beta testing)
147
- bun run ci:publish:github # Publish to GitHub registry
148
-
149
- # Note: Publishing is also integrated into release workflows
150
- ```
151
-
152
- ---
153
-
154
- ## 🔄 Local Development Workflows
155
-
156
- ### 🛠️ Common Development Scenarios
157
-
158
- #### **Scenario 1: Bug Fix in Core Module**
159
- ```bash
160
- # 1. Make changes to src/core.ts or src/Logger.ts
161
- # 2. Test changes
162
- bun run type-check
163
- bun run build:core
164
-
165
- # 3. Commit with AI assistance
166
- bun run commit:auto
167
- # AI detects: "fix(core): resolve logging level hierarchy issue"
168
-
169
- # 4. Create patch release
170
- bun run version:patch # 0.2.0 → 0.2.1
171
- bun run build:all # Rebuild all modules with new version
172
- bun run release:github # Create GitHub release
173
-
174
- # 5. Optional: Publish to NPM
175
- bun run ci:publish # Publish stable version
176
- ```
177
-
178
- #### **Scenario 2: New Feature in Styling Module**
179
- ```bash
180
- # 1. Develop new theme or styling feature
181
- # 2. Test visual changes
182
- bun run dev # Preview changes
183
- bun run build:styling # Test styling build
184
-
185
- # 3. Automated workflow
186
- bun run workflow:commit # Auto-commit changes
187
- # AI detects: "feat(styling): add cyberpunk theme with neon effects"
188
-
189
- # 4. Feature release
190
- bun run version:minor # 0.2.0 → 0.3.0
191
- bun run workflow:release # Build + GitHub release (no publish)
192
-
193
- # 5. Beta testing before production
194
- bun run version:beta # 0.3.0 → 0.3.1-beta.0
195
- bun run build:all
196
- bun run ci:publish:github # Publish beta to GitHub Packages
197
- ```
198
-
199
- #### **Scenario 3: Major Refactoring (Breaking Changes)**
200
- ```bash
201
- # 1. Complete refactoring work
202
- # 2. Update all modules affected
203
- bun run build:all # Verify all builds work
204
- bun run type-check # Ensure no type errors
205
-
206
- # 3. Create comprehensive commit
207
- bun run commit:auto
208
- # AI detects: "feat!: redesign API with breaking changes to Logger interface"
209
-
210
- # 4. Major version release
211
- bun run version:major # 0.2.0 → 1.0.0
212
- bun run build:all
213
- bun run release:github
214
-
215
- # 5. Production release (after testing)
216
- bun run ci:publish # Publish new major version
217
- ```
218
-
219
- #### **Scenario 4: Alpha/Beta Release Cycle**
220
- ```bash
221
- # Development phase
222
- bun run commit:auto # Commit feature work
223
- bun run version:alpha # 0.2.0 → 0.2.1-alpha.0
224
- bun run build:all
225
- bun run ci:publish:github # Alpha testing in GitHub Packages
226
-
227
- # More development...
228
- bun run commit:auto
229
- bun run version:alpha # 0.2.1-alpha.0 → 0.2.1-alpha.1
230
-
231
- # Beta phase
232
- bun run version:beta # 0.2.1-alpha.1 → 0.2.1-beta.0
233
- bun run workflow:release # Build + GitHub release
234
-
235
- # Stable release
236
- bun run version:stable # 0.2.1-beta.0 → 0.2.1
237
- bun run release:full # Full production release with NPM publish
238
- ```
239
-
240
- #### **Scenario 5: Hotfix in Production**
241
- ```bash
242
- # 1. Create hotfix branch
243
- git checkout -b hotfix/critical-bug
244
- # 2. Fix issue quickly
245
- bun run type-check
246
-
247
- # 3. Emergency release
248
- bun run commit:auto # Quick commit
249
- bun run version:patch # Immediate patch version
250
- bun run build:all
251
- bun run ci:publish # Direct to production (skip GitHub packages)
252
-
253
- # 4. Create GitHub release after
254
- bun run release:github
255
- ```
256
-
257
- ### 🔧 Advanced Workflow Combinations
258
-
259
- #### **Full Development Cycle**
260
- ```bash
261
- # Complete development workflow
262
- bun run workflow:full
263
- # Executes: commit:auto → version:auto → build:all → release:github → ci:publish
264
- ```
265
-
266
- #### **Safe Testing Workflow**
267
- ```bash
268
- # Test without publishing to NPM
269
- bun run workflow:commit # Commit changes
270
- bun run workflow:release # Version + build + GitHub release
271
- bun run ci:publish:github # Test publish to GitHub Packages only
272
- ```
273
-
274
- #### **AI-Powered Release**
275
- ```bash
276
- # Let Gemini AI analyze and create complete release
277
- bun run release:auto
278
- # AI analyzes all changes, creates optimized commits, versions, and releases
279
- ```
280
-
281
- ### 📋 Script Execution Order Reference
282
-
283
- #### **For Bug Fixes**
284
- 1. `bun run commit:auto` → Auto-commit with fix message
285
- 2. `bun run version:patch` → Increment patch version
286
- 3. `bun run build:core` → Build affected module only
287
- 4. `bun run release:github` → Create release
288
- 5. `bun run ci:publish` → Publish if needed
289
-
290
- #### **For New Features**
291
- 1. `bun run commit:auto` → Auto-commit with feat message
292
- 2. `bun run version:minor` → Increment minor version
293
- 3. `bun run build:all` → Build all modules
294
- 4. `bun run release:github` → Create release
295
- 5. `bun run ci:publish:github` → Beta test first
296
- 6. `bun run ci:publish` → Production when ready
297
-
298
- #### **For Breaking Changes**
299
- 1. `bun run commit:auto` → Auto-commit with breaking change
300
- 2. `bun run version:major` → Increment major version
301
- 3. `bun run build:all` → Build all modules
302
- 4. `bun run release:github` → Create release with breaking change notes
303
- 5. Manual testing before `bun run ci:publish`
304
-
305
- ---
306
-
307
- ## 🎯 Use Cases & Patterns
308
-
309
- ### 1. Frontend Application Logging
310
-
311
- **Scenario**: React/Vue/Angular application with visual debugging needs
312
-
313
- ```typescript
314
- import { Logger } from '@mks2508/better-logger';
315
- import { setTheme } from '@mks2508/better-logger/styling';
316
-
317
- // Setup for frontend development
318
- const logger = new Logger({
319
- prefix: 'APP',
320
- enableStackTrace: true
321
- });
322
-
323
- // Development theme
324
- if (process.env.NODE_ENV === 'development') {
325
- setTheme('neon');
326
- }
327
-
328
- // Component lifecycle logging
329
- logger.info('Component mounted', { component: 'UserDashboard' });
330
- logger.time('data-fetch');
331
-
332
- // API interaction
333
- try {
334
- const data = await fetchUserData();
335
- logger.timeEnd('data-fetch');
336
- logger.success('User data loaded', { records: data.length });
337
- } catch (error) {
338
- logger.error('Failed to load user data', error);
339
- }
340
- ```
341
-
342
- ### 2. Node.js Backend Service
343
-
344
- **Scenario**: Express.js API server with structured logging
345
-
346
- ```typescript
347
- import { Logger } from '@mks2508/better-logger/core';
348
- import { ExportLogger } from '@mks2508/better-logger/exports';
349
-
350
- // Production-ready logger for Node.js
351
- const logger = new ExportLogger({
352
- prefix: 'API',
353
- bufferSize: 5000,
354
- level: process.env.LOG_LEVEL || 'info'
355
- });
356
-
357
- // Setup file and remote logging
358
- logger.addRemoteHandler(process.env.LOG_ENDPOINT, {
359
- apiKey: process.env.LOG_API_KEY,
360
- batchSize: 50,
361
- interval: 30000
362
- });
363
-
364
- // Request middleware
365
- app.use((req, res, next) => {
366
- logger.time(`request-${req.id}`);
367
- logger.info('Request received', {
368
- method: req.method,
369
- url: req.url,
370
- ip: req.ip
371
- });
372
- next();
373
- });
374
-
375
- // Error handling
376
- app.use((error, req, res, next) => {
377
- logger.error('Request failed', {
378
- error: error.message,
379
- stack: error.stack,
380
- requestId: req.id
381
- });
382
- res.status(500).json({ error: 'Internal server error' });
383
- });
384
- ```
385
-
386
- ### 3. Library/SDK Development
387
-
388
- **Scenario**: Creating a library with optional logging
389
-
390
- ```typescript
391
- import { Logger } from '@mks2508/better-logger/core';
392
-
393
- class MySDK {
394
- private logger: Logger;
395
-
396
- constructor(options = {}) {
397
- // Allow users to provide their own logger
398
- this.logger = options.logger || new Logger({
399
- prefix: 'SDK',
400
- level: options.debug ? 'debug' : 'warn'
401
- });
402
- }
403
-
404
- async performOperation() {
405
- this.logger.debug('Starting operation');
406
-
407
- try {
408
- this.logger.time('operation');
409
- const result = await this.internalWork();
410
- this.logger.timeEnd('operation');
411
-
412
- this.logger.info('Operation completed', { result });
413
- return result;
414
- } catch (error) {
415
- this.logger.error('Operation failed', error);
416
- throw error;
417
- }
418
- }
419
- }
420
- ```
421
-
422
- ### 4. Development Tool Integration
423
-
424
- **Scenario**: Build tools, CLI applications, development utilities
425
-
426
- ```typescript
427
- import { Logger } from '@mks2508/better-logger';
428
- import { setTheme, showBanner } from '@mks2508/better-logger/styling';
429
-
430
- // CLI tool with visual feedback
431
- const logger = new Logger({ prefix: 'TOOL' });
432
-
433
- // Show branded startup
434
- setTheme('cyberpunk');
435
- showBanner('ascii');
436
-
437
- // Build process logging
438
- logger.info('Starting build process...');
439
-
440
- logger.time('webpack-build');
441
- await runWebpack();
442
- logger.timeEnd('webpack-build');
443
-
444
- // File operations with progress
445
- const files = await glob('src/**/*.ts');
446
- logger.info(`Processing ${files.length} files`);
447
-
448
- for (const file of files) {
449
- logger.debug('Processing file', { file });
450
- await processFile(file);
451
- }
452
-
453
- logger.success('Build completed successfully!');
454
- ```
455
-
456
- ### 5. Testing & Debugging
457
-
458
- **Scenario**: Test suites with detailed logging for debugging
459
-
460
- ```typescript
461
- import { Logger } from '@mks2508/better-logger';
462
- import { createStyle } from '@mks2508/better-logger/styling';
463
-
464
- const testLogger = new Logger({ prefix: 'TEST' });
465
-
466
- // Custom styles for test results
467
- const passStyle = createStyle()
468
- .bg('#4CAF50')
469
- .color('white')
470
- .padding('4px 8px')
471
- .build();
472
-
473
- const failStyle = createStyle()
474
- .bg('#F44336')
475
- .color('white')
476
- .padding('4px 8px')
477
- .build();
478
-
479
- describe('User Authentication', () => {
480
- beforeEach(() => {
481
- testLogger.info('Setting up test environment');
482
- });
483
-
484
- it('should authenticate valid user', async () => {
485
- testLogger.time('auth-test');
486
-
487
- const result = await authenticateUser(validCredentials);
488
-
489
- if (result.success) {
490
- console.log('%c✅ PASS', passStyle);
491
- testLogger.success('Authentication test passed');
492
- } else {
493
- console.log('%c❌ FAIL', failStyle);
494
- testLogger.error('Authentication test failed', result);
495
- }
496
-
497
- testLogger.timeEnd('auth-test');
498
- });
499
- });
500
- ```
501
-
502
- ---
503
-
504
- ## 🏗️ Architecture Overview
505
-
506
- ### Modular Architecture
507
-
508
- #### **Source Structure**
509
- ```
510
- src/
511
- ├── core.ts # Core logging functionality (6KB)
512
- ├── styling-module.ts # Visual features & themes (78KB)
513
- ├── exports-module.ts # Data export & remote logging (80KB)
514
- ├── index.ts # Full library entry point (complete bundle)
515
- ├── cli/ # CLI interface modules
516
- ├── styling/ # Styling system components
517
- ├── handlers/ # Log handler implementations
518
- ├── utils/ # Utility functions
519
- └── types/ # TypeScript definitions
520
- ```
521
-
522
- #### **Build Outputs**
523
- ```
524
- dist/ # Full bundle build
525
- ├── index.js # Complete library (ES modules)
526
- ├── index.cjs # Complete library (CommonJS)
527
- ├── core.js # Core module only
528
- ├── styling.js # Styling module only
529
- ├── exports.js # Exports module only
530
- └── types/ # TypeScript definitions
531
-
532
- packages/ # Individual module builds
533
- ├── core/
534
- │ ├── package.json # @mks2508/better-logger-core
535
- │ └── dist/ # Core module build
536
- ├── styling/
537
- │ ├── package.json # @mks2508/better-logger-styling
538
- │ └── dist/ # Styling module build
539
- └── exports/
540
- ├── package.json # @mks2508/better-logger-exports
541
- └── dist/ # Exports module build
542
- ```
543
-
544
- #### **Package Distribution**
545
- - **@mks2508/better-logger**: Full bundle (all modules)
546
- - **@mks2508/better-logger-core**: Core logging only (minimal)
547
- - **@mks2508/better-logger-styling**: Visual features + theming
548
- - **@mks2508/better-logger-exports**: Export handlers + remote logging
549
-
550
- ### Build System
551
-
552
- - **Vite** - Fast development and optimized production builds
553
- - **TypeScript** - Type safety and modern JavaScript features
554
- - **Rollup** - Library-optimized bundling
555
- - **Terser** - Minification and compression
556
-
557
- ### Bundle Strategy
558
-
559
- ```typescript
560
- // Entry points for different use cases
561
- export * from './core'; // Essential features
562
- export * from './styling'; // Visual enhancements
563
- export * from './exports'; // Data management
564
- export * from './cli'; // CLI interface
565
- ```
566
-
567
- ---
568
-
569
- ## 🧪 Testing Strategy
570
-
571
- ### Test Types
572
-
573
- 1. **Unit Tests** - Individual function/method testing
574
- 2. **Integration Tests** - Module interaction testing
575
- 3. **Visual Tests** - Screenshot-based UI testing
576
- 4. **Performance Tests** - Bundle size and runtime performance
577
- 5. **Cross-platform Tests** - Browser and Node.js compatibility
578
-
579
- ### Test Structure
580
-
581
- ```
582
- tests/
583
- ├── unit/ # Unit tests
584
- │ ├── core.test.js
585
- │ ├── styling.test.js
586
- │ └── exports.test.js
587
- ├── integration/ # Integration tests
588
- │ ├── full-workflow.test.js
589
- │ └── cross-module.test.js
590
- ├── visual/ # Visual regression tests
591
- │ ├── themes.spec.js
592
- │ └── styling.spec.js
593
- ├── performance/ # Performance benchmarks
594
- │ └── bundle-size.test.js
595
- └── fixtures/ # Test data and utilities
596
- ```
597
-
598
- ### Running Tests
599
-
600
- ```bash
601
- # Unit tests
602
- npm run test:unit
603
-
604
- # Visual tests (Playwright)
605
- npm run test:visual
606
-
607
- # Performance tests
608
- npm run test:performance
609
-
610
- # All tests
611
- npm test
612
- ```
613
-
614
- ---
615
-
616
- ## 🚀 Release Process
617
-
618
- ### Version Strategy
619
-
620
- Better Logger follows [Semantic Versioning](https://semver.org/):
621
-
622
- - **Patch** (0.0.1 → 0.0.2): Bug fixes, performance improvements
623
- - **Minor** (0.0.1 → 0.1.0): New features, backward compatible
624
- - **Major** (0.0.1 → 1.0.0): Breaking changes
625
- - **Pre-release**: Alpha/Beta versions for testing
626
-
627
- ### Release Steps
628
-
629
- 1. **Development**
630
- ```bash
631
- # Feature development
632
- git checkout -b feature/new-feature
633
- npm run dev
634
- npm run test
635
- ```
636
-
637
- 2. **Testing**
638
- ```bash
639
- # Run full test suite
640
- npm run test:all
641
- npm run build:analyze
642
- ```
643
-
644
- 3. **Release**
645
- ```bash
646
- # Version bump and publish
647
- npm run release:alpha # For testing
648
- npm run release # Production release
649
- ```
650
-
651
- 4. **Post-Release**
652
- - GitHub release with changelog
653
- - Documentation updates
654
- - Demo site deployment
655
-
656
- ### CI/CD Pipeline
657
-
658
- Our GitHub Actions automatically:
659
-
660
- - ✅ Run tests on multiple Node.js versions
661
- - ✅ Build and test the package
662
- - ✅ Run visual regression tests
663
- - ✅ Publish to npm registry
664
- - ✅ Create GitHub releases
665
- - ✅ Deploy demo to GitHub Pages
666
-
667
- ---
668
-
669
- ## 🤝 Contributing Guidelines
670
-
671
- ### Code Standards
672
-
673
- - **TypeScript** for all source code
674
- - **ESLint** and **Prettier** for formatting
675
- - **JSDoc** comments for public APIs
676
- - **Semantic** commit messages
677
-
678
- ### Pull Request Process
679
-
680
- 1. Fork the repository
681
- 2. Create a feature branch
682
- 3. Write tests for new features
683
- 4. Ensure all tests pass
684
- 5. Submit pull request with clear description
685
-
686
- ### Code Review Checklist
687
-
688
- - [ ] Code follows project conventions
689
- - [ ] Tests cover new functionality
690
- - [ ] Documentation is updated
691
- - [ ] Performance impact is acceptable
692
- - [ ] No breaking changes (unless major version)
693
-
694
- ---
695
-
696
- ## 🔧 Troubleshooting
697
-
698
- ### Common Development Issues
699
-
700
- **Build Failures**
701
- ```bash
702
- # Clear cache and rebuild
703
- npm run clean
704
- rm -rf node_modules package-lock.json
705
- npm install
706
- npm run build
707
- ```
708
-
709
- **Type Errors**
710
- ```bash
711
- # Run type checking
712
- npm run type-check
713
- # Fix issues and rebuild
714
- ```
715
-
716
- **Development Server Issues**
717
- ```bash
718
- # Restart with clean slate
719
- npm run clean
720
- npm run dev
721
- ```
722
-
723
- ### Getting Help
724
-
725
- - 📖 [API Documentation](API.md)
726
- - 🐛 [Issue Tracker](https://github.com/MKS2508/advanced-logger/issues)
727
- - 💬 [Discussions](https://github.com/MKS2508/advanced-logger/discussions)
728
-
729
- ---
730
-
731
- **Happy developing! 🚀**