@eventra_dev/eventra-cli 0.0.1 → 0.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.
- package/README.md +68 -241
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,309 +1,136 @@
|
|
|
1
|
+
```{=html}
|
|
2
|
+
<p align="center">
|
|
3
|
+
```
|
|
4
|
+
`<img src="https://eventra.dev/eventra-icon-animated.svg" width="120" />`{=html}
|
|
5
|
+
```{=html}
|
|
6
|
+
</p>
|
|
7
|
+
```
|
|
1
8
|
# Eventra CLI
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
[](https://www.npmjs.com/package/@eventra_dev/eventra-cli)
|
|
12
|
+
[](https://www.npmjs.com/package/@eventra_dev/eventra-cli)
|
|
14
|
+
[](https://www.typescriptlang.org/)
|
|
15
|
+
|
|
16
|
+
Eventra CLI automatically discovers feature usage events in your
|
|
17
|
+
codebase and syncs them with Eventra.
|
|
18
|
+
|
|
19
|
+
Eventra CLI helps you:
|
|
4
20
|
|
|
5
|
-
|
|
21
|
+
- Discover feature usage automatically
|
|
22
|
+
- Detect wrapper components
|
|
23
|
+
- Keep events in sync
|
|
24
|
+
- Register features in Eventra
|
|
25
|
+
- Maintain consistent event naming
|
|
6
26
|
|
|
7
|
-
|
|
8
|
-
- Detect wrapper components
|
|
9
|
-
- Keep events in sync
|
|
10
|
-
- Register features in Eventra
|
|
11
|
-
- Works with any JS framework (React, Vue, Svelte, Node, etc.)
|
|
27
|
+
It is designed to be:
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
- framework-agnostic
|
|
30
|
+
- static analysis based
|
|
31
|
+
- zero runtime overhead
|
|
32
|
+
- production-safe
|
|
33
|
+
|
|
34
|
+
------------------------------------------------------------------------
|
|
14
35
|
|
|
15
36
|
# Installation
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
### npm
|
|
18
39
|
|
|
19
|
-
```bash
|
|
40
|
+
``` bash
|
|
20
41
|
npm install -D @eventra_dev/eventra-cli
|
|
21
42
|
```
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
### pnpm
|
|
24
45
|
|
|
25
|
-
```bash
|
|
46
|
+
``` bash
|
|
26
47
|
pnpm add -D @eventra_dev/eventra-cli
|
|
27
48
|
```
|
|
28
49
|
|
|
29
|
-
|
|
50
|
+
### yarn
|
|
51
|
+
|
|
52
|
+
``` bash
|
|
53
|
+
yarn add -D @eventra_dev/eventra-cli
|
|
54
|
+
```
|
|
30
55
|
|
|
31
|
-
|
|
56
|
+
### npx
|
|
57
|
+
|
|
58
|
+
``` bash
|
|
32
59
|
npx eventra init
|
|
33
60
|
```
|
|
34
61
|
|
|
35
|
-
|
|
62
|
+
------------------------------------------------------------------------
|
|
36
63
|
|
|
37
64
|
# Quick Start
|
|
38
65
|
|
|
39
|
-
```bash
|
|
66
|
+
``` bash
|
|
40
67
|
eventra init
|
|
41
68
|
eventra sync
|
|
42
69
|
eventra send
|
|
43
70
|
```
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
------------------------------------------------------------------------
|
|
46
73
|
|
|
47
74
|
# Commands
|
|
48
75
|
|
|
49
76
|
## eventra init
|
|
50
77
|
|
|
51
|
-
Creates `eventra.json`
|
|
78
|
+
Creates `eventra.json` configuration file.
|
|
52
79
|
|
|
53
|
-
```bash
|
|
80
|
+
``` bash
|
|
54
81
|
eventra init
|
|
55
82
|
```
|
|
56
83
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"apiKey": "",
|
|
62
|
-
"events": [],
|
|
63
|
-
"wrappers": [],
|
|
64
|
-
"sync": {
|
|
65
|
-
"include": ["**/*.{ts,tsx,js,jsx}"],
|
|
66
|
-
"exclude": ["node_modules", "dist", ".next", ".git"]
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
84
|
+
------------------------------------------------------------------------
|
|
72
85
|
|
|
73
86
|
## eventra sync
|
|
74
87
|
|
|
75
|
-
Scans your project and
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
eventra sync
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Eventra CLI searches for:
|
|
82
|
-
|
|
83
|
-
### Direct tracking calls
|
|
88
|
+
Scans your project and discovers events automatically.
|
|
84
89
|
|
|
85
|
-
```ts
|
|
90
|
+
``` ts
|
|
86
91
|
tracker.track("feature_created")
|
|
87
92
|
```
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```tsx
|
|
94
|
+
``` tsx
|
|
92
95
|
<TrackedButton event="feature_created" />
|
|
93
96
|
```
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
+
``` tsx
|
|
98
99
|
<MyComponent event="user_signup" />
|
|
99
100
|
```
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# Wrapper detection
|
|
104
|
-
|
|
105
|
-
If you use wrapper components, Eventra CLI will ask:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
Use wrapper components? (Y/n)
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Then:
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
Wrapper component name:
|
|
115
|
-
> TrackedButton
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
Event prop name:
|
|
120
|
-
> event
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
You can add multiple wrappers:
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
Add another wrapper? (y/N)
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Example config:
|
|
130
|
-
|
|
131
|
-
```json
|
|
132
|
-
{
|
|
133
|
-
"wrappers": [
|
|
134
|
-
{
|
|
135
|
-
"name": "TrackedButton",
|
|
136
|
-
"prop": "event"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"name": "Feature",
|
|
140
|
-
"prop": "name"
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
# Example sync output
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
eventra sync
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Output:
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
Scanning project...
|
|
158
|
-
|
|
159
|
-
Found events:
|
|
160
|
-
|
|
161
|
-
- landing_login_clicked
|
|
162
|
-
- feature_created
|
|
163
|
-
- user_signup
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
# Diff detection
|
|
169
|
-
|
|
170
|
-
Eventra CLI automatically detects changes:
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
Changes:
|
|
174
|
-
|
|
175
|
-
New events:
|
|
176
|
-
+ landing_signup_clicked
|
|
177
|
-
|
|
178
|
-
Removed events:
|
|
179
|
-
- old_event
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
---
|
|
102
|
+
------------------------------------------------------------------------
|
|
183
103
|
|
|
184
104
|
## eventra send
|
|
185
105
|
|
|
186
106
|
Send events to Eventra backend.
|
|
187
107
|
|
|
188
|
-
```bash
|
|
108
|
+
``` bash
|
|
189
109
|
eventra send
|
|
190
110
|
```
|
|
191
111
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
API key is not configured
|
|
196
|
-
Enter your API key:
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Events are registered in Eventra.
|
|
200
|
-
|
|
201
|
-
Example output:
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
Events registered successfully
|
|
205
|
-
|
|
206
|
-
New events:
|
|
207
|
-
+ feature_created
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
# Example workflow
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
eventra init
|
|
216
|
-
eventra sync
|
|
217
|
-
eventra send
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
# Configuration
|
|
223
|
-
|
|
224
|
-
eventra.json
|
|
225
|
-
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"apiKey": "",
|
|
229
|
-
"events": [],
|
|
230
|
-
"wrappers": [],
|
|
231
|
-
"sync": {
|
|
232
|
-
"include": ["**/*.{ts,tsx,js,jsx}"],
|
|
233
|
-
"exclude": ["node_modules", "dist", ".next", ".git"]
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
---
|
|
239
|
-
|
|
240
|
-
# Supported patterns
|
|
241
|
-
|
|
242
|
-
## Direct tracking
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
tracker.track("feature_created")
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Wrapper components
|
|
249
|
-
|
|
250
|
-
```tsx
|
|
251
|
-
<TrackedButton event="feature_created" />
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## Custom wrapper props
|
|
255
|
-
|
|
256
|
-
```tsx
|
|
257
|
-
<MyComponent eventName="user_signup" />
|
|
258
|
-
```
|
|
112
|
+
------------------------------------------------------------------------
|
|
259
113
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
# Supported frameworks
|
|
263
|
-
|
|
264
|
-
Eventra CLI works with:
|
|
265
|
-
|
|
266
|
-
- React
|
|
267
|
-
- Next.js
|
|
268
|
-
- Vue
|
|
269
|
-
- Nuxt
|
|
270
|
-
- Svelte
|
|
271
|
-
- Astro
|
|
272
|
-
- Node.js
|
|
273
|
-
- Express
|
|
274
|
-
- NestJS
|
|
275
|
-
- Vanilla JavaScript
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
# Important
|
|
280
|
-
|
|
281
|
-
Eventra CLI detects only string literals:
|
|
282
|
-
|
|
283
|
-
Supported:
|
|
284
|
-
|
|
285
|
-
```ts
|
|
286
|
-
track("event_name")
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Not supported:
|
|
290
|
-
|
|
291
|
-
```ts
|
|
292
|
-
track(eventName)
|
|
293
|
-
track(EVENTS.event)
|
|
294
|
-
track(getEvent())
|
|
295
|
-
```
|
|
114
|
+
# Supported Frameworks
|
|
296
115
|
|
|
297
|
-
|
|
116
|
+
- React
|
|
117
|
+
- Next.js
|
|
118
|
+
- Vue
|
|
119
|
+
- Nuxt
|
|
120
|
+
- Svelte
|
|
121
|
+
- Astro
|
|
122
|
+
- Node.js
|
|
123
|
+
- Express
|
|
124
|
+
- NestJS
|
|
298
125
|
|
|
299
|
-
|
|
126
|
+
------------------------------------------------------------------------
|
|
300
127
|
|
|
301
128
|
# Requirements
|
|
302
129
|
|
|
303
|
-
-
|
|
304
|
-
-
|
|
130
|
+
- Node.js 18+
|
|
131
|
+
- JavaScript / TypeScript project
|
|
305
132
|
|
|
306
|
-
|
|
133
|
+
------------------------------------------------------------------------
|
|
307
134
|
|
|
308
135
|
# License
|
|
309
136
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventra_dev/eventra-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Eventra CLI",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eventra": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"access": "public",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/and-1991/eventa-cli"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://eventra.dev",
|
|
10
15
|
"license": "MIT",
|
|
11
16
|
"scripts": {
|
|
12
17
|
"build": "tsc && chmod +x dist/index.js",
|