Skip to content

feat!: switch monorepo from npm to pnpm#1298

Open
sorccu wants to merge 28 commits into
next/v8from
simo/sim-244-switch-cli-from-npm-to-pnpm
Open

feat!: switch monorepo from npm to pnpm#1298
sorccu wants to merge 28 commits into
next/v8from
simo/sim-244-switch-cli-from-npm-to-pnpm

Conversation

@sorccu
Copy link
Copy Markdown
Member

@sorccu sorccu commented May 13, 2026

Summary

  • Replace package-lock.json with pnpm-lock.yaml (imported via pnpm import)
  • Add pnpm-workspace.yaml for workspace configuration
  • Update all CI workflows to use pnpm
  • Update all npm scripts to use pnpm equivalents
  • Update simple-git-hooks to use pnpm exec
  • Add pnpm.onlyBuiltDependencies for esbuild and simple-git-hooks
  • Replace fixture npm lockfiles with pnpm lockfiles
  • Use pnpm instead of npx in all test fixtures and e2e tests
  • Add string-width and ast-types as explicit dependencies (phantom deps under npm)
  • Decouple skills/ sync from prepare lifecycle to eliminate cross-package race condition
  • Remove child-concurrency=1 workaround from .npmrc
  • Introduce FixtureTemplate to pre-install dependencies once and share via symlinks
  • Add FixtureTemplate.use() for safe template lookup from test files
  • Symlink checkly package + .bin/checkly into fixture sandboxes (replaces tarball injection)
  • Migrate all e2e and unit test fixtures to use templates or installPackages: false
  • Remove pnpm pack from test scripts (no longer needed)
  • Fix create-cli e2e: force npm via npm_config_user_agent to avoid pnpm workspace detection
  • Fix create-cli e2e: correct playwright config test prompt injection
  • Stop injecting jiti into scaffolded project dependencies (now bundled by CLI)
  • Update pw-test e2e assertions for pnpm-generated testCommand

Supersedes #1299.
Depends on: #1297

Test plan

  • All unit tests pass (Ubuntu + Windows)
  • All e2e tests pass (Ubuntu + Windows)
  • pnpm install --frozen-lockfile succeeds
  • Lint passes
  • pnpm run sync:skills produces correct output

🤖 Generated with Claude Code

sorccu and others added 2 commits May 13, 2026 20:29
BREAKING CHANGE: The project now uses pnpm as its package manager.

- Replace package-lock.json with pnpm-lock.yaml (imported via pnpm import)
- Add pnpm-workspace.yaml for workspace configuration
- Update all CI workflows to use pnpm
- Update all npm scripts to use pnpm equivalents
- Update simple-git-hooks to use pnpm exec
- Add pnpm.onlyBuiltDependencies for esbuild and simple-git-hooks
- Replace fixture npm lockfiles with pnpm lockfiles
- Update test expectations for pnpm-lock.yaml in bundled file lists

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sorccu sorccu force-pushed the simo/sim-244-switch-cli-from-npm-to-pnpm branch from 54f503e to e001bed Compare May 13, 2026 11:30
sorccu and others added 13 commits May 13, 2026 20:38
These were phantom dependencies (transitive via recast and other packages)
that worked with npm's flat node_modules but fail under pnpm's strict
dependency resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Set child-concurrency=1 in .npmrc so pnpm runs workspace prepare
scripts sequentially. Remove the redundant `pnpm -r run prepare`
from the root prepare script (pnpm already runs each package's
prepare hook) and move prepare:ai-context to postprepare so it
runs after all packages are built.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test injected initializeGit=true but didn't account for when
.git already existed (skipping the prompt). Change to not init git
since it's not what the test is verifying, and add the missing
askCopyPlaywrightProject prompt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…cies

jiti is now bundled internally by the CLI and no longer needed as a
user-facing dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixtures now detect pnpm as the package manager, so the generated
testCommand is 'pnpm playwright test' instead of 'npx playwright test'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the root-level skills/ copy from a postprepare lifecycle hook to
an explicit sync:skills script. This eliminates the cross-package
dependency between root and packages/cli during pnpm install, removing
the need for child-concurrency=1 in .npmrc.

The AI context is still built as part of packages/cli's prepare script
(needed for the published tarball), but the root no longer races to
copy from its output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce FixtureTemplate to pre-install dependencies once and share
them across fixtures via symlinks, reducing pnpm install calls from
53 to 1.

- Add FixtureTemplate class that caches pre-installed node_modules
- Add vitest globalSetup to build the playwright template once
- Migrate playwright-check, parse-files tests to use template
- Set installPackages: false for fixtures with no deps (agentic-check,
  api-check, browser-check, project-parser)
- Symlink workspace checkly package into all fixture node_modules
- Remove injectPackedSelf (dead code) and pnpm pack from test scripts
- Remove accidentally committed node_modules from test-bundling and
  test-shared-bundling fixtures

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Share a single playwright install across all e2e fixture sandboxes
via symlinked node_modules. Fixtures with no dependencies use
installPackages: false instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace npx with pnpm in e2e test runners for consistency with the
pnpm-based fixtures. Add pnpm-lock.yaml to all e2e fixtures so
detectPackageManager reliably identifies pnpm.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add FixtureTemplate.use() which looks up a cached template by name,
falling back to an env var set by globalSetup for cross-process
communication. Test files now pass template: 'playwright' as a string
instead of managing FixtureTemplate.create() calls directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@checkly checkly deleted a comment from github-actions Bot May 14, 2026
@checkly checkly deleted a comment from github-actions Bot May 14, 2026
sorccu and others added 10 commits May 14, 2026 17:48
…test

The test-pwt-native fixture pins @playwright/test to 1.53.1. The shared
playwright template installs ^1.59.1 which resolves to a newer version,
causing a version mismatch error at runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sequential pnpm installs let the second template reuse packages
cached by the first (e.g. playwright-core), avoiding redundant
downloads on CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Make source param optional (empty sandbox when omitted)
- Add 'bare' template (checkly only, no other deps)
- Fix Windows .bin by writing a .cmd shim instead of a symlink
- Replace runChecklyCli with checklyEnv + runCheckly helpers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…dbox

Replace the raw child_process.spawn-based runChecklyCli with
FixtureSandbox + runCheckly helper across all 21 e2e test files.

Tests now use pnpm checkly via the .bin symlink instead of spawning
bin/run directly, which fixes Windows module resolution issues with
pnpm's node_modules layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm requires a package.json in the working directory. When no source
is provided, write a minimal one so pnpm checkly can run.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- destroy: wrong project name exits 0, not failure
- login: remove trailing newline assertion (oclif line-wrapping)
- switch: remove trailing newline assertion
- env.rm: add explicit timeout for interactive prompt test
- Add missing package.json to fixtures that lacked one
- Write package.json in sourceless sandboxes for pnpm compat

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use CHECKLY_CLI_MODE=interactive instead of unsetting CI, since
the CLI also checks GITHUB_ACTIONS and other CI-specific env vars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On Windows, oclif's module-loader uses require() to load the custom
help class. Without the .js extension, require() fails to resolve
the module in an ESM package because Node.js doesn't auto-append
extensions for require() in "type": "module" packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On Windows, pnpm's import() of oclif command modules fails with
MODULE_NOT_FOUND even when the files exist. Bypass pnpm's execution
layer by invoking node with the bin/run path directly, matching the
behavior of the old runChecklyCli helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sorccu and others added 3 commits May 15, 2026 15:43
On Windows, Node.js import() fails when resolving through NTFS
junctions. Use CLI_PACKAGE_ROOT directly to avoid junction traversal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use extendEnv: false so the CLI subprocess gets only explicitly passed
env vars, matching the old child_process.spawn behavior. This prevents
CI runner env vars from interfering with the CLI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests using fixt.run directly need checklyEnv() to provide API keys
and other required env vars when extendEnv is false.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant