Skip to content

[eas-cli] Add integrations:posthog:connect#3836

Draft
gwdp wants to merge 2 commits into
gwdp/posthog-m3a-graphqlfrom
gwdp/posthog-m3b-connect
Draft

[eas-cli] Add integrations:posthog:connect#3836
gwdp wants to merge 2 commits into
gwdp/posthog-m3a-graphqlfrom
gwdp/posthog-m3b-connect

Conversation

@gwdp

@gwdp gwdp commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Why

Connect an Expo app to PostHog in one command. It provisions the PostHog project, asks which features you want, installs the SDK, and writes the env vars — so analytics / session replay / error tracking work after a build.

How

Fast-forward order — provision first, then ask what to wire up:

  1. Provision — reuses your account's PostHog org + this app's project, or creates them. Only a brand-new connection asks a question: region (US / EU), which sets data residency and can't be changed later.
  2. Pick features — a multiselect, all preselected: Analytics, Session replay, Error tracking (source maps, requires a personal API key).
  3. Error tracking, if selected — prompts you to paste a PostHog personal API key (we can't mint it — you create it in PostHog and paste it in).

It then:

  • Installs posthog-react-native (+ expo-file-system, expo-application, expo-device, expo-localization; plus posthog-react-native-session-replay when replay is on) via npx expo install
  • Adds the posthog-react-native/expo config plugin (prints manual steps if your app config is dynamic)
  • Writes env vars to .env.local (local dev) and EAS (Production / Preview / Development):
    • Analytics → EXPO_PUBLIC_POSTHOG_API_KEY, EXPO_PUBLIC_POSTHOG_HOST (public)
    • Error tracking → POSTHOG_CLI_API_KEY (sensitive), POSTHOG_CLI_PROJECT_ID, POSTHOG_CLI_HOST (public)
  • Source-map uploads on builds are covered by our guide; the command just sets the POSTHOG_CLI_* vars.

Flags: --region, --session-replay / --no-session-replay, --error-tracking / --no-error-tracking, --posthog-cli-api-key, --overwrite, plus --json / --non-interactive. Agent-ready: error tracking auto-skips without a key (or pass --posthog-cli-api-key); --error-tracking without a key fails before provisioning; --region is required non-interactively.

Test Plan

  • CI — 34 unit tests, full coverage of connect.ts
  • Live run needs the universe PostHog backend deployed

@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch from 0a4e058 to 9ac957d Compare June 10, 2026 06:57
@gwdp gwdp force-pushed the gwdp/posthog-m3a-graphql branch from bf35e3a to 49a8f7b Compare June 12, 2026 05:09
@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch 2 times, most recently from 7ddf04d to 2467434 Compare June 12, 2026 05:30
@gwdp gwdp force-pushed the gwdp/posthog-m3a-graphql branch from 49a8f7b to cabef9c Compare June 12, 2026 17:51
@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch from 2467434 to 891d769 Compare June 12, 2026 17:51
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.65%. Comparing base (70411c8) to head (553dccc).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           gwdp/posthog-m3a-graphql    #3836      +/-   ##
============================================================
+ Coverage                     58.43%   58.65%   +0.23%     
============================================================
  Files                           917      922       +5     
  Lines                         39999    40255     +256     
  Branches                       8419     8470      +51     
============================================================
+ Hits                          23368    23607     +239     
- Misses                        16536    16553      +17     
  Partials                         95       95              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch 2 times, most recently from 9e9abf4 to 59db163 Compare June 13, 2026 00:18
@gwdp gwdp changed the title [eas-cli] Add integrations:posthog:connect (core provision flow) [eas-cli] Add integrations:posthog:connect Jun 13, 2026
@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch from fb71761 to d577dc9 Compare June 13, 2026 19:40
@gwdp gwdp force-pushed the gwdp/posthog-m3a-graphql branch from cabef9c to 70411c8 Compare June 14, 2026 06:41
@gwdp gwdp force-pushed the gwdp/posthog-m3b-connect branch from d577dc9 to 553dccc Compare June 14, 2026 06:41
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant