Skip to content

Latest commit

 

History

History
118 lines (83 loc) · 2.12 KB

File metadata and controls

118 lines (83 loc) · 2.12 KB

How to contribute

If you want to contribute or run a local version of the Formo React Native Analytics SDK, follow these steps:

Build the SDK Locally

Run the following command to build the SDK:

pnpm install
pnpm build
pnpm test

Testing Locally

Link the Local Package

To test your SDK changes in a test app, you can link the package locally using pnpm link.

For example, if your projects are in the same directory:

~/
├── your-react-native-app/
└── sdk-react-native/

Run the following commands:

# In ~/your-react-native-app
pnpm link ../sdk-react-native

Apply Changes

Any changes you make to your local package require rebuilding to be reflected:

# In ~/sdk-react-native
pnpm build

The changes will automatically be available in the linked project.

Unlink the Package

To remove the link:

# In ~/your-react-native-app
pnpm unlink ../sdk-react-native

Running Tests

Run the test suite:

pnpm test

Run tests with coverage:

pnpm test:coverage

Linting

Check code style:

pnpm lint

Type Checking

Run TypeScript type checking:

pnpm typecheck

Publishing

  1. Preview release notes:

    pnpm preview-release

    This shows what the release notes will look like based on commits since the last tag.

  2. Update the version using pnpm:

    pnpm version patch  # For bug fixes
    pnpm version minor  # For new features
    pnpm version major  # For breaking changes

    This automatically:

    • Updates package.json with the new version
    • Updates src/version.ts with the new version (via the version script hook)
    • Creates a git commit with both changes
    • Creates a version tag (e.g., v1.0.1)
  3. Push the commit and tag:

    git push --follow-tags
  4. Automatic workflow execution:

    • GitHub Actions workflow triggers on the v* tag
    • Builds and tests the package
    • Publishes to npm using OIDC (no tokens needed!)
    • Creates a GitHub release with:
      • Changelog from git commits
      • Installation instructions