Skip to content

chore: migrate to pnpm and enable minimum release age#175

Open
B4nan wants to merge 10 commits intomasterfrom
chore/migrate-to-pnpm
Open

chore: migrate to pnpm and enable minimum release age#175
B4nan wants to merge 10 commits intomasterfrom
chore/migrate-to-pnpm

Conversation

@B4nan
Copy link
Copy Markdown
Member

@B4nan B4nan commented Apr 14, 2026

Summary

Part of the org-wide supply-chain hardening + pnpm migration. Migrates got-scraping from npm to pnpm and adds a 1-day minimum release age guard at two layers:

  • pnpm layerminimumReleaseAge: 1440 in pnpm-workspace.yaml blocks installs of versions < 1 day old
  • Renovate layerminimumReleaseAge: "1 day" delays PR creation
  • Internal allowlist@apify/* and @crawlee/* excluded at both layers

This repo previously had no Renovate config; a standard one is added.

Changes

  • package.json: packageManager: pnpm@10.24.0; engines.node >= 18 (pnpm 10 requires Node 18+, was >=16); npm runpnpm in scripts
  • pnpm-workspace.yaml: non-monorepo minimum release age settings only
  • .npmrc: node-linker=hoisted, link-workspace-packages=true, prefer-workspace-packages=true, public-hoist-pattern[]=* (the last one mirrors npm's transitive-type hoisting so tsc sees the same types)
  • tsconfig.json: skipLibCheck: true (standard; suppresses ow/quick-lru .d.ts incompatibilities with TS 5.9's MapIterator lib types)
  • src/agent/wrapped-agent.ts + src/index.ts: two small casts — same runtime behavior, satisfy stricter type resolution under pnpm that npm's hoisting happened to hide
  • New .github/actions/pnpm-install composite action (cached pnpm store, keyed by year-month + lockfile hash — pattern from chore: move to pnpm from yarn apify-cli#1068)
  • CI workflows: delegate install to composite; switch to pnpm publish --no-git-checks; Node matrix now 18/20/22/24
  • New renovate.json with minimumReleaseAge "1 day", internalChecksFilter "strict", @apify/* + @crawlee/* whitelist

🤖 Generated with Claude Code

Migrates got-scraping from npm to pnpm 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.

This repo previously had no Renovate config; a standard config is
added now.

Notable changes:
- package.json: set packageManager to pnpm@10.24.0; bump engines
  node >=18 (was >=16; pnpm 10 needs Node 18+); "npm run" -> "pnpm"
  in scripts
- pnpm-workspace.yaml: non-monorepo minimumReleaseAge settings only
- .npmrc: node-linker=hoisted + link-workspace-packages=true +
  prefer-workspace-packages=true + public-hoist-pattern[]=*
  (last one ensures transitive types are visible to tsc like they
  were under npm's hoisted layout)
- tsconfig.json: skipLibCheck: true (standard, suppresses
  ow/quick-lru d.ts incompatibilities with TS 5.9 lib types)
- src/agent/wrapped-agent.ts + src/index.ts: two small casts to
  satisfy stricter type resolution under pnpm (npm happened to
  hide these mismatches via different node_modules layout; the
  same code paths at runtime)
- New .github/actions/pnpm-install composite action (cached pnpm
  store, year-month + lockfile hash key — pattern from apify/apify-cli#1068)
- CI workflows (check.yml, release.yaml, publish-to-npm.yaml):
  delegate install to the composite; use pnpm/pnpm publish --no-git-checks;
  Node matrix 18/20/22/24
- New renovate.json with minimumReleaseAge "1 day",
  internalChecksFilter "strict", and @apify/* + @crawlee/* whitelist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@B4nan B4nan marked this pull request as ready for review April 15, 2026 13:41
B4nan added 5 commits April 15, 2026 15:42
Replaces the local .github/actions/pnpm-install composite copy
with the shared one from apify/workflows@main. Identical behavior,
less duplication.
Silences npm warnings about unknown options like node-linker; pnpm
reads the same keys from pnpm-workspace.yaml in camelCase form.
Block accidental npm/yarn install — npm 10.5+ and pnpm 10.x both
honor devEngines.packageManager and refuse to run when it doesn't
match.
Copy link
Copy Markdown
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

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

Lgtm, just one curious question ⬇️


createConnection(options: NetConnectOpts, callback?: (err: Error | null, stream: Duplex) => void): Duplex {
return this.agent.createConnection(options, callback);
return this.agent.createConnection(options, callback) as Duplex;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does the package manager migration require a cast in the code?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The lockfile regeneration during the pnpm migration resolved a newer @types/node where agent.createConnection() returns Duplex | null | undefined instead of just Duplex. Without the cast, tsc fails:

Type 'Duplex | null | undefined' is not assignable to type 'Duplex'.

The newer typing is more correct (the underlying Node API can return null/undefined), so the cast is the right fix here.

B4nan and others added 3 commits April 16, 2026 15:08
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
devEngines.packageManager breaks pnpm commands that delegate to npm
(pnpm version, pnpm pkg set, etc). Use the battle-tested only-allow
approach instead (same as Vite, Vue, Astro).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants