@eventra_dev/eventra-cli 1.0.6 → 2.0.0

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.
@@ -18,20 +18,6 @@ function isTrackCallee(expr) {
18
18
  }
19
19
  return false;
20
20
  }
21
- function fileImportsEventraSdk(sourceFile) {
22
- for (const stmt of sourceFile.statements) {
23
- if (!typescript_1.default.isImportDeclaration(stmt) || !stmt.moduleSpecifier) {
24
- continue;
25
- }
26
- if (!typescript_1.default.isStringLiteral(stmt.moduleSpecifier)) {
27
- continue;
28
- }
29
- if ((0, eventraSdk_1.isEventraSdkModuleSpecifier)(stmt.moduleSpecifier.text)) {
30
- return true;
31
- }
32
- }
33
- return false;
34
- }
35
21
  function getImportDeclarationForSpecifier(decl) {
36
22
  let current = decl;
37
23
  while (current) {
@@ -155,10 +141,6 @@ function isEventraSdkTrackCall(call, checker) {
155
141
  if (!isTrackCallee(expr)) {
156
142
  return false;
157
143
  }
158
- const sourceFile = call.getSourceFile();
159
- if (!fileImportsEventraSdk(sourceFile)) {
160
- return false;
161
- }
162
144
  const receiver = typescript_1.default.isPropertyAccessExpression(expr) ||
163
145
  typescript_1.default.isPropertyAccessChain(expr) ||
164
146
  typescript_1.default.isElementAccessExpression(expr)
package/dist/cli/send.js CHANGED
@@ -62,6 +62,7 @@ async function send(opts = {}) {
62
62
  const config = await (0, config_1.loadConfig)();
63
63
  if (!config) {
64
64
  console.log(chalk_1.default.red("eventra.json not found. Run 'eventra init'"));
65
+ process.exitCode = 1;
65
66
  return;
66
67
  }
67
68
  const endpoint = config.endpoint || process.env.EVENTRA_ENDPOINT || undefined;
@@ -79,6 +80,7 @@ async function send(opts = {}) {
79
80
  console.log(chalk_1.default.red(`Endpoint "${endpoint}" from eventra.json is not locally approved.`));
80
81
  console.log(chalk_1.default.gray("If this is expected (e.g. a self-hosted ingest URL), approve it once with:"));
81
82
  console.log(chalk_1.default.gray(" eventra send --trust-endpoint"));
83
+ process.exitCode = 1;
82
84
  return;
83
85
  }
84
86
  await (0, config_1.trustEndpoint)(endpoint);
@@ -90,6 +92,7 @@ async function send(opts = {}) {
90
92
  if (!apiKey) {
91
93
  if (!process.stdin.isTTY) {
92
94
  console.log(chalk_1.default.red("API key required. Set the EVENTRA_API_KEY environment variable (recommended for CI) or run 'eventra init'."));
95
+ process.exitCode = 1;
93
96
  return;
94
97
  }
95
98
  const answers = await inquirer_1.default.prompt([
@@ -110,14 +113,17 @@ async function send(opts = {}) {
110
113
  // no events
111
114
  if (!config.events?.length) {
112
115
  console.log(chalk_1.default.yellow("No events found. Run 'eventra sync'"));
116
+ process.exitCode = 1;
113
117
  return;
114
118
  }
115
119
  if (!apiKey) {
116
120
  console.log(chalk_1.default.red("API key required"));
121
+ process.exitCode = 1;
117
122
  return;
118
123
  }
119
124
  if (!endpoint) {
120
125
  console.log(chalk_1.default.red("Endpoint not configured"));
126
+ process.exitCode = 1;
121
127
  return;
122
128
  }
123
129
  console.log("");
@@ -145,6 +151,7 @@ async function send(opts = {}) {
145
151
  console.log(chalk_1.default.red(`Request failed (${outcome.status})`));
146
152
  if (outcome.body)
147
153
  console.log(chalk_1.default.gray(outcome.body));
154
+ process.exitCode = 1;
148
155
  return;
149
156
  }
150
157
  lastFailure = { status: outcome.status, body: outcome.body };
@@ -173,6 +180,7 @@ async function send(opts = {}) {
173
180
  else if (lastFailure?.error instanceof Error) {
174
181
  console.log(chalk_1.default.gray(lastFailure.error.message));
175
182
  }
183
+ process.exitCode = 1;
176
184
  return;
177
185
  }
178
186
  console.log(chalk_1.default.green("Events registered successfully"));
package/dist/cli/watch.js CHANGED
@@ -35,6 +35,14 @@ async function watch() {
35
35
  const normalize = (file) => {
36
36
  return path_1.default.resolve(file).replace(/\\/g, "/");
37
37
  };
38
+ // chokidar's `ignored` receives absolute, normalized paths — reject any path
39
+ // with an excluded directory name as one of its segments (matches how
40
+ // `fast-glob`'s own `ignore` option is applied during the initial scan).
41
+ const excludedDirs = new Set(config.sync.exclude);
42
+ const isExcludedPath = (file) => {
43
+ const segments = normalize(file).split("/");
44
+ return segments.some((segment) => excludedDirs.has(segment));
45
+ };
38
46
  const files = await (0, fast_glob_1.default)(include, {
39
47
  ignore: config.sync.exclude,
40
48
  absolute: true,
@@ -68,7 +76,15 @@ async function watch() {
68
76
  const initialEvents = engine.getAllEvents();
69
77
  const initialWrappers = engine.getAllFunctionWrappers();
70
78
  console.log(chalk_1.default.gray(`Initial: ${initialEvents.length} events, ${initialWrappers.length} wrappers\n`));
71
- const watcher = chokidar_1.default.watch([...sourceFiles, ...watchedDeps], { ignoreInitial: true });
79
+ // Watch the project root (not just the files found by the initial scan) so
80
+ // that brand-new files matching `include` are noticed as they're created —
81
+ // a fixed file list only ever detects edits to files chokidar already knows
82
+ // about. Dependency files outside the root (added below via `watcher.add`)
83
+ // are unaffected by this and keep working the same way.
84
+ const watcher = chokidar_1.default.watch(process.cwd(), {
85
+ ignoreInitial: true,
86
+ ignored: isExcludedPath,
87
+ });
72
88
  const queue = new Map();
73
89
  let timer = null;
74
90
  const run = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/eventra-cli",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "Static analytics event extraction CLI powered by the TypeScript compiler API",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",