You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
# Repository Guidelines
2
2
3
3
## Project Structure & Module Organization
4
+
4
5
- Yarn workspaces live under `packages`: `core` (SDK runtime), `sovran` (state store), `shared` (cross-package utilities), and `plugins/*` (destination and helper plugins). Native iOS/Android sources reside in each package’s `ios` and `android` folders.
5
6
- Example apps sit in `examples/AnalyticsReactNativeExample` (manual QA) and `examples/E2E` (Detox). Scripts are in `scripts/`; configuration lives alongside packages (e.g., `tsconfig.json`, `babel.config.js`, `jest.config.js`).
6
7
7
8
## Build, Test, and Development Commands
9
+
8
10
-`yarn bootstrap`: install root + workspace deps and pod install for example/e2e apps.
9
11
-`yarn build`: run workspace builds in topo order.
10
12
-`yarn testAll` / `yarn test`: workspace Jest suite or root Jest run.
@@ -13,17 +15,21 @@
13
15
- Example app: `yarn example start | ios | android`. Detox: `yarn e2e start:e2e` then platform builds/tests (e.g., `yarn e2e e2e:build:ios` + `yarn e2e e2e:test:ios`).
14
16
15
17
## Coding Style & Naming Conventions
18
+
16
19
- TypeScript-first; native code should mirror existing Swift/Obj-C/Kotlin style. Two-space indentation and Prettier formatting via ESLint rules.
17
20
- Prefer camelCase for variables/functions, PascalCase for React components/classes, and UPPER_SNAKE for constants. Plugin packages follow `plugin-*` folder naming and publish as scoped `@segment/*`.
18
21
- Keep public APIs typed and documented; colocate utilities with their feature module (e.g., `src/plugins`, `src/__tests__`).
19
22
20
23
## Testing Guidelines
24
+
21
25
- Unit tests use Jest with tests under `__tests__` near source; snapshots live in `__tests__/__snapshots__`.
22
26
- End-to-end coverage uses Detox in `examples/E2E`; build and run per platform before pushing. Add regression tests for new behaviors and keep existing snapshots updated only when intentional.
23
27
24
28
## Commit & Pull Request Guidelines
29
+
25
30
- Commit messages follow Conventional Commits (`feat`, `fix`, `chore`, etc.); enforced by commitlint and release automation.
26
31
- For PRs, keep scope narrow, link issues when relevant, and note user-facing changes. Ensure `yarn lint`, `yarn typescript`, and the relevant `yarn test*`/Detox flows pass. Include screenshots only when UI changes affect the example app.
27
32
28
33
## Security & Configuration Tips
34
+
29
35
- Do not commit real Segment write keys or private endpoints; use placeholder values in examples and tests. Keep secrets out of `examples/` and CI config. When testing proxies/CDN settings, prefer environment-driven config rather than hardcoding.
Copy file name to clipboardExpand all lines: MIGRATION_GUIDE.md
+28-15Lines changed: 28 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
# Migrating to 2.0
2
2
3
-
Analytics-React-Native 2.0 currently supports [these destinations](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins) with Segment actively adding more to the list.
4
-
If you’re using `analytics-react-native 1.5.1` or older, follow these steps to migrate to the `analytics-react-native 2.0`. You can continue to use your React Native source write key for the migration to view historical events.
3
+
Analytics-React-Native 2.0 currently supports [these destinations](https://github.com/segmentio/analytics-react-native/tree/master/packages/plugins) with Segment actively adding more to the list.
4
+
If you’re using `analytics-react-native 1.5.1` or older, follow these steps to migrate to the `analytics-react-native 2.0`. You can continue to use your React Native source write key for the migration to view historical events.
5
5
6
6
---
7
7
8
-
🚨 **Important Note**: Analytics React Native 2.0 implements a new storage framework, [@segment/sovran-react-native](https://github.com/segmentio/sovran-react-native), **which makes it impossible to determine if your app has been previously installed**.
8
+
🚨 **Important Note**: Analytics React Native 2.0 implements a new storage framework, [@segment/sovran-react-native](https://github.com/segmentio/sovran-react-native), **which makes it impossible to determine if your app has been previously installed**.
9
9
10
10
**Migrating to Analytics React Native 2.0 results in new `Application Installed` events for your existing users**. To filter these events out you can either create an Enrichment Plugin to drop events or filter them using your Segment workspace.
@@ -35,6 +38,7 @@ You will have to remove your current configuration and replace it with the `crea
35
38
**Example client configuration for `analytics-react-native 1.5.1`**
36
39
37
40
App.js:
41
+
38
42
```sh
39
43
import analytics from '@segment/analytics-react-native'
40
44
@@ -47,7 +51,9 @@ analytics.setup('WRITE_KEY', {
47
51
});
48
52
49
53
```
54
+
50
55
package.json
56
+
51
57
```sh
52
58
"dependencies": {
53
59
...
@@ -56,6 +62,7 @@ package.json
56
62
```
57
63
58
64
podfile.lock
65
+
59
66
```sh
60
67
PODS:
61
68
...
@@ -65,6 +72,7 @@ PODS:
65
72
66
73
**Example client configuration for `analytics-react-native 2.0.0`**
67
74
App.tsx (or .js):
75
+
68
76
```sh
69
77
import {
70
78
createClient,
@@ -87,7 +95,9 @@ const App = () => {
87
95
);
88
96
};
89
97
```
98
+
90
99
package.json
100
+
91
101
```sh
92
102
"dependencies": {
93
103
...
@@ -97,6 +107,7 @@ package.json
97
107
```
98
108
99
109
podfile.lock
110
+
100
111
```sh
101
112
PODS:
102
113
...
@@ -110,6 +121,7 @@ PODS:
110
121
**Example tracking implementation for `analytics-react-native 1.5.1`**
111
122
112
123
Home.js
124
+
113
125
```sh
114
126
import analytics from '@segment/analytics-react-native';
115
127
@@ -128,6 +140,7 @@ onSendEvent = async() => {
128
140
**Example tracking implementation for `analytics-react-native 2.0.0`**
129
141
130
142
Home.tsx
143
+
131
144
```sh
132
145
import { useAnalytics } from '@segment/analytics-react-native';
133
146
@@ -146,21 +159,21 @@ const Home = ({ navigation }: { navigation: any }) => {
146
159
147
160
### Plugins
148
161
149
-
**The plugins for V2 have changed from V1**.
162
+
**The plugins for V2 have changed from V1**.
150
163
151
-
The plugins have been re-released with different names. These are the equivalent packages forV2. Not all packagesin V1 have yet been released for V2 but Segment is actively adding more packages to the list.
164
+
The plugins have been re-released with different names. These are the equivalent packages forV2. Not all packagesin V1 have yet been released for V2 but Segment is actively adding more packages to the list.
152
165
153
166
Also review [the main package list](README.md#supported-plugins) for new V2 plugins.
0 commit comments