Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4fe099b
start pnpm work
daniel-graham-amplitude Dec 22, 2025
0431f97
chore: migrate to PNPM
daniel-graham-amplitude Dec 23, 2025
4df0188
again
daniel-graham-amplitude Dec 23, 2025
4f79de7
again
daniel-graham-amplitude Dec 23, 2025
cbf5e0b
again
daniel-graham-amplitude Dec 23, 2025
f25343c
again
daniel-graham-amplitude Dec 23, 2025
7e55407
again
daniel-graham-amplitude Dec 23, 2025
38405c5
again
daniel-graham-amplitude Dec 23, 2025
75c052f
again
daniel-graham-amplitude Dec 23, 2025
073e9b3
again
daniel-graham-amplitude Dec 23, 2025
47fccf4
again
daniel-graham-amplitude Dec 23, 2025
463e38e
again
daniel-graham-amplitude Dec 23, 2025
c09eb93
again
daniel-graham-amplitude Dec 23, 2025
1d199c6
again
daniel-graham-amplitude Dec 23, 2025
fd30b50
again
daniel-graham-amplitude Dec 23, 2025
a7cdb0a
again
daniel-graham-amplitude Dec 23, 2025
b8b9cfc
Revert "again"
daniel-graham-amplitude Dec 23, 2025
b495ba7
fix broken tests: 3/9
daniel-graham-amplitude Dec 24, 2025
e787ff8
test fixes: round 2
daniel-graham-amplitude Dec 24, 2025
1f5e4d0
again
daniel-graham-amplitude Dec 24, 2025
9be3a30
again
daniel-graham-amplitude Dec 24, 2025
28756d4
again
daniel-graham-amplitude Dec 24, 2025
1b17da4
again
daniel-graham-amplitude Dec 24, 2025
2b44bf5
again
daniel-graham-amplitude Dec 24, 2025
ac986e6
chore: tweak tsconfig.json
daniel-graham-amplitude Dec 24, 2025
2e7de44
again
daniel-graham-amplitude Dec 24, 2025
df621ba
replace yarn build from package.json
daniel-graham-amplitude Dec 24, 2025
93b19e5
again
daniel-graham-amplitude Dec 24, 2025
a552c71
Merge branch 'pnpm-migration' of github.com:amplitude/Amplitude-TypeS…
daniel-graham-amplitude Dec 24, 2025
339b28d
again
daniel-graham-amplitude Dec 24, 2025
62e3d69
again
daniel-graham-amplitude Dec 28, 2025
5b52a7d
again
daniel-graham-amplitude Dec 28, 2025
0c4d0d3
again
daniel-graham-amplitude Dec 28, 2025
70d1782
again
daniel-graham-amplitude Dec 28, 2025
d041513
again
daniel-graham-amplitude Dec 28, 2025
b9de0da
again
daniel-graham-amplitude Dec 28, 2025
cdd7000
again
daniel-graham-amplitude Dec 29, 2025
bc5b28f
again
daniel-graham-amplitude Dec 29, 2025
78400ed
again
daniel-graham-amplitude Dec 29, 2025
4306e42
again
daniel-graham-amplitude Dec 29, 2025
a44ab61
fix: pnpm hoisting problem with unified + setTransport
daniel-graham-amplitude Dec 29, 2025
add4784
again
daniel-graham-amplitude Dec 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .github/actions/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,31 @@ inputs:
runs:
using: "composite"
steps:
- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Setup Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
pnpm install --frozen-lockfile
shell: bash

- name: Build all packages
run: |
yarn build
pnpm build
shell: bash

- name: Test all packages
run: |
yarn test
pnpm test
shell: bash

- name: Lint all packages
run: |
yarn lint
pnpm lint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build action uses pnpm without installing it first

The composite action was updated to use pnpm install, pnpm build, pnpm test, and pnpm lint commands, but no step was added to install pnpm (using pnpm/action-setup@v4). The publish-v2.yml workflow uses this action without setting up pnpm first, which will cause the publish workflow to fail with "command not found" errors. Other workflows like ci.yml and ci-nx.yml were correctly updated to include the pnpm setup step, but this action was not.

Fix in Cursor Fix in Web

shell: bash

- name: Configure Git User
Expand Down
36 changes: 16 additions & 20 deletions .github/workflows/ci-nx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@ jobs:
- name: Check out git repository
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js 20
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Build all packages
run: |
yarn build
run: pnpm build

- name: Build docs
run: |
yarn docs:check
run: pnpm docs:check

build:
name: Build
Expand All @@ -65,20 +66,17 @@ jobs:
with:
fetch-depth: 0 # Required for NX affected commands

- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Set up NX base for affected commands
run: |
Expand All @@ -87,7 +85,7 @@ jobs:

- name: Build affected packages
run: |
yarn build:nx-affected
pnpm build:nx-affected

# https://github.com/amplitude/Amplitude-TypeScript/issues/281
- name: Check module dependencies
Expand All @@ -103,9 +101,7 @@ jobs:
fi

- name: Test affected packages
run: |
yarn test:nx-affected
run: pnpm test:nx-affected

- name: Lint affected packages
run: |
yarn lint:nx-affected
run: pnpm lint:nx-affected
20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@ jobs:
- name: Check out git repository
uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
pnpm install --frozen-lockfile

- name: Build all packages
run: |
yarn build
pnpm build

# https://github.com/amplitude/Amplitude-TypeScript/issues/281
- name: Check module dependencies
Expand All @@ -54,12 +52,12 @@ jobs:

- name: Build docs
run: |
yarn docs:check
pnpm docs:check

- name: Test all packages
run: |
yarn test
pnpm test

- name: Lint all packages
run: |
yarn lint
pnpm lint
9 changes: 6 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup
run: |
yarn
yarn build
yarn docs
pnpm install --frozen-lockfile
pnpm build
pnpm docs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.5
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,22 @@ jobs:
# git branch -f main origin/main
# fi

- name: Cache dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'pnpm'

- name: Install project dependencies
run: |
yarn install --frozen-lockfile
pnpm install --frozen-lockfile

- name: Build all packages
run: |
yarn build
pnpm build

- name: Create .env file
run: |
Expand All @@ -55,16 +53,16 @@ jobs:
- name: Start dev server
run: |
# Start the dev server
yarn build:vite
yarn start --port 5173 &
pnpm build:vite
pnpm start --port 5173 &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnpm won’t pass --port to the start script without --. Consider pnpm start -- --port 5173 so the arg reaches the app.

Suggested change
pnpm start --port 5173 &
pnpm start -- --port 5173 &

🚀 Want me to fix this? Reply ex: "fix it for me".

# Wait for the server to be ready
sleep 10
# Verify the server is running
curl -f http://localhost:5173 || exit 1

- name: Run Playwright tests
run: |
yarn test:playwright:ci
pnpm test:playwright:ci

- name: Upload Playwright Report
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-single-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:

# Setup Node.js environment
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
pnpm commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint:staged
pnpm lint:staged
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ This repository uses GitHub Actions for continuous integration. Contributors sho
Before running any tests or scripts, install dependencies and build the packages:

```bash
yarn install --frozen-lockfile
pnpm install
yarn build
```

## Testing and Linting

1. Install dependencies with `yarn install --frozen-lockfile`.
1. Install dependencies with `pnpm install`.
2. Build all packages with `yarn build`.
3. Verify documentation with `yarn docs:check`.
4. Run unit tests with `yarn test` and example tests with `yarn test:examples`.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Getting setup is quick and easy. Follow the steps below to get your your dev env

```
$ git clone <HTTPS_OR_GIT_URL>
$ yarn
$ yarn build
$ pnpm install
$ pnpm build
```

This repo contains mutliple major versions of all packages. For contributions to version `1.x`, create a branch off `v1.x`. For contributions to the `2.x` (latest) version, create a branch off `main`. Refer to the table below for more infomation about the release status of each package.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@
"dependencies": {
"tslib": "^2.4.1"
},
"packageManager": "yarn@1.22.19+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71"
"packageManager": "pnpm@10.26.1+sha512.664074abc367d2c9324fdc18037097ce0a8f126034160f709928e9e9f95d98714347044e5c3164d65bd5da6c59c6be362b107546292a8eecb7999196e5ce58fa"
}
3 changes: 2 additions & 1 deletion packages/analytics-browser-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.6.3-beta.0"
},
"devDependencies": {
"@amplitude/analytics-browser": "workspace:*",
"@amplitude/analytics-core": "workspace:*",
"nock": "^13.2.4"
}
}
3 changes: 1 addition & 2 deletions packages/analytics-browser-test/test/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { BaseEvent, Campaign } from '@amplitude/analytics-types';
import { BASE_CAMPAIGN } from '@amplitude/analytics-client-common';
import { BaseEvent, Campaign, BASE_CAMPAIGN } from '@amplitude/analytics-core';
import { uuidPattern } from './constants';

const uuid: string = expect.stringMatching(uuidPattern) as string;
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-browser-test/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { default as nock } from 'nock';
import { success } from './responses';
import 'isomorphic-fetch';
import { path, url, SUCCESS_MESSAGE, uuidPattern } from './constants';
import { LogLevel } from '@amplitude/analytics-types';
import { LogLevel } from '@amplitude/analytics-core';
import { UUID } from '@amplitude/analytics-core';

describe('integration', () => {
Expand Down
22 changes: 11 additions & 11 deletions packages/analytics-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@
"url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
},
"scripts": {
"build": "yarn bundle && yarn build:es5 && yarn build:esm",
"build": "pnpm bundle && pnpm build:es5 && pnpm build:esm",
"bundle": "rollup --config rollup.config.js",
"build:es5": "tsc -p ./tsconfig.es5.json",
"build:esm": "tsc -p ./tsconfig.esm.json",
"watch": "tsc -p ./tsconfig.esm.json --watch",
"clean": "rimraf node_modules lib coverage",
"fix": "yarn fix:eslint & yarn fix:prettier",
"fix": "pnpm fix:eslint & pnpm fix:prettier",
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
"lint": "yarn lint:eslint & yarn lint:prettier",
"lint": "pnpm lint:eslint & pnpm lint:prettier",
"lint:eslint": "eslint '{src,test}/**/*.ts'",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"playground:html": "cp lib/scripts/amplitude-min.js playground/html/amplitude.js && http-server ./playground/html",
"playground:react-spa": "cp lib/scripts/amplitude-min.js playground/react-spa/public/amplitude.js && cd ./playground/react-spa && yarn install && yarn start",
"playground:react-spa": "cp lib/scripts/amplitude-min.js playground/react-spa/public/amplitude.js && cd ./playground/react-spa && pnpm install && pnpm start",
"publish": "node ../../scripts/publish/upload-to-s3.js",
"test": "jest",
"test:playwright": "playwright test",
"typecheck": "tsc -p ./tsconfig.json",
"version": "yarn version-file && GENERATE_SNIPPET=true yarn build && cp lib/scripts/amplitude-min.js playground/html/amplitude.js && cp lib/scripts/amplitude-min.js playground/react-spa/public/amplitude.js",
"version": "pnpm version-file && GENERATE_SNIPPET=true pnpm build && cp lib/scripts/amplitude-min.js playground/html/amplitude.js && cp lib/scripts/amplitude-min.js playground/react-spa/public/amplitude.js",
"version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts"
},
"bugs": {
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
},
"dependencies": {
"@amplitude/analytics-core": "2.35.0",
"@amplitude/plugin-autocapture-browser": "1.18.3",
"@amplitude/plugin-network-capture-browser": "1.7.3",
"@amplitude/plugin-page-url-enrichment-browser": "0.5.9",
"@amplitude/plugin-page-view-tracking-browser": "2.6.6",
"@amplitude/plugin-web-vitals-browser": "1.1.3",
"@amplitude/analytics-core": "workspace:*",
"@amplitude/plugin-autocapture-browser": "workspace:*",
"@amplitude/plugin-network-capture-browser": "workspace:*",
"@amplitude/plugin-page-url-enrichment-browser": "workspace:*",
"@amplitude/plugin-page-view-tracking-browser": "workspace:*",
"@amplitude/plugin-web-vitals-browser": "workspace:*",
"tslib": "^2.4.1"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstanceProxy } from '@amplitude/analytics-types';
import { InstanceProxy } from '@amplitude/analytics-core';

declare global {
// globalThis only includes `var` declarations
Expand Down
Loading
Loading