Skip to content

Commit 829fc80

Browse files
authored
feat: add analytics 2.0 (#360)
1 parent 976b921 commit 829fc80

File tree

15,812 files changed

+2721341
-13842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

15,812 files changed

+2721341
-13842
lines changed

CHANGELOG.md

Lines changed: 0 additions & 373 deletions
This file was deleted.

CODE_OF_CONDUCT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
- Demonstrating empathy and kindness toward other people
14+
- Being respectful of differing opinions, viewpoints, and experiences
15+
- Giving and gracefully accepting constructive feedback
16+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
- Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
- The use of sexualized language or imagery, and sexual attention or
22+
advances of any kind
23+
- Trolling, insulting or derogatory comments, and personal or political attacks
24+
- Public or private harassment
25+
- Publishing others' private information, such as a physical or email
26+
address, without their explicit permission
27+
- Other conduct which could reasonably be considered inappropriate in a
28+
professional setting
29+
30+
## Enforcement Responsibilities
31+
32+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33+
34+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35+
36+
## Scope
37+
38+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39+
40+
## Enforcement
41+
42+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
43+
44+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45+
46+
## Enforcement Guidelines
47+
48+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49+
50+
### 1. Correction
51+
52+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53+
54+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55+
56+
### 2. Warning
57+
58+
**Community Impact**: A violation through a single incident or series of actions.
59+
60+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61+
62+
### 3. Temporary Ban
63+
64+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65+
66+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67+
68+
### 4. Permanent Ban
69+
70+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71+
72+
**Consequence**: A permanent ban from any sort of public interaction within the community.
73+
74+
## Attribution
75+
76+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77+
available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
78+
79+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80+
81+
[homepage]: https://www.contributor-covenant.org
82+
83+
For answers to common questions about this code of conduct, see the FAQ at
84+
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.

CONTRIBUTING.md

Lines changed: 106 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,120 @@
11
# Contributing
22

3-
If you would like to contribute code to `analytics-react-native` you can do so through
4-
GitHub by forking the repository and sending a pull request.
3+
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project.
54

6-
When submitting code, please make every effort to follow existing conventions
7-
and style in order to keep the code as readable as possible. Please also make
8-
sure your code runs by [building](#building) and [testing](#testing).
5+
## Development workflow
96

10-
## Style Guide
7+
To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies for each package:
118

12-
We use [prettier](https://www.github.com/prettier/prettier) to format our code, and [commitzen](http://commitizen.github.io/cz-cli/) to format commits.
9+
```sh
10+
yarn bootstrap
11+
```
12+
13+
While developing, you can run the [example app](/example/) to test your changes.
14+
15+
To start the packager:
16+
17+
```sh
18+
yarn example start
19+
```
1320

14-
## Building an integration
21+
To run the example app on Android:
1522

16-
To build an integration you'll first need to integrate it using the native Analytics SDK, here's a documentation to do so [for iOS](https://github.com/segmentio/analytics-ios/blob/master/CONTRIBUTING.md) or [for Android](https://github.com/segmentio/analytics-android/blob/master/CONTRIBUTING.md).
17-
When your integration is ready you'll need to add it to [`integrations.yml`](https://github.com/segmentio/analytics-react-native/blob/develop/packages/integrations/integrations.yml) and check it works by [building](#building) and [testing](#testing).
23+
```sh
24+
yarn example android
25+
```
26+
27+
To run the example app on iOS:
28+
29+
```sh
30+
yarn example ios
31+
```
1832

19-
## Environment
33+
Make sure your code passes TypeScript and ESLint. Run the following to verify:
34+
35+
```sh
36+
yarn typescript
37+
yarn lint
38+
```
39+
40+
To fix formatting errors, run the following:
41+
42+
```sh
43+
yarn lint --fix
44+
```
45+
46+
Remember to add tests for your change if possible. Run the unit tests by:
47+
48+
```sh
49+
yarn test
50+
```
2051

21-
This project is a Yarn workspace, npm is not supported. To install dependencies run :
52+
The are also end-to-end tests. First you will have to build the app and then run the tests:
2253

23-
```bash
24-
$ yarn
2554
```
55+
# Start the server (*note there's a separate e2e command*
56+
yarn example start:e2e
2657
27-
### Building
28-
29-
- Build the `@segment/react-native` package:
30-
```bash
31-
$ yarn core build
32-
```
33-
- Build the `@segment/react-native-*` packages:
34-
```bash
35-
$ yarn integrations build
36-
```
37-
- Build the test application for iOS and Android:
38-
```bash
39-
$ yarn test-app build
40-
```
41-
- Launch these three steps one by one:
42-
```bash
43-
$ yarn build
44-
```
45-
46-
## Testing
47-
48-
```bash
49-
$ yarn test
58+
# iOS
59+
yarn example e2e:build:ios
60+
yarn example e2e:test:ios
61+
62+
# Android
63+
yarn example e2e:build:android
64+
yarn example e2e:test:android
5065
```
5166

52-
### Architecture
53-
54-
- `packages/core`: the `@segment/analytics-react-native` module
55-
- `docs`: the generated TypeScript documentation, commited using a `lint-staged` hook
56-
- `src`: JavaScript module
57-
- `ios`: iOS native module
58-
- `android`: Android native module
59-
- `packages/integrations`:
60-
- `integrations.yml`: the unique source of truth for supported integrations
61-
- `src`: a set of generators using `integrations.yml`
62-
- `gen-integrations.ts`: generates `@segment/react-native-*` packages in `build/`
63-
- `gen-readme.ts`: updates `README.md` [Integrations](README.md#integrations) section
64-
- `test-app`:
65-
- `project`: the generated react-native test-app root
67+
To edit the Objective-C / Swift files, open `example/ios/AnalyticsReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @segment/analytics-react-native`.
68+
69+
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `segmentanalyticsreactnative` under `Android`.
70+
71+
### Commit message convention
72+
73+
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
74+
75+
- `fix`: bug fixes, e.g. fix crash due to deprecated method.
76+
- `feat`: new features, e.g. add new method to the module.
77+
- `refactor`: code refactor, e.g. migrate from class components to hooks.
78+
- `docs`: changes into documentation, e.g. add usage example for the module..
79+
- `test`: adding or updating tests, eg add integration tests using detox.
80+
- `chore`: tooling changes, e.g. change CI config.
81+
82+
Our pre-commit hooks verify that your commit message matches this format when committing.
83+
84+
### Linting and tests
85+
86+
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
87+
88+
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, [Jest](https://jestjs.io/) for unit testing and [Detox](https://github.com/wix/Detox) for end-to-end tests.
89+
90+
Our pre-commit hooks verify that the linter and tests pass when committing.
91+
92+
### Scripts
93+
94+
The `package.json` file contains various scripts for common tasks:
95+
96+
- `yarn bootstrap`: setup project by installing all dependencies and pods.
97+
- `yarn typescript`: type-check files with TypeScript.
98+
- `yarn lint`: lint files with ESLint.
99+
- `yarn test`: run unit tests with Jest.
100+
- `yarn example start`: start the Metro server for the example app.
101+
- `yarn example android`: run the example app on Android.
102+
- `yarn example ios`: run the example app on iOS.
103+
- `yarn example e2e:build:ios`: builds the example app using detox
104+
- `yarn example e2e:test:ios`: runs the e2e on a simulator(headless if not ran manually)
105+
- `yarn example e2e:build:android`: builds the example app using detox
106+
- `yarn example e2e:test:android`: runs the e2e on an emulator
107+
- `yarn example ios:deeplink`: opens the ios app via deep link (example app must already be installed)
108+
- `yarn example android:deeplink`: opens the Android app via deep link (example app must already be installed)
109+
110+
### Sending a pull request
111+
112+
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
113+
114+
When you're sending a pull request:
115+
116+
- Prefer small pull requests focused on one change.
117+
- Verify that linters and tests are passing.
118+
- Review the documentation to make sure it looks good.
119+
- Follow the pull request template when opening a pull request.
120+
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Segment
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)