Skip to content

Reimplementation of posthog-js to be as light and modular as possible.

License

Notifications You must be signed in to change notification settings

adamlacombe/posthog-js-lite

 
 

Repository files navigation

posthog-js-lite

The next generation of PostHog client libraries within the JS/TS ecosystem.

The lofty goals of this codebase is to solve the core client logic of our various JS based libraries in one place (web, node, React Native).

The short-term goal is to have a dedicated React Native library free from any platform-specific installations (the previous client library is a wrapper for the posthog-ios and posthog-android libraries). This enables a few things:

  1. Installation to Expo managed projects without any separate compilation / ejecting
  2. Tighter integration to RN enabling hooks, context, autocapture etc.

Changelog

Find the changelogs for the respective libraries in their folders:

  1. posthog-node
  2. posthog-react-native
  3. posthog-web

Development

This repository is broken into different packages

  • /posthog-core > All common code goes here.
  • /posthog-node > Node.js specific code
  • /posthog-react-native > React Native specific code
  • /posthog-web > Web (DOM) specific code

Running tests

yarn test
# Run the RN tests - these are separate due to specific babel configs
yarn test:rn

Running E2E tests with Detox

See Example Expo Readme

Examples

React Native

cd examples/example-expo
yarn && yarn start

Node.js

First install yalc:

yarn global add yalc

Then run:

cd examples/example-node
yarn && yarn start
# example-expo has some buttons that will talk to this server

Publishing a new version

  1. Go to the appropriate package.json file. For example, for posthog-node, this is posthog-node/package.json.
  2. Bump the version number in the file.
  3. Add to CHANGELOG.md the relevant changes.
  4. On merge, a new version is published automatically thanks to the CI pipeline.

About

Reimplementation of posthog-js to be as light and modular as possible.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.2%
  • JavaScript 1.8%