@eventra_dev/eventra-cli 2.0.2 → 2.0.4
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 +18 -5
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<a href="https://www.npmjs.com/package/@eventra_dev/eventra-cli"><img alt="npm version" src="https://img.shields.io/npm/v/@eventra_dev/eventra-cli.svg?style=flat-square&color=blue"></a>
|
|
9
9
|
<a href="https://www.npmjs.com/package/@eventra_dev/eventra-cli"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@eventra_dev/eventra-cli.svg?style=flat-square&color=blue"></a>
|
|
10
10
|
<a href="https://github.com/and-1991/eventra-cli/actions/workflows/test.yml"><img alt="tests" src="https://img.shields.io/github/actions/workflow/status/and-1991/eventra-cli/test.yml?branch=main&label=tests&style=flat-square&logo=vitest&logoColor=white"></a>
|
|
11
|
-
<img alt="unit tests" src="https://img.shields.io/badge/unit-
|
|
11
|
+
<img alt="unit tests" src="https://img.shields.io/badge/unit-110%20passing-brightgreen?style=flat-square&logo=vitest&logoColor=white">
|
|
12
12
|
<img alt="e2e fixtures" src="https://img.shields.io/badge/e2e-12%20fixtures-brightgreen?style=flat-square">
|
|
13
|
+
<img alt="coverage" src="https://img.shields.io/badge/coverage-73.5%25%20(unit)-yellow?style=flat-square&logo=vitest&logoColor=white">
|
|
13
14
|
<img alt="node" src="https://img.shields.io/node/v/@eventra_dev/eventra-cli?style=flat-square&color=darkgreen&logo=node.js&logoColor=white">
|
|
14
15
|
<a href="https://www.typescriptlang.org/"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-ready-blue?style=flat-square&logo=typescript&logoColor=white"></a>
|
|
15
16
|
<img alt="license" src="https://img.shields.io/npm/l/@eventra_dev/eventra-cli?style=flat-square&color=lightgrey">
|
|
@@ -312,9 +313,11 @@ No runtime execution. No monkey-patching.
|
|
|
312
313
|
|
|
313
314
|
## Test Coverage
|
|
314
315
|
|
|
315
|
-
Two test layers, **
|
|
316
|
+
Two test layers, **110 unit tests + 12 e2e fixtures + 3 `check` exit-code scenarios + 1 `watch` scenario**.
|
|
316
317
|
|
|
317
|
-
**
|
|
318
|
+
**73.5% statement coverage** (58.1% branch, 83.1% function, 73.8% line — v8 provider, `pnpm test:coverage`). This measures the vitest unit layer only; the e2e/`check`/`watch` fixtures run against the compiled `dist/` binary via `tsx tests/run.ts` and aren't coverage-instrumented.
|
|
319
|
+
|
|
320
|
+
**Unit tests (vitest)** — 21 suites covering core modules:
|
|
318
321
|
|
|
319
322
|
| Module | Covers |
|
|
320
323
|
|---|---|
|
|
@@ -325,12 +328,20 @@ Two test layers, **74 unit tests + 12 e2e fixtures + 3 `check` exit-code scenari
|
|
|
325
328
|
| `EventraEngine` | Direct calls, SDK isolation, cross-file wrappers, file updates, file removal, wrapper filtering |
|
|
326
329
|
| `PluginRegistry` | Built-in SDK sink, preprocessors, virtual-path mapping, include-pattern dedup |
|
|
327
330
|
| `external plugin adapter` | Transform output mapping, static sink registration, invalid result rejection |
|
|
331
|
+
| `external plugin dynamic sink` | A non-literal argument at a plugin-declared static sink surfaces as a dynamic occurrence instead of being silently dropped |
|
|
328
332
|
| `vue-shaped external plugin` | Adapter path for script + template virtual modules and `staticSinks` |
|
|
329
333
|
| `processFile` | Script-kind detection, import/export specifier extraction |
|
|
330
334
|
| `extractTemplateExpressions` | Vue/Svelte/Astro attribute patterns |
|
|
331
|
-
| `
|
|
332
|
-
| `buildConfigFromScan` | Replace events + wrappers, preserve everything else |
|
|
335
|
+
| `config` | `normalizeConfig` (sort events, dedupe wrappers, defaults, preserve `apiKey`/`endpoint`/`sync`/`plugins`); `resolveApiKey` env-var > `eventra.local.json` > legacy-inline priority, `saveLocalApiKey`'s gitignore-append |
|
|
336
|
+
| `scanResults` (`buildConfigFromScan`) | Replace events + wrappers, preserve everything else |
|
|
333
337
|
| `hash` | Stability and uniqueness |
|
|
338
|
+
| `cross-file SDK detection` | Direct `.track()` and wrapper calls resolve across files even when the call-site file never imports the SDK package itself |
|
|
339
|
+
| `dynamic event reporter` | Dynamic vs. static call classification, end-to-end `registerDynamicEventReporter` invocation |
|
|
340
|
+
| `load plugins` | Trusted-specifier allowlist (`^@eventra_dev/cli-plugin-[a-z0-9-]+$`), accepted/rejected plugin shapes |
|
|
341
|
+
| `Nuxt auto-import compatibility` | Ambient `declare const x: typeof import(...)` shape resolution — a hand-written fixture, not a real `nuxt build` (see `packages/cli-plugin-vue`'s README) |
|
|
342
|
+
| `property propagation` | Direct/optional/nested property access, destructured/aliased/nested-destructured params, element access, enum member access (same-file and cross-file), wrapper detection surviving a cast/non-null assertion, and direct object-literal payloads to `track()` staying ignored (including when cast) |
|
|
343
|
+
| `send()` | Endpoint trust-on-first-use (TOFU): default-trusted, blocked-until-approved, approve-then-persists, re-block-on-change, env-var-bypasses-approval |
|
|
344
|
+
| `wrapper detector plugin` | A custom `WrapperDetector` (e.g. a template-literal wrapper shape the built-in analyzer can't cover) alongside the built-in fallback |
|
|
334
345
|
|
|
335
346
|
**End-to-end fixtures** — 12 isolated TS projects scanned via `eventra sync`:
|
|
336
347
|
|
|
@@ -351,6 +362,8 @@ Two test layers, **74 unit tests + 12 e2e fixtures + 3 `check` exit-code scenari
|
|
|
351
362
|
- `--fix` writes scan results into `eventra.json` → exit `0`
|
|
352
363
|
- Parity (no drift) → exit `0`
|
|
353
364
|
|
|
365
|
+
**`eventra watch` scenario:** a real `watch` process detects a brand-new file (created after startup) and its `.track()` call lands in `eventra.json`.
|
|
366
|
+
|
|
354
367
|
Run locally:
|
|
355
368
|
|
|
356
369
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventra_dev/eventra-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Static analytics event extraction CLI powered by the TypeScript compiler API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dev": "tsx src/index.ts",
|
|
30
30
|
"test": "pnpm run clean && pnpm run build && pnpm run test:unit && tsx tests/run.ts",
|
|
31
31
|
"test:unit": "vitest run",
|
|
32
|
+
"test:coverage": "vitest run --coverage",
|
|
32
33
|
"test:e2e": "pnpm run clean && pnpm run build && tsx tests/run.ts",
|
|
33
34
|
"clean": "rm -rf dist"
|
|
34
35
|
},
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"@types/fs-extra": "^11.0.4",
|
|
46
47
|
"@types/inquirer": "^9.0.9",
|
|
47
48
|
"@types/node": "^20.0.0",
|
|
49
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
48
50
|
"cross-spawn": "^7.0.6",
|
|
49
51
|
"tsx": "^4.7.0",
|
|
50
52
|
"vitest": "^4.1.7"
|