Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
feat: add analytics 2.0 (segmentio#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanjcharles authored Oct 26, 2021
1 parent 976b921 commit 829fc80
Show file tree
Hide file tree
Showing 15,812 changed files with 2,721,341 additions and 13,842 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
373 changes: 0 additions & 373 deletions CHANGELOG.md

This file was deleted.

84 changes: 84 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Code of Conduct

## Our Pledge

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.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

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.

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.

## Scope

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.

## Enforcement

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.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**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.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**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.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**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.

### 4. Permanent Ban

**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.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
157 changes: 106 additions & 51 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,120 @@
# Contributing

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

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

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

We use [prettier](https://www.github.com/prettier/prettier) to format our code, and [commitzen](http://commitizen.github.io/cz-cli/) to format commits.
```sh
yarn bootstrap
```

While developing, you can run the [example app](/example/) to test your changes.

To start the packager:

```sh
yarn example start
```

## Building an integration
To run the example app on Android:

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).
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).
```sh
yarn example android
```

To run the example app on iOS:

```sh
yarn example ios
```

## Environment
Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn typescript
yarn lint
```

To fix formatting errors, run the following:

```sh
yarn lint --fix
```

Remember to add tests for your change if possible. Run the unit tests by:

```sh
yarn test
```

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

```bash
$ yarn
```
# Start the server (*note there's a separate e2e command*
yarn example start:e2e
### Building

- Build the `@segment/react-native` package:
```bash
$ yarn core build
```
- Build the `@segment/react-native-*` packages:
```bash
$ yarn integrations build
```
- Build the test application for iOS and Android:
```bash
$ yarn test-app build
```
- Launch these three steps one by one:
```bash
$ yarn build
```

## Testing

```bash
$ yarn test
# iOS
yarn example e2e:build:ios
yarn example e2e:test:ios
# Android
yarn example e2e:build:android
yarn example e2e:test:android
```

### Architecture

- `packages/core`: the `@segment/analytics-react-native` module
- `docs`: the generated TypeScript documentation, commited using a `lint-staged` hook
- `src`: JavaScript module
- `ios`: iOS native module
- `android`: Android native module
- `packages/integrations`:
- `integrations.yml`: the unique source of truth for supported integrations
- `src`: a set of generators using `integrations.yml`
- `gen-integrations.ts`: generates `@segment/react-native-*` packages in `build/`
- `gen-readme.ts`: updates `README.md` [Integrations](README.md#integrations) section
- `test-app`:
- `project`: the generated react-native test-app root
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`.

To edit the Kotlin files, open `example/android` in Android studio and find the source files at `segmentanalyticsreactnative` under `Android`.

### Commit message convention

We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:

- `fix`: bug fixes, e.g. fix crash due to deprecated method.
- `feat`: new features, e.g. add new method to the module.
- `refactor`: code refactor, e.g. migrate from class components to hooks.
- `docs`: changes into documentation, e.g. add usage example for the module..
- `test`: adding or updating tests, eg add integration tests using detox.
- `chore`: tooling changes, e.g. change CI config.

Our pre-commit hooks verify that your commit message matches this format when committing.

### Linting and tests

[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)

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.

Our pre-commit hooks verify that the linter and tests pass when committing.

### Scripts

The `package.json` file contains various scripts for common tasks:

- `yarn bootstrap`: setup project by installing all dependencies and pods.
- `yarn typescript`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.
- `yarn example e2e:build:ios`: builds the example app using detox
- `yarn example e2e:test:ios`: runs the e2e on a simulator(headless if not ran manually)
- `yarn example e2e:build:android`: builds the example app using detox
- `yarn example e2e:test:android`: runs the e2e on an emulator
- `yarn example ios:deeplink`: opens the ios app via deep link (example app must already be installed)
- `yarn example android:deeplink`: opens the Android app via deep link (example app must already be installed)

### Sending a pull request

> **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).
When you're sending a pull request:

- Prefer small pull requests focused on one change.
- Verify that linters and tests are passing.
- Review the documentation to make sure it looks good.
- Follow the pull request template when opening a pull request.
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Segment

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

Loading

0 comments on commit 829fc80

Please sign in to comment.