@tracelog/lib 0.1.0 → 0.2.1
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.
- package/README.md +58 -24
- package/dist/browser/tracelog.js +1928 -3297
- package/dist/cjs/api.d.ts +33 -19
- package/dist/cjs/api.js +111 -156
- package/dist/cjs/app.constants.d.ts +74 -1
- package/dist/cjs/app.constants.js +77 -3
- package/dist/cjs/app.d.ts +29 -44
- package/dist/cjs/app.js +114 -212
- package/dist/cjs/app.types.d.ts +2 -7
- package/dist/cjs/app.types.js +10 -21
- package/dist/cjs/constants/api.constants.js +11 -5
- package/dist/cjs/constants/config.constants.d.ts +75 -0
- package/dist/cjs/constants/config.constants.js +178 -0
- package/dist/cjs/constants/error.constants.d.ts +29 -0
- package/dist/cjs/constants/error.constants.js +50 -0
- package/dist/cjs/constants/index.d.ts +3 -6
- package/dist/cjs/constants/index.js +3 -6
- package/dist/cjs/constants/performance.constants.d.ts +28 -0
- package/dist/cjs/constants/performance.constants.js +43 -0
- package/dist/cjs/handlers/click.handler.d.ts +1 -0
- package/dist/cjs/handlers/click.handler.js +30 -49
- package/dist/cjs/handlers/error.handler.d.ts +11 -6
- package/dist/cjs/handlers/error.handler.js +91 -51
- package/dist/cjs/handlers/page-view.handler.js +38 -29
- package/dist/cjs/handlers/performance.handler.d.ts +3 -0
- package/dist/cjs/handlers/performance.handler.js +76 -37
- package/dist/cjs/handlers/scroll.handler.d.ts +16 -10
- package/dist/cjs/handlers/scroll.handler.js +119 -185
- package/dist/cjs/handlers/session.handler.d.ts +6 -20
- package/dist/cjs/handlers/session.handler.js +38 -326
- package/dist/cjs/integrations/google-analytics.integration.d.ts +0 -1
- package/dist/cjs/integrations/google-analytics.integration.js +27 -98
- package/dist/cjs/listeners/input-listener-managers.d.ts +18 -9
- package/dist/cjs/listeners/input-listener-managers.js +24 -33
- package/dist/cjs/listeners/touch-listener-manager.d.ts +1 -3
- package/dist/cjs/listeners/touch-listener-manager.js +1 -23
- package/dist/cjs/listeners/visibility-listener-manager.d.ts +1 -4
- package/dist/cjs/listeners/visibility-listener-manager.js +6 -42
- package/dist/cjs/managers/api.manager.d.ts +13 -3
- package/dist/cjs/managers/api.manager.js +35 -5
- package/dist/cjs/managers/config.manager.d.ts +53 -3
- package/dist/cjs/managers/config.manager.js +131 -62
- package/dist/cjs/managers/event.manager.d.ts +57 -36
- package/dist/cjs/managers/event.manager.js +266 -417
- package/dist/cjs/managers/sender.manager.d.ts +40 -22
- package/dist/cjs/managers/sender.manager.js +200 -198
- package/dist/cjs/managers/session.manager.d.ts +80 -66
- package/dist/cjs/managers/session.manager.js +267 -522
- package/dist/cjs/managers/state.manager.d.ts +33 -0
- package/dist/cjs/managers/state.manager.js +79 -6
- package/dist/cjs/managers/storage.manager.d.ts +26 -2
- package/dist/cjs/managers/storage.manager.js +67 -34
- package/dist/cjs/managers/tags.manager.d.ts +31 -7
- package/dist/cjs/managers/tags.manager.js +123 -241
- package/dist/cjs/managers/user.manager.d.ts +14 -5
- package/dist/cjs/managers/user.manager.js +17 -9
- package/dist/cjs/public-api.d.ts +10 -1
- package/dist/cjs/public-api.js +18 -24
- package/dist/cjs/test-bridge.d.ts +48 -0
- package/dist/cjs/test-bridge.js +110 -0
- package/dist/cjs/types/api.types.d.ts +21 -6
- package/dist/cjs/types/api.types.js +21 -6
- package/dist/cjs/types/config.types.d.ts +22 -84
- package/dist/cjs/types/emitter.types.d.ts +11 -0
- package/dist/cjs/types/emitter.types.js +8 -0
- package/dist/cjs/types/event.types.d.ts +8 -11
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/types/index.js +3 -1
- package/dist/cjs/types/queue.types.d.ts +1 -0
- package/dist/cjs/types/session.types.d.ts +0 -64
- package/dist/cjs/types/state.types.d.ts +1 -0
- package/dist/cjs/types/test-bridge.types.d.ts +38 -0
- package/dist/cjs/types/validation-error.types.d.ts +7 -0
- package/dist/cjs/types/validation-error.types.js +11 -1
- package/dist/cjs/types/window.types.d.ts +1 -8
- package/dist/cjs/utils/data/uuid.utils.d.ts +1 -1
- package/dist/cjs/utils/data/uuid.utils.js +7 -5
- package/dist/cjs/utils/emitter.utils.d.ts +8 -0
- package/dist/cjs/utils/emitter.utils.js +33 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/logging/debug-logger.utils.d.ts +10 -51
- package/dist/cjs/utils/logging/debug-logger.utils.js +36 -127
- package/dist/cjs/utils/network/fetch-with-timeout.utils.d.ts +4 -0
- package/dist/cjs/utils/network/fetch-with-timeout.utils.js +25 -0
- package/dist/cjs/utils/network/index.d.ts +1 -0
- package/dist/cjs/utils/network/index.js +1 -0
- package/dist/cjs/utils/network/url.utils.js +2 -42
- package/dist/cjs/utils/security/sanitize.utils.d.ts +1 -8
- package/dist/cjs/utils/security/sanitize.utils.js +7 -41
- package/dist/cjs/utils/validations/config-validations.utils.d.ts +7 -0
- package/dist/cjs/utils/validations/config-validations.utils.js +77 -22
- package/dist/esm/api.d.ts +33 -19
- package/dist/esm/api.js +105 -118
- package/dist/esm/app.constants.d.ts +74 -1
- package/dist/esm/app.constants.js +76 -1
- package/dist/esm/app.d.ts +29 -44
- package/dist/esm/app.js +115 -213
- package/dist/esm/app.types.d.ts +2 -7
- package/dist/esm/app.types.js +1 -7
- package/dist/esm/constants/api.constants.js +10 -4
- package/dist/esm/constants/config.constants.d.ts +75 -0
- package/dist/esm/constants/config.constants.js +174 -0
- package/dist/esm/constants/error.constants.d.ts +29 -0
- package/dist/esm/constants/error.constants.js +47 -0
- package/dist/esm/constants/index.d.ts +3 -6
- package/dist/esm/constants/index.js +3 -6
- package/dist/esm/constants/performance.constants.d.ts +28 -0
- package/dist/esm/constants/performance.constants.js +40 -0
- package/dist/esm/handlers/click.handler.d.ts +1 -0
- package/dist/esm/handlers/click.handler.js +30 -49
- package/dist/esm/handlers/error.handler.d.ts +11 -6
- package/dist/esm/handlers/error.handler.js +91 -51
- package/dist/esm/handlers/page-view.handler.js +38 -29
- package/dist/esm/handlers/performance.handler.d.ts +3 -0
- package/dist/esm/handlers/performance.handler.js +71 -32
- package/dist/esm/handlers/scroll.handler.d.ts +16 -10
- package/dist/esm/handlers/scroll.handler.js +120 -186
- package/dist/esm/handlers/session.handler.d.ts +6 -20
- package/dist/esm/handlers/session.handler.js +38 -326
- package/dist/esm/integrations/google-analytics.integration.d.ts +0 -1
- package/dist/esm/integrations/google-analytics.integration.js +27 -98
- package/dist/esm/listeners/input-listener-managers.d.ts +18 -9
- package/dist/esm/listeners/input-listener-managers.js +23 -32
- package/dist/esm/listeners/touch-listener-manager.d.ts +1 -3
- package/dist/esm/listeners/touch-listener-manager.js +1 -23
- package/dist/esm/listeners/visibility-listener-manager.d.ts +1 -4
- package/dist/esm/listeners/visibility-listener-manager.js +6 -42
- package/dist/esm/managers/api.manager.d.ts +13 -3
- package/dist/esm/managers/api.manager.js +34 -3
- package/dist/esm/managers/config.manager.d.ts +53 -3
- package/dist/esm/managers/config.manager.js +133 -64
- package/dist/esm/managers/event.manager.d.ts +57 -36
- package/dist/esm/managers/event.manager.js +268 -419
- package/dist/esm/managers/sender.manager.d.ts +40 -22
- package/dist/esm/managers/sender.manager.js +201 -199
- package/dist/esm/managers/session.manager.d.ts +80 -66
- package/dist/esm/managers/session.manager.js +269 -524
- package/dist/esm/managers/state.manager.d.ts +33 -0
- package/dist/esm/managers/state.manager.js +78 -6
- package/dist/esm/managers/storage.manager.d.ts +26 -2
- package/dist/esm/managers/storage.manager.js +66 -33
- package/dist/esm/managers/tags.manager.d.ts +31 -7
- package/dist/esm/managers/tags.manager.js +124 -242
- package/dist/esm/managers/user.manager.d.ts +14 -5
- package/dist/esm/managers/user.manager.js +17 -9
- package/dist/esm/public-api.d.ts +10 -1
- package/dist/esm/public-api.js +14 -1
- package/dist/esm/test-bridge.d.ts +48 -0
- package/dist/esm/test-bridge.js +106 -0
- package/dist/esm/types/api.types.d.ts +21 -6
- package/dist/esm/types/api.types.js +21 -6
- package/dist/esm/types/config.types.d.ts +22 -84
- package/dist/esm/types/emitter.types.d.ts +11 -0
- package/dist/esm/types/emitter.types.js +5 -0
- package/dist/esm/types/event.types.d.ts +8 -11
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/types/index.js +3 -1
- package/dist/esm/types/queue.types.d.ts +1 -0
- package/dist/esm/types/session.types.d.ts +0 -64
- package/dist/esm/types/state.types.d.ts +1 -0
- package/dist/esm/types/test-bridge.types.d.ts +38 -0
- package/dist/esm/types/validation-error.types.d.ts +7 -0
- package/dist/esm/types/validation-error.types.js +9 -0
- package/dist/esm/types/window.types.d.ts +1 -8
- package/dist/esm/utils/data/uuid.utils.d.ts +1 -1
- package/dist/esm/utils/data/uuid.utils.js +7 -5
- package/dist/esm/utils/emitter.utils.d.ts +8 -0
- package/dist/esm/utils/emitter.utils.js +29 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/logging/debug-logger.utils.d.ts +10 -51
- package/dist/esm/utils/logging/debug-logger.utils.js +36 -127
- package/dist/esm/utils/network/fetch-with-timeout.utils.d.ts +4 -0
- package/dist/esm/utils/network/fetch-with-timeout.utils.js +22 -0
- package/dist/esm/utils/network/index.d.ts +1 -0
- package/dist/esm/utils/network/index.js +1 -0
- package/dist/esm/utils/network/url.utils.js +2 -42
- package/dist/esm/utils/security/sanitize.utils.d.ts +1 -8
- package/dist/esm/utils/security/sanitize.utils.js +6 -39
- package/dist/esm/utils/validations/config-validations.utils.d.ts +7 -0
- package/dist/esm/utils/validations/config-validations.utils.js +76 -22
- package/package.json +23 -16
- package/dist/browser/web-vitals-CCnqwnC8.mjs +0 -198
- package/dist/cjs/constants/browser.constants.d.ts +0 -3
- package/dist/cjs/constants/browser.constants.js +0 -41
- package/dist/cjs/constants/initialization.constants.d.ts +0 -40
- package/dist/cjs/constants/initialization.constants.js +0 -48
- package/dist/cjs/constants/limits.constants.d.ts +0 -27
- package/dist/cjs/constants/limits.constants.js +0 -43
- package/dist/cjs/constants/security.constants.d.ts +0 -1
- package/dist/cjs/constants/security.constants.js +0 -12
- package/dist/cjs/constants/timing.constants.d.ts +0 -22
- package/dist/cjs/constants/timing.constants.js +0 -34
- package/dist/cjs/constants/validation.constants.d.ts +0 -13
- package/dist/cjs/constants/validation.constants.js +0 -31
- package/dist/cjs/handlers/network.handler.d.ts +0 -16
- package/dist/cjs/handlers/network.handler.js +0 -136
- package/dist/cjs/managers/cross-tab-session.manager.d.ts +0 -170
- package/dist/cjs/managers/cross-tab-session.manager.js +0 -730
- package/dist/cjs/managers/sampling.manager.d.ts +0 -8
- package/dist/cjs/managers/sampling.manager.js +0 -53
- package/dist/cjs/managers/session-recovery.manager.d.ts +0 -65
- package/dist/cjs/managers/session-recovery.manager.js +0 -237
- package/dist/cjs/types/web-vitals.types.d.ts +0 -6
- package/dist/esm/constants/browser.constants.d.ts +0 -3
- package/dist/esm/constants/browser.constants.js +0 -38
- package/dist/esm/constants/initialization.constants.d.ts +0 -40
- package/dist/esm/constants/initialization.constants.js +0 -45
- package/dist/esm/constants/limits.constants.d.ts +0 -27
- package/dist/esm/constants/limits.constants.js +0 -40
- package/dist/esm/constants/security.constants.d.ts +0 -1
- package/dist/esm/constants/security.constants.js +0 -9
- package/dist/esm/constants/timing.constants.d.ts +0 -22
- package/dist/esm/constants/timing.constants.js +0 -31
- package/dist/esm/constants/validation.constants.d.ts +0 -13
- package/dist/esm/constants/validation.constants.js +0 -28
- package/dist/esm/handlers/network.handler.d.ts +0 -16
- package/dist/esm/handlers/network.handler.js +0 -132
- package/dist/esm/managers/cross-tab-session.manager.d.ts +0 -170
- package/dist/esm/managers/cross-tab-session.manager.js +0 -726
- package/dist/esm/managers/sampling.manager.d.ts +0 -8
- package/dist/esm/managers/sampling.manager.js +0 -49
- package/dist/esm/managers/session-recovery.manager.d.ts +0 -65
- package/dist/esm/managers/session-recovery.manager.js +0 -233
- package/dist/esm/types/web-vitals.types.d.ts +0 -6
- /package/dist/cjs/types/{web-vitals.types.js → test-bridge.types.js} +0 -0
- /package/dist/esm/types/{web-vitals.types.js → test-bridge.types.js} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TraceLog Library
|
|
2
2
|
|
|
3
|
-
A lightweight TypeScript
|
|
3
|
+
A lightweight TypeScript library for web analytics and user behavior tracking. Automatically captures clicks, scrolls, page views, and performance metrics with cross-tab session management and privacy-first design.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ A lightweight TypeScript Library for web analytics and user behavior tracking. A
|
|
|
9
9
|
- **Privacy-first** - Built-in PII sanitization, IP exclusion options, and configurable data sampling.
|
|
10
10
|
- **Framework agnostic** - Works with vanilla JS, React, Vue, Angular, or any web application.
|
|
11
11
|
- **Lightweight** - Only one dependency (`web-vitals`) with dual ESM/CJS support.
|
|
12
|
+
- **Event-driven** - Real-time event subscription with `on()` and `off()` methods for custom integrations.
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
@@ -32,15 +33,15 @@ A lightweight TypeScript Library for web analytics and user behavior tracking. A
|
|
|
32
33
|
Initialize tracking with your project ID and start capturing events immediately:
|
|
33
34
|
|
|
34
35
|
```typescript
|
|
35
|
-
import
|
|
36
|
+
import { tracelog } from '@tracelog/lib';
|
|
36
37
|
|
|
37
38
|
// Initialize tracking
|
|
38
|
-
await
|
|
39
|
+
await tracelog.init({
|
|
39
40
|
id: 'your-project-id'
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
// Send custom events
|
|
43
|
-
|
|
44
|
+
tracelog.event('user_signup', {
|
|
44
45
|
method: 'email',
|
|
45
46
|
plan: 'premium'
|
|
46
47
|
});
|
|
@@ -52,7 +53,7 @@ TraceLog.event('user_signup', {
|
|
|
52
53
|
|
|
53
54
|
**Basic tracking with configuration:**
|
|
54
55
|
```typescript
|
|
55
|
-
await
|
|
56
|
+
await tracelog.init({
|
|
56
57
|
id: 'your-project-id',
|
|
57
58
|
sessionTimeout: 30 * 60 * 1000 // 30 minutes
|
|
58
59
|
});
|
|
@@ -60,7 +61,7 @@ await TraceLog.init({
|
|
|
60
61
|
|
|
61
62
|
**Custom events with metadata:**
|
|
62
63
|
```typescript
|
|
63
|
-
|
|
64
|
+
tracelog.event('product_viewed', {
|
|
64
65
|
productId: 'abc-123',
|
|
65
66
|
category: 'electronics',
|
|
66
67
|
price: 299.99,
|
|
@@ -70,7 +71,7 @@ TraceLog.event('product_viewed', {
|
|
|
70
71
|
|
|
71
72
|
**Privacy-focused configuration:**
|
|
72
73
|
```typescript
|
|
73
|
-
await
|
|
74
|
+
await tracelog.init({
|
|
74
75
|
id: 'your-project-id',
|
|
75
76
|
sensitiveQueryParams: ['token', 'session_id'],
|
|
76
77
|
excludedUrlPaths: ['/admin/*', '/internal'],
|
|
@@ -83,24 +84,49 @@ await TraceLog.init({
|
|
|
83
84
|
**Core methods:**
|
|
84
85
|
- `init(config: AppConfig): Promise<void>` - Initialize tracking with project configuration.
|
|
85
86
|
- `event(name: string, metadata?: Record<string, MetadataType>): void` - Send custom event with optional metadata.
|
|
86
|
-
- `
|
|
87
|
+
- `on(event: string, callback: Function): void` - Subscribe to events emitted by TraceLog.
|
|
88
|
+
- `off(event: string, callback: Function): void` - Unsubscribe from events emitted by TraceLog.
|
|
89
|
+
- `isInitialized(): boolean` - Check if the library has been initialized.
|
|
90
|
+
- `destroy(): Promise<void>` - Clean up all tracking and remove event listeners.
|
|
87
91
|
|
|
88
92
|
**Key configuration options:**
|
|
89
93
|
- `config.id`: Your unique project identifier (required).
|
|
90
94
|
- `config.sessionTimeout`: Session timeout in milliseconds (default: 15 minutes).
|
|
91
95
|
- `config.globalMetadata`: Metadata automatically attached to all events.
|
|
96
|
+
- `config.mode`: Logging mode controlling verbosity ('qa', 'debug', etc.).
|
|
97
|
+
- `config.samplingRate`: Event sampling rate between 0 and 1.
|
|
98
|
+
- `config.errorSampling`: Error event sampling rate between 0 and 1.
|
|
99
|
+
- `config.excludedUrlPaths`: URL path patterns to ignore during tracking.
|
|
100
|
+
- `config.sensitiveQueryParams`: Query parameters to remove before tracking URLs.
|
|
101
|
+
- `config.allowHttp`: Enable HTTP requests for testing environments.
|
|
102
|
+
- `config.scrollContainerSelectors`: Custom scroll containers to monitor.
|
|
103
|
+
- `config.integrations`: Third-party integration configurations.
|
|
92
104
|
|
|
93
105
|
**Metadata types:** `string | number | boolean | string[]`
|
|
94
106
|
|
|
107
|
+
|
|
95
108
|
## Configuration
|
|
96
109
|
|
|
97
110
|
**Environment-based settings:**
|
|
98
111
|
- Use `samplingRate: 0.1` to reduce data volume in high-traffic applications
|
|
99
112
|
- Configure `sessionTimeout` to match your application's user session length
|
|
100
113
|
|
|
114
|
+
**Event subscription**
|
|
115
|
+
```typescript
|
|
116
|
+
// Subscribe to individual events as they are tracked
|
|
117
|
+
tracelog.on('event', (eventData) => {
|
|
118
|
+
console.log('Event tracked:', eventData.type, eventData);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Subscribe to event queue batches being sent
|
|
122
|
+
tracelog.on('queue', (queueData) => {
|
|
123
|
+
console.log('Events queued for sending:', queueData.events.length);
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
101
127
|
**Google Analytics integration:**
|
|
102
128
|
```typescript
|
|
103
|
-
await
|
|
129
|
+
await tracelog.init({
|
|
104
130
|
id: 'your-project-id',
|
|
105
131
|
integrations: {
|
|
106
132
|
googleAnalytics: {
|
|
@@ -113,7 +139,7 @@ await TraceLog.init({
|
|
|
113
139
|
## Compatibility
|
|
114
140
|
|
|
115
141
|
- **Runtime**: Modern browsers (Chrome 60+, Firefox 55+, Safari 12+)
|
|
116
|
-
- **Module formats**: ESM, CommonJS
|
|
142
|
+
- **Module formats**: ESM, CommonJS
|
|
117
143
|
- **TypeScript**: Full type definitions included
|
|
118
144
|
- **Frameworks**: React, Vue, Angular, Svelte, vanilla JS
|
|
119
145
|
|
|
@@ -121,35 +147,40 @@ await TraceLog.init({
|
|
|
121
147
|
|
|
122
148
|
**Development mode** → Set `NODE_ENV=dev` for event-based logging to `window` → Use browser console for runtime debugging.
|
|
123
149
|
|
|
124
|
-
**Log levels** → `qa` mode shows CLIENT_ERROR, CLIENT_WARN, INFO → `debug` mode shows all levels → Configure via
|
|
150
|
+
**Log levels** → `qa` mode shows CLIENT_ERROR, CLIENT_WARN, INFO → `debug` mode shows all levels → Configure via `mode` parameter.
|
|
125
151
|
|
|
126
152
|
```typescript
|
|
127
|
-
// Enable debug logging
|
|
128
|
-
await
|
|
129
|
-
|
|
130
|
-
//
|
|
131
|
-
window.addEventListener('tracelog:log', (event) => {
|
|
132
|
-
console.log(event.detail); // { timestamp, level, namespace, message, data? }
|
|
153
|
+
// Enable debug logging
|
|
154
|
+
await tracelog.init({
|
|
155
|
+
id: 'your-project-id',
|
|
156
|
+
mode: 'debug' // or 'qa' for less verbose logging
|
|
133
157
|
});
|
|
158
|
+
|
|
159
|
+
// Debug logs are automatically shown in console based on mode
|
|
160
|
+
// No additional event listeners needed
|
|
161
|
+
|
|
162
|
+
// Check if library is initialized
|
|
163
|
+
if (tracelog.isInitialized()) {
|
|
164
|
+
console.log('TraceLog is ready');
|
|
165
|
+
}
|
|
134
166
|
```
|
|
135
167
|
|
|
136
168
|
## CI/CD Integration
|
|
137
169
|
|
|
138
|
-
**Automated
|
|
170
|
+
**Automated testing** → Validates library integrity before deployment → Detects critical issues early.
|
|
139
171
|
|
|
140
172
|
```bash
|
|
141
|
-
# Install and run
|
|
173
|
+
# Install and run tests
|
|
142
174
|
npm ci && npx playwright install --with-deps
|
|
143
175
|
npm run build:all
|
|
144
|
-
npm run
|
|
145
|
-
npm run ci:health-strict # Strict mode (blocks on any anomalies)
|
|
176
|
+
npm run test:e2e # E2E tests for validation
|
|
146
177
|
```
|
|
147
178
|
|
|
148
179
|
**GitHub Actions** → Pre-configured workflows available:
|
|
149
180
|
- `health-check.yml` - Runs on PR and push
|
|
150
181
|
- `release-quality-gate.yml` - Validates releases
|
|
151
182
|
|
|
152
|
-
**Exit codes** → `0` =
|
|
183
|
+
**Exit codes** → `0` = tests passed → `1` = critical issues detected
|
|
153
184
|
|
|
154
185
|
## Troubleshooting
|
|
155
186
|
|
|
@@ -157,7 +188,7 @@ npm run ci:health-strict # Strict mode (blocks on any anomalies)
|
|
|
157
188
|
|
|
158
189
|
**High memory usage** → Reduce `sessionTimeout` → Lower `samplingRate` → Check for event listener leaks (call `destroy()` on cleanup).
|
|
159
190
|
|
|
160
|
-
**CI
|
|
191
|
+
**CI test failures** → Verify Playwright installation → Check Node.js ≥20 → Review test patterns.
|
|
161
192
|
|
|
162
193
|
## Development & Contributing
|
|
163
194
|
|
|
@@ -169,6 +200,8 @@ npm install
|
|
|
169
200
|
npm run build:all # Build ESM + CJS + Browser
|
|
170
201
|
npm run check # Lint + format check
|
|
171
202
|
npm run test:e2e # Run E2E tests
|
|
203
|
+
npm run test:unit # Run unit tests
|
|
204
|
+
npm run test:coverage # Run tests with coverage
|
|
172
205
|
```
|
|
173
206
|
|
|
174
207
|
### Development Workflow
|
|
@@ -201,8 +234,9 @@ This project uses a **branch protection strategy** to ensure code quality:
|
|
|
201
234
|
### Quality Standards
|
|
202
235
|
- **Code Quality**: ESLint + Prettier enforced in CI
|
|
203
236
|
- **Type Safety**: TypeScript strict mode required
|
|
204
|
-
- **Testing**: E2E tests with Playwright for all features
|
|
237
|
+
- **Testing**: Unit tests with Vitest, E2E tests with Playwright for all features
|
|
205
238
|
- **Security**: Dependency vulnerability scanning
|
|
239
|
+
- **Coverage**: Comprehensive test coverage with automated reporting
|
|
206
240
|
|
|
207
241
|
## Versioning
|
|
208
242
|
|