Skip to content

Commit 5fcf6a6

Browse files
B4nanclaude
andcommitted
chore: migrate to pnpm and enable minimum release age
Migrates apify-client-js 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. The website/ directory becomes a proper workspace (previously had its own lockfile). Single root lockfile now. Notable changes: - package.json: set packageManager to pnpm@10.24.0; "npm run X" -> "pnpm X" in scripts - pnpm-workspace.yaml: packages [website], release-age settings - .npmrc: node-linker=hoisted, link-workspace-packages=true, prefer-workspace-packages=true, public-hoist-pattern[]=* (kept the pre-existing legacy-peer-deps=true) - website/package.json: add "name": "apify-client-website" so pnpm recognises it as a workspace; "npm run" -> "pnpm" in scripts - website/docusaurus.config.js: rename future.experimental_faster -> future.faster (renamed in Docusaurus 3.10, which is what pnpm resolves from the ^3.8.1 range; npm previously resolved 3.9.x via --force) - New .github/actions/pnpm-install composite action (cached pnpm store, keyed by year-month + lockfile hash — pattern from apify/apify-cli#1068) - All 5 CI workflows (check, docs, publish_to_npm, release, pre_release) use the composite; npm/npx/`npm version` -> pnpm equivalents. docs workflow's `npm update @apify/docs-theme` becomes `pnpm --filter apify-client-website update @apify/docs-theme`. publish uses `pnpm publish --tag X --no-git-checks`. - renovate.json: add minimumReleaseAge "1 day", internalChecksFilter "strict", @apify/* + @crawlee/* whitelist; drop old npm constraint - Both package-lock.json files deleted; single pnpm-lock.yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2db6722 commit 5fcf6a6

14 files changed

Lines changed: 19884 additions & 38548 deletions
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/check.yaml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ jobs:
3838
uses: actions/setup-node@v6
3939
with:
4040
node-version: ${{ matrix.node-version }}
41-
cache: 'npm'
42-
cache-dependency-path: 'package-lock.json'
4341

44-
- name: Install Dependencies
45-
run: npm ci
42+
- name: Install pnpm and dependencies
43+
uses: ./.github/actions/pnpm-install
4644

4745
- name: Run Tests
48-
run: npm test
46+
run: pnpm test
4947

5048
test_bundling:
5149
name: Test bundler support
@@ -77,13 +75,11 @@ jobs:
7775
uses: actions/setup-node@v6
7876
with:
7977
node-version: 24
80-
cache: 'npm'
81-
cache-dependency-path: 'package-lock.json'
82-
- name: Install Dependencies
83-
run: npm ci
84-
- run: npm run lint
78+
- name: Install pnpm and dependencies
79+
uses: ./.github/actions/pnpm-install
80+
- run: pnpm lint
8581
- name: Prettier
86-
run: npm run format:check
82+
run: pnpm format:check
8783

8884
docs:
8985
name: Docs build
@@ -97,15 +93,11 @@ jobs:
9793
uses: actions/setup-node@v6
9894
with:
9995
node-version: 24
100-
cache: 'npm'
101-
cache-dependency-path: 'package-lock.json'
102-
- name: Install Dependencies
103-
run: npm ci
96+
- name: Install pnpm and dependencies
97+
uses: ./.github/actions/pnpm-install
10498

105-
- name: Install & build & deploy docs
99+
- name: Build docs
106100
run: |
107-
npm ci --force
108101
cd website
109-
npm ci --force
110-
npm run lint
111-
npm run build
102+
pnpm lint
103+
pnpm build

.github/workflows/docs.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,30 @@ jobs:
2626
uses: actions/setup-node@v6
2727
with:
2828
node-version: 24
29-
cache: npm
30-
cache-dependency-path: website/package-lock.json
3129

3230
- name: Set git identity
3331
run: |
3432
git config user.name 'GitHub Actions'
3533
git config user.email 'github-actions[bot]@users.noreply.github.com'
3634
37-
- name: Install Node.js dependencies
38-
run: |
39-
npm install
40-
cd website
41-
npm install
42-
npm update @apify/docs-theme
35+
- name: Install pnpm and dependencies
36+
uses: ./.github/actions/pnpm-install
37+
38+
- name: Update docs theme
39+
run: pnpm --filter apify-client-website update @apify/docs-theme
4340

4441
# We do this as early as possible to prevent conflicts if someone else would push something in the meantime
4542
- name: Commit the updated package.json and lockfile
4643
run: |
4744
git config user.name 'GitHub Actions'
4845
git config user.email 'github-actions[bot]@users.noreply.github.com'
4946
git add website/package.json
50-
git add website/package-lock.json
47+
git add pnpm-lock.yaml
5148
git diff-index --quiet HEAD || git commit -m 'chore: Automatic theme updating workflow [skip ci]' || true
5249
git push
5350
5451
- name: Build Docusaurus docs
55-
run: npm run build
52+
run: pnpm build
5653
working-directory: ./website
5754
env:
5855
SMARTLOOK_PROJECT_KEY: ${{ secrets.SMARTLOOK_DOCS_PROJECT_KEY }}

.github/workflows/pre_release.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ jobs:
5757
with:
5858
node-version: 24
5959

60+
- name: Install pnpm
61+
uses: pnpm/action-setup@v4.1.0
62+
with:
63+
run_install: false
64+
6065
- name: Update package version in package.json
61-
run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
66+
run: pnpm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
6267

6368
- name: Update CHANGELOG.md
6469
uses: DamianReeves/write-file-action@master

.github/workflows/publish_to_npm.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@ jobs:
3333
with:
3434
node-version: 24
3535
registry-url: 'https://registry.npmjs.org'
36-
cache: 'npm'
37-
cache-dependency-path: 'package-lock.json'
38-
- name: Update npm
39-
run: npm install -g npm@latest
40-
- name: Install dependencies
41-
run: |
42-
npm ci
36+
- name: Install pnpm and dependencies
37+
uses: ./.github/actions/pnpm-install
4338
- name: Check version consistency and bump pre-release version (beta only)
4439
if: ${{ inputs.tag == 'beta' }}
4540
run: node ./.github/scripts/before-beta-release.js
4641
- name: Build module
47-
run: npm run build
42+
run: pnpm build
4843
- name: Publish to NPM
49-
run: npm publish --tag ${{ inputs.tag }}
44+
run: pnpm publish --tag ${{ inputs.tag }} --no-git-checks

.github/workflows/release.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ jobs:
6464
with:
6565
node-version: 24
6666

67+
- name: Install pnpm
68+
uses: pnpm/action-setup@v4.1.0
69+
with:
70+
run_install: false
71+
6772
- name: Update package version in package.json
68-
run: npm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
73+
run: pnpm version --no-git-tag-version --allow-same-version ${{ needs.release_metadata.outputs.version_number }}
6974

7075
- name: Update CHANGELOG.md
7176
uses: DamianReeves/write-file-action@master
@@ -125,16 +130,12 @@ jobs:
125130
uses: actions/setup-node@v6
126131
with:
127132
node-version: 24
128-
cache: 'npm'
129133

130134
- name: Install jq
131135
run: sudo apt-get install jq
132136

133-
- name: Install dependencies
134-
run: |
135-
npm install
136-
cd website
137-
npm install
137+
- name: Install pnpm and dependencies
138+
uses: ./.github/actions/pnpm-install
138139

139140
- name: Snapshot the current version
140141
run: |
@@ -144,10 +145,10 @@ jobs:
144145
rm -rf versioned_docs/version-$MAJOR
145146
rm -rf versioned_sidebars/version-$MAJOR-sidebars.json
146147
jq 'map(select(. != env.MAJOR))' versions.json > tmp.json && mv tmp.json versions.json
147-
npx docusaurus docs:version $MAJOR
148-
npx docusaurus api:version $MAJOR
148+
pnpm exec docusaurus docs:version $MAJOR
149+
pnpm exec docusaurus api:version $MAJOR
149150
cd ..
150-
npm run format
151+
pnpm format
151152
152153
- name: Commit and push the version snapshot
153154
uses: EndBug/add-and-commit@v10

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
node-linker=hoisted
2+
link-workspace-packages=true
3+
prefer-workspace-packages=true
4+
public-hoist-pattern[]=*
15
legacy-peer-deps=true

0 commit comments

Comments
 (0)