Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .github/scripts/before-beta-release.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ pkgJson.version = nextVersion;
fs.writeFileSync(PKG_JSON_PATH, `${JSON.stringify(pkgJson, null, 2)}\n`);

function getNextVersion(version) {
const versionString = execSync(`npm show ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });
// `pnpm view` matches `npm view`/`npm show` semantics; using pnpm here keeps
// the toolchain consistent with the rest of the workflow.
const versionString = execSync(`pnpm view ${PACKAGE_NAME} versions --json`, { encoding: 'utf8' });
const versions = JSON.parse(versionString);

if (versions.some((v) => v === VERSION)) {
Expand Down
47 changes: 32 additions & 15 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
with:
node-version: 24

- name: Install Dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

- name: Lint code
run: npm run lint
run: pnpm run lint

unit:
name: Unit tests (Node.js ${{ matrix.node-version }})
Expand All @@ -51,6 +51,12 @@ jobs:
strategy:
fail-fast: false
matrix:
# pnpm 10 supports Node ≥18, so Node 20 stays in the matrix.
# Node 26 is intentionally NOT here yet: a pre-existing tsx + yargs (16.x
# CJS bin) + Node 26 ESM-loader incompatibility breaks `mocha` under the
# repo's `node-option: ["import=tsx"]` config. Reproducible on `master`
# with plain `npm install`, so it's not a migration regression — but the
# fix belongs in a separate change.
node-version: [20, 22, 24]

steps:
Expand All @@ -62,11 +68,11 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

- name: Run unit tests
run: npm run test:unit
run: pnpm run test:unit

e2e:
name: E2E tests (Node.js 24)
Expand All @@ -82,14 +88,21 @@ jobs:
with:
node-version: 24

- name: Install Dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

# pnpm caches the package store but not puppeteer's browser cache
# (`~/.cache/puppeteer/`). On warm-cache CI runs, pnpm just symlinks
# from the store and skips re-running `postinstall`, so the Chromium
# download never happens. `pnpm rebuild` forces the script to run.
- name: Ensure puppeteer Chromium is downloaded
run: pnpm rebuild puppeteer

- name: Add localhost-test to Linux hosts file
run: sudo echo "127.0.0.1 localhost-test" | sudo tee -a /etc/hosts

- name: Run E2E tests
run: npm run test:e2e
run: pnpm run test:e2e

bun_unit:
name: Unit tests (Bun)
Expand All @@ -111,11 +124,11 @@ jobs:
with:
bun-version: latest

- name: Install Dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

- name: Run unit tests with Bun
run: npm run test:bun
run: pnpm run test:bun

bun_e2e:
name: E2E tests (Bun, ${{ inputs.bun_e2e_mode || 'compatible' }})
Expand All @@ -137,11 +150,15 @@ jobs:
with:
bun-version: latest

- name: Install Dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

# See note on the Node E2E job — same fix needed here.
- name: Ensure puppeteer Chromium is downloaded
run: pnpm rebuild puppeteer

- name: Add localhost-test to Linux hosts file
run: sudo echo "127.0.0.1 localhost-test" | sudo tee -a /etc/hosts

- name: Run E2E tests (Bun, ${{ inputs.bun_e2e_mode || 'compatible' }})
run: npm run test:bun:e2e:${{ inputs.bun_e2e_mode || 'compatible' }}
run: pnpm run test:bun:e2e:${{ inputs.bun_e2e_mode || 'compatible' }}
11 changes: 8 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ jobs:
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm install
- name: Install pnpm and dependencies
uses: apify/actions/pnpm-install@v1.1.2

# Determine if this is a beta or latest release
- name: Get release tag
Expand All @@ -46,8 +47,12 @@ jobs:
if: steps.get_release_tag.outputs.release_tag == 'beta'
run: node ./.github/scripts/before-beta-release.cjs

# `pnpm publish` honours the dist-tag flag and keeps the workflow on a
# single package manager. `--no-git-checks` is required because the
# `release` event checks out a tag in detached HEAD, which trips pnpm's
# default "publish only from a tracked branch" guard.
- name: Publish to NPM
run: npm publish --tag ${{ steps.get_release_tag.outputs.release_tag }}
run: pnpm publish --tag ${{ steps.get_release_tag.outputs.release_tag }} --no-git-checks

# Latest version is tagged by the release process so we only tag beta here.
- name: Tag version
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"build:watch": "tsc -w",
"build": "tsc",
"clean": "rimraf dist",
"prepublishOnly": "npm run build",
"prepublishOnly": "pnpm run build",
"local-proxy": "tsx test/utils/run_locally.js",
"test": "nyc cross-env NODE_OPTIONS=--insecure-http-parser mocha 'test/unit/**/*.js' 'test/e2e/**/*.js'",
"test:unit": "mocha 'test/unit/**/*.js'",
Expand All @@ -58,6 +58,14 @@
"engines": {
"node": ">=20.11"
},
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": "10.33.4",
"onFail": "error"
}
},
"packageManager": "pnpm@10.33.4",
"devDependencies": {
"@apify/eslint-config": "^1.0.0",
"@apify/tsconfig": "^0.1.0",
Expand Down
Loading
Loading