Skip to content

Commit aec2e07

Browse files
joshsnyjonathanlabk11kirky
authored
feat: monorepo (#153)
Co-authored-by: Jonathan Mieloo <[email protected]> Co-authored-by: Peter Kirkham <[email protected]>
1 parent c1c8a41 commit aec2e07

File tree

333 files changed

+11226
-2078
lines changed

Some content is hidden

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

333 files changed

+11226
-2078
lines changed

.claude/CLAUDE.md

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check-package-version:
14+
name: Check package version and detect an update
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
outputs:
19+
committed-version: ${{ steps.check-package-version.outputs.committed-version }}
20+
published-version: ${{ steps.check-package-version.outputs.published-version }}
21+
is-new-version: ${{ steps.check-package-version.outputs.is-new-version }}
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Check package version and detect an update
27+
id: check-package-version
28+
uses: PostHog/check-package-version@v2
29+
with:
30+
path: packages/agent
31+
32+
release:
33+
name: Publish release if new version
34+
runs-on: ubuntu-latest
35+
needs: check-package-version
36+
if: needs.check-package-version.outputs.is-new-version == 'true'
37+
permissions:
38+
contents: read
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
43+
- name: Setup pnpm
44+
uses: pnpm/action-setup@v4
45+
with:
46+
version: 10.14.0
47+
- name: Setup Node.js
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 22
51+
registry-url: https://registry.npmjs.org
52+
cache: "pnpm"
53+
- name: Install dependencies
54+
run: pnpm install --frozen-lockfile
55+
56+
- name: Build the package
57+
run: pnpm --filter agent run build
58+
59+
- name: Publish the package to npm registry
60+
working-directory: packages/agent
61+
run: npm publish
62+
env:
63+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
64+

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: 'pnpm'
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
- name: Build agent
30+
run: pnpm --filter agent build
31+
- name: Build array
32+
run: pnpm --filter array build

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: |
3333
VERSION="${{ inputs.tag }}"
3434
if [ -z "$VERSION" ]; then
35-
VERSION=$(jq -r .version package.json)
35+
VERSION=$(jq -r .version apps/array/package.json)
3636
fi
3737
VERSION="${VERSION#v}"
3838
if [ -z "$VERSION" ]; then
@@ -52,8 +52,8 @@ jobs:
5252
echo "should_publish=false" >> "$GITHUB_OUTPUT"
5353
exit 0
5454
fi
55-
CURRENT_VERSION=$(jq -r .version package.json)
56-
PREVIOUS_VERSION=$(git show HEAD~1:package.json | jq -r .version)
55+
CURRENT_VERSION=$(jq -r .version apps/array/package.json)
56+
PREVIOUS_VERSION=$(git show HEAD~1:apps/array/package.json | jq -r .version)
5757
if [ "$CURRENT_VERSION" = "$PREVIOUS_VERSION" ]; then
5858
echo "Version unchanged ($CURRENT_VERSION), skipping publish."
5959
echo "should_publish=false" >> "$GITHUB_OUTPUT"
@@ -93,10 +93,10 @@ jobs:
9393
with:
9494
node-version: 22
9595
cache: "pnpm"
96-
- name: Setup workspace
97-
run: bin/setup
9896
- name: Install dependencies
9997
run: pnpm install --frozen-lockfile
98+
- name: Build agent package
99+
run: pnpm --filter @posthog/agent run build
100100
- name: Import code signing certificate
101101
if: env.APPLE_CODESIGN_IDENTITY != ''
102102
env:
@@ -119,7 +119,7 @@ jobs:
119119
rm "$RUNNER_TEMP/certificate.p12"
120120
- name: Verify package version
121121
run: |
122-
PACKAGE_VERSION=$(jq -r .version package.json)
122+
PACKAGE_VERSION=$(jq -r .version apps/array/package.json)
123123
if [ "$PACKAGE_VERSION" != "$APP_VERSION" ]; then
124124
echo "Package version $PACKAGE_VERSION does not match expected $APP_VERSION"
125125
exit 1
@@ -137,6 +137,6 @@ jobs:
137137
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} "$TAG"
138138
fi
139139
- name: Build native modules
140-
run: pnpm run build-native
140+
run: pnpm --filter array run build-native
141141
- name: Publish with Electron Forge
142-
run: pnpm run publish
142+
run: pnpm --filter array run publish

.github/workflows/typecheck.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ jobs:
1515
persist-credentials: false
1616
- name: Setup pnpm
1717
uses: pnpm/action-setup@v4
18+
with:
19+
version: 10.14.0
1820
- name: Setup Node.js
1921
uses: actions/setup-node@v4
2022
with:
23+
node-version: 22
2124
cache: 'pnpm'
22-
- name: Setup workspace
23-
run: bin/setup
2425
- name: Install dependencies
2526
run: pnpm install --frozen-lockfile
2627
- name: Run type check

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ AGENTS.md
3131
.claude/
3232
.claude-config/
3333

34-
pnpm-workspace.yaml
35-
3634
**.car
3735

3836
.envrc

.husky/pre-commit

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
11
#!/bin/bash
22

3-
# Load .env file if it exists
4-
if [ -f .env ]; then
5-
export $(grep -v '^#' .env | grep -v '^[[:space:]]*$' | xargs 2>/dev/null)
6-
fi
7-
8-
# Check if AGENT_PACKAGE_LOCATION is set and lockfile is being committed
9-
if [ -n "$AGENT_PACKAGE_LOCATION" ]; then
10-
if git diff --cached --name-only | grep -q "pnpm-lock.yaml"; then
11-
echo "❌ Error: Cannot commit pnpm-lock.yaml when AGENT_PACKAGE_LOCATION is set"
12-
echo " You have a local agent override active in .env"
13-
echo " Either:"
14-
echo " - Comment out AGENT_PACKAGE_LOCATION in .env and run bin/setup"
15-
echo " - Unstage pnpm-lock.yaml: git reset pnpm-lock.yaml"
16-
exit 1
17-
fi
18-
fi
19-
203
pnpm lint-staged

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node-linker=hoisted
1+
node-linker=hoisted

.posthog/.gitignore

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

0 commit comments

Comments
 (0)