Skip to content

Commit c01c1ec

Browse files
B4nanclaude
andcommitted
chore: migrate to pnpm and enable minimum release age
Migrates actor-scraper from npm workspaces to pnpm workspaces and adds a 1-day minimum release age supply-chain guard at the package manager layer (pnpm-workspace.yaml) and at the Renovate layer. Internal `@apify/*` and `@crawlee/*` packages are whitelisted at both layers for immediate updates. Notable changes: - package.json: drop "workspaces" (moved to pnpm-workspace.yaml); set packageManager to pnpm@10.24.0; add @isaacs/brace-expansion as explicit root devDep (pnpm 10 doesn't pull it transitively for minimatch@10 which actor-scraper-sitemap depends on) - lerna.json: npmClient: "pnpm" - .npmrc: node-linker=hoisted + link-workspace-packages=true + prefer-workspace-packages=true (flat layout for debugging + prefer workspace packages over registry) - packages/actor-scraper/*/package.json: use "workspace:*" protocol for @apify/scraper-tools so pnpm links the workspace copy instead of fetching the identical version from npm (required for consistent peer-dep resolution across workspace and registry types) - packages/scraper-tools/src/browser_tools.ts: relax Page interface exposeFunction return type from Promise<void> to Promise<unknown> so it accepts both Puppeteer (Promise<void>) and newer Playwright (Promise<Disposable>) page types. Return value is unused. - New .github/actions/pnpm-install composite action adopts the caching pattern from apify/apify-cli#1068 (pnpm store cache keyed by year-month + lockfile hash) - CI workflows: delegate install to the composite; drop the separate npm cache config on setup-node - renovate.json: minimumReleaseAge "1 day", internalChecksFilter "strict", @apify/* and @crawlee/* whitelist; drop npm constraint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3b0143c commit c01c1ec

20 files changed

Lines changed: 11998 additions & 19582 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "pnpm install"
2+
description: "Run pnpm install with cache enabled"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up swap space
7+
if: runner.os == 'Linux'
8+
uses: pierotofy/set-swap-space@v1.0
9+
with:
10+
swap-size-gb: 10
11+
12+
- uses: pnpm/action-setup@v4.1.0
13+
name: Install pnpm
14+
with:
15+
run_install: false
16+
17+
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
18+
id: pnpm-config
19+
shell: bash
20+
run: |
21+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
22+
23+
- name: Cache rotation keys
24+
id: cache-rotation
25+
shell: bash
26+
run: |
27+
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
28+
29+
- uses: actions/cache@v4
30+
name: Setup pnpm cache
31+
with:
32+
path: ${{ steps.pnpm-config.outputs.STORE_PATH }}
33+
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
36+
37+
- name: Install dependencies
38+
shell: bash
39+
run: |
40+
pnpm install --frozen-lockfile --prefer-offline --loglevel error
41+
env:
42+
HUSKY: "0"

.github/workflows/on-pull-request.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,15 @@ jobs:
2222
uses: actions/setup-node@v6
2323
with:
2424
node-version: 24
25-
cache: 'npm'
26-
cache-dependency-path: 'package-lock.json'
2725

28-
- name: Install Dependencies
29-
run: |
30-
npm ci
26+
- name: Install pnpm and dependencies
27+
uses: ./.github/actions/pnpm-install
3128

3229
- name: Build
33-
run: npm run ci:build
30+
run: pnpm ci:build
3431

3532
- name: Tests
36-
run: npm test
33+
run: pnpm test
3734

3835
lint:
3936
name: Lint
@@ -46,14 +43,12 @@ jobs:
4643
uses: actions/setup-node@v6
4744
with:
4845
node-version: 24
49-
cache: 'npm'
50-
cache-dependency-path: 'package-lock.json'
5146

52-
- name: Install Dependencies
53-
run: npm ci
47+
- name: Install pnpm and dependencies
48+
uses: ./.github/actions/pnpm-install
5449

5550
- name: ESLint
56-
run: npm run lint
51+
run: pnpm lint
5752

5853
- name: Prettier
59-
run: npm run format:check
54+
run: pnpm format:check

.github/workflows/test-e2e.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
- cron: '0 2 * * *'
1111

1212
jobs:
13-
# NPM install is done in a separate job and cached to speed up the following jobs.
1413
build_and_test:
1514
name: Build & Test
1615
runs-on: ubuntu-22.04
@@ -28,8 +27,6 @@ jobs:
2827
uses: actions/setup-node@v6
2928
with:
3029
node-version: 24
31-
cache: 'npm'
32-
cache-dependency-path: 'package-lock.json'
3330

3431
- name: Turbo cache
3532
id: turbo-cache
@@ -40,13 +37,13 @@ jobs:
4037
restore-keys: |
4138
turbo-${{ github.job }}-${{ github.ref_name }}-
4239
43-
- name: Install Dependencies
44-
run: npm ci
40+
- name: Install pnpm and dependencies
41+
uses: ./.github/actions/pnpm-install
4542

4643
- name: Build
47-
run: npm run ci:build
44+
run: pnpm ci:build
4845

4946
- name: Test
50-
run: npm run test:e2e
47+
run: pnpm test:e2e
5148
env:
5249
APIFY_TOKEN: ${{ secrets.APIFY_SCRAPER_TESTS_API_TOKEN }}

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node-linker=hoisted
2+
link-workspace-packages=true
3+
prefer-workspace-packages=true

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
.husky/pre-commit
22
.prettierignore
3+
4+
# pnpm
5+
pnpm-lock.yaml
6+
pnpm-workspace.yaml
7+
.github/actions/pnpm-install/action.yml

lerna.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
}
1313
},
1414
"useNx": false,
15+
"npmClient": "pnpm",
1516
"ignoreChanges": ["**/test/**", "**/*.md"]
1617
}

0 commit comments

Comments
 (0)