Skip to content

Commit a57fcd3

Browse files
B4nanclaude
andauthored
chore(website): migrate to pnpm and enable minimum release age (#855)
## Summary Migrates the `website/` subdirectory from Yarn 4 to pnpm 10 as part of an org-wide supply-chain hardening migration. The Python root (managed by uv) is unchanged. Enables pnpm's `minimumReleaseAge` (1 day / 1440 minutes) to block installing packages published within the last 24h, with exclusions for first-party scopes `@apify/*` and `@crawlee/*`. Renovate is updated with `internalChecksFilter: strict` and a matching 0-day package rule so our own releases are not held back. ## Changes - **website/package.json** — `packageManager` now `pnpm@10.24.0`; adds `name: apify-sdk-python-website` and `private: true`; all scripts rewritten from `yarn X` to `pnpm X` - **website/pnpm-workspace.yaml** (new) — `minimumReleaseAge: 1440` plus exclusions for `@apify/*` and `@crawlee/*` - **website/.npmrc** (new) — `node-linker=hoisted` + workspace hoisting settings to mirror the previous yarn `node-modules` layout - **website/.yarnrc.yml, website/yarn.lock** — removed (no `.yarn/patches/` existed in this repo, so nothing was preserved) - **website/pnpm-lock.yaml** (new) — generated via `pnpm install` - **website/docusaurus.config.js** — renamed `future.experimental_faster` -> `future.faster` (Docusaurus 3.10 rename, forward-compatible) - **.github/actions/pnpm-install/action.yml** (new) — composite action copied from `apify-client-js`, extended with a `working-directory` input so it can install inside `website/` without changing the caller's default directory - **.github/workflows/_release_docs.yaml** — `git add website/yarn.lock` -> `git add website/pnpm-lock.yaml` in the auto-commit step of the docs-theme update - **.github/workflows/manual_release_stable.yaml** — removed `corepack enable && yarn install`, installs via the new composite action with `working-directory: website`; `npx docusaurus` -> `pnpm exec docusaurus` - **pyproject.toml** — poe tasks `update-docs-theme`, `build-docs`, `run-docs` now invoke `pnpm` directly (no more `corepack enable && yarn`) - **renovate.json** — adds `internalChecksFilter: strict` and a `packageRule` matching `@apify/*` / `@crawlee/*` with `minimumReleaseAge: 0 days`. `ignoreDeps` unchanged (did not contain `yarn`). - **.gitignore** — replaced `website/.yarn` with `website/.pnpm-store` ## Verification - `pnpm install` and `pnpm install --frozen-lockfile` both succeed in `website/` - Existing peer-dependency warnings (eslint v10, typescript v6, styled-components) pre-date this migration and are carried over unchanged - Local docusaurus build was attempted but could not complete outside CI because the typedoc plugin spawns `python` (not `python3`) and this laptop doesn't expose `python` on PATH; in CI `actions/setup-python` provides `python` so this will resolve there. This is orthogonal to the pnpm migration. - `pnpm lint` surfaces an eslint v10 flat-config error that pre-dates this PR (no `eslint.config.js` present). Not introduced here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a5413b5 commit a57fcd3

11 files changed

Lines changed: 17518 additions & 18487 deletions

.github/workflows/manual_release_docs.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,18 @@ jobs:
5555
- name: Install Python dependencies
5656
run: uv run poe install-dev
5757

58+
- name: Install pnpm and website dependencies
59+
uses: apify/workflows/pnpm-install@main
60+
with:
61+
working-directory: website
62+
5863
- name: Update docs theme
5964
run: uv run poe update-docs-theme
6065

6166
- name: Commit the updated package.json and lockfile
6267
uses: EndBug/add-and-commit@v10
6368
with:
64-
add: website/package.json website/yarn.lock
69+
add: website/package.json website/pnpm-lock.yaml
6570
message: "chore: Automatic docs theme update [skip ci]"
6671
default_author: github_actions
6772
# `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push.

.github/workflows/manual_version_docs.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,21 @@ jobs:
3636
permissions:
3737
contents: write
3838

39+
defaults:
40+
run:
41+
working-directory: website
42+
3943
steps:
44+
- name: Determine checkout ref
45+
id: resolve_ref
46+
working-directory: .
47+
env:
48+
INPUT_REF: ${{ inputs.ref }}
49+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
50+
run: |
51+
REF="${INPUT_REF:-$DEFAULT_BRANCH}"
52+
echo "ref=$REF" >> "$GITHUB_OUTPUT"
53+
4054
- name: Checkout repository
4155
uses: actions/checkout@v6
4256
with:
@@ -60,14 +74,16 @@ jobs:
6074

6175
- name: Install Python dependencies
6276
run: uv run poe install-dev
77+
working-directory: .
78+
79+
- name: Install pnpm and website dependencies
80+
uses: apify/workflows/pnpm-install@main
81+
with:
82+
working-directory: website
6383

6484
- name: Snapshot the current version
6585
id: snapshot
6686
run: |
67-
cd website
68-
corepack enable
69-
yarn install
70-
7187
# Extract version from pyproject.toml.
7288
FULL_VERSION="$(uv version --short)"
7389
MAJOR_MINOR_VERSION="$(echo "$FULL_VERSION" | cut -d. -f1-2)"
@@ -98,8 +114,8 @@ jobs:
98114
99115
# Build API reference and create Docusaurus version snapshots.
100116
bash build_api_reference.sh
101-
uv run npx docusaurus docs:version "$MAJOR_MINOR_VERSION"
102-
uv run npx docusaurus api:version "$MAJOR_MINOR_VERSION"
117+
pnpm exec docusaurus docs:version "$MAJOR_MINOR_VERSION"
118+
pnpm exec docusaurus api:version "$MAJOR_MINOR_VERSION"
103119
104120
- name: Commit and push versioned docs
105121
id: commit_versioned_docs
@@ -110,6 +126,7 @@ jobs:
110126
default_author: github_actions
111127
# `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push.
112128
new_branch: ${{ github.event.repository.default_branch }}
129+
pull: '--rebase --autostash'
113130

114131
- name: Resolve output commitish
115132
id: resolve_commitish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ website/versioned_docs/*/pyproject.toml
6969
# Website build artifacts, node dependencies
7070
website/build
7171
website/node_modules
72+
website/yarn.lock
7273
website/.yarn
7374
website/.docusaurus
7475
website/api-typedoc-generated.json

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ context = 7
228228
# Minimal defense against supply-chain attacks.
229229
exclude-newer = "24 hours"
230230

231+
[tool.uv.exclude-newer-package]
232+
# Allow internal Apify packages to install immediately.
233+
apify-client = false
234+
apify-shared = false
235+
apify_fingerprint_datapoints = false
236+
crawlee = false
237+
231238
# Run tasks with: uv run poe <task>
232239
[tool.poe.tasks]
233240
clean = "rm -rf .coverage .pytest_cache .ruff_cache .ty_cache build dist htmlcov"
@@ -253,13 +260,13 @@ shell = "uv run ruff format --check && uv run ruff check"
253260
shell = "uv run ruff check --fix && uv run ruff format"
254261

255262
[tool.poe.tasks.update-docs-theme]
256-
shell = "corepack enable && yarn up @apify/docs-theme"
263+
shell = "pnpm update @apify/docs-theme"
257264
cwd = "website"
258265

259266
[tool.poe.tasks.build-docs]
260-
shell = "./build_api_reference.sh && corepack enable && yarn && uv run yarn build"
267+
shell = "./build_api_reference.sh && pnpm install && uv run pnpm build"
261268
cwd = "website"
262269

263270
[tool.poe.tasks.run-docs]
264-
shell = "./build_api_reference.sh && corepack enable && yarn && uv run yarn start"
271+
shell = "./build_api_reference.sh && pnpm install && uv run pnpm start"
265272
cwd = "website"

renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
"groupSlug": "dev-dependencies",
2020
"automerge": true,
2121
"automergeType": "branch"
22+
},
23+
{
24+
"matchPackageNames": ["@apify/*", "@crawlee/*", "apify", "apify-client", "apify-shared", "apify-fingerprint-datapoints", "crawlee", "got-scraping"],
25+
"minimumReleaseAge": "0 days"
2226
}
2327
],
2428
"minimumReleaseAge": "1 day",
29+
"internalChecksFilter": "strict",
2530
"schedule": ["before 7am every weekday"],
2631
"ignoreDeps": ["apify", "docusaurus-plugin-typedoc-api"]
2732
}

website/.yarnrc.yml

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

website/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = {
4444
scripts: ['/js/custom.js', ...(config.scripts ?? [])],
4545
githubHost: 'github.com',
4646
future: {
47-
experimental_faster: {
47+
faster: {
4848
// ssgWorkerThreads: true,
4949
swcJsLoader: true,
5050
swcJsMinimizer: true,

website/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
2-
"name": "apify-sdk-python",
2+
"name": "apify-sdk-python-website",
3+
"private": true,
34
"scripts": {
45
"clean": "rimraf .docusaurus build",
5-
"build": "yarn clean && docusaurus build",
6-
"start": "yarn clean && docusaurus start",
7-
"deploy": "yarn clean && docusaurus deploy",
6+
"build": "pnpm clean && docusaurus build",
7+
"start": "pnpm clean && docusaurus start",
8+
"deploy": "pnpm clean && docusaurus deploy",
89
"docusaurus": "docusaurus",
910
"publish-gh-pages": "docusaurus-publish",
1011
"rename-version": "docusaurus rename-version",
1112
"swizzle": "docusaurus swizzle",
1213
"version": "docusaurus version",
1314
"write-translations": "docusaurus write-translations",
1415
"prettify": "prettier --write --config ./tools/docs-prettier.config.js ../docs/*.md ../docs/*.mdx",
15-
"lint": "yarn lint:code",
16-
"lint:fix": "yarn lint:code:fix",
16+
"lint": "pnpm lint:code",
17+
"lint:fix": "pnpm lint:code:fix",
1718
"lint:code": "eslint .",
18-
"lint:code:fix": "eslint . --fix"
19+
"lint:code:fix": "eslint . --fix",
20+
"preinstall": "npx only-allow pnpm"
1921
},
2022
"dependencies": {
2123
"@apify/docs-theme": "^1.0.243",
@@ -47,5 +49,5 @@
4749
"rimraf": "^6.0.0",
4850
"typescript": "^6.0.0"
4951
},
50-
"packageManager": "yarn@4.13.0"
52+
"packageManager": "pnpm@10.24.0"
5153
}

0 commit comments

Comments
 (0)