Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 58 additions & 19 deletions .dagger/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ const INSTALL_DOCS_TOOLS =
'cargo install mdbook --version 0.5.4 --locked --quiet && ' +
'cargo install mdbook-linkcheck --version 0.7.7 --locked --quiet';

// Must match `packageManager` in `browser/package.json`, exactly.
//
// Installing any *other* version means the first pnpm invocation inside a
// workspace tries to self-switch to the declared one, and pnpm 10 cannot
// switch to pnpm 11: it downloads `@pnpm/<platform>` and then looks for the
// CLI at `.tools/@pnpm+<platform>/<version>/bin`, which pnpm 11 no longer
// ships that way. The switch dies with
// ERROR Failed to switch pnpm to v11.10.0. Looks like pnpm CLI is missing
// and takes every JS container with it. Upstream: pnpm/pnpm#12528.
//
// So: install the exact version, and never let the self-switch run.
const PNPM_VERSION = '11.10.0';

// Where `get.pnpm.io/install.sh` puts the CLI, for the containers that install
// pnpm that way instead of via `npm --global` (the playwright image).
//
// pnpm 10 dropped the binary straight into `$PNPM_HOME`; pnpm 11 installs
// `@pnpm/exe` and leaves shims in `$PNPM_HOME/bin` instead. Pointing PATH at
// `$PNPM_HOME` — correct until the version bump above — now yields
// exec: "pnpm": executable file not found in $PATH
// on the container's first `pnpm install`. The install script's own PATH
// advice (`export PATH="$PNPM_HOME/bin:$PATH"`) is the authority here.
const PNPM_BIN_DIR = '/root/.local/share/pnpm/bin';

// Must match `@playwright/test` in `browser/e2e/package.json`.
//
// The image bakes in the browser builds its own Playwright wants, and each
Expand Down Expand Up @@ -998,9 +1022,25 @@ export class AtomicServer {
const pnpmContainer = dag
.container()
.from(NODE_IMAGE)
.withExec(['npm', 'install', '--global', 'corepack@latest'])
.withExec(['corepack', 'enable'])
.withExec(['corepack', 'prepare', 'pnpm@latest-10', '--activate'])
// Straight to the declared version — see PNPM_VERSION. Going through
// corepack with a 10.x line meant pnpm had to self-switch to 11 on
// first use, which is broken.
.withExec(['npm', 'install', '--global', `pnpm@${PNPM_VERSION}`])
// Hoisting must be a *persistent* setting, not a CLI flag. pnpm 11
// (see browser/package.json `packageManager`) runs a deps-status check
// before every `pnpm run`, and re-invokes `pnpm install` itself when
// node_modules looks stale. That implicit install doesn't inherit
// `--shamefully-hoist`, so it sees a changed hoisting config, decides
// node_modules must be purged, and — with no TTY to confirm — aborts
// with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. `PNPM_CONFIG_*` is
// read by every pnpm invocation in the container, implicit ones
// included, so the two agree and no purge is ever proposed.
//
// Deliberately an env var rather than `shamefullyHoist: true` in
// pnpm-workspace.yaml: that file is shared with developers, and
// flattening node_modules locally would hide undeclared dependencies
// that currently fail fast.
.withEnvVariable('PNPM_CONFIG_SHAMEFULLY_HOIST', 'true')
.withWorkdir('/repo/browser');

// Mount workspace package manifests for caching and `pnpm install`.
Expand Down Expand Up @@ -1063,11 +1103,10 @@ export class AtomicServer {
'store-dir',
'/repo/browser/.pnpm-store',
])
.withExec([
'sh',
'-c',
'yes | pnpm install --frozen-lockfile --shamefully-hoist',
]);
// Hoisting comes from PNPM_CONFIG_SHAMEFULLY_HOIST above, and the
// `yes |` that used to answer the purge prompt is no longer needed —
// nothing prompts once the setting is persistent.
.withExec(['pnpm', 'install', '--frozen-lockfile']);

// Drop in @tomic/lib source. Other packages are unused by the
// integration tests, so we don't bother mounting them.
Expand Down Expand Up @@ -1257,9 +1296,13 @@ export class AtomicServer {
const pnpmContainer = dag
.container()
.from(NODE_IMAGE)
.withExec(['npm', 'install', '--global', 'corepack@latest'])
.withExec(['corepack', 'enable'])
.withExec(['corepack', 'prepare', 'pnpm@latest-10', '--activate'])
// Exact declared version, no corepack, no self-switch — see PNPM_VERSION.
.withExec(['npm', 'install', '--global', `pnpm@${PNPM_VERSION}`])
// See jsTestIntegration() for why hoisting is an env var and not a
// `--shamefully-hoist` flag: pnpm 11's pre-run deps check re-invokes
// `pnpm install` without the flag, reads that as a hoisting-config
// change, and aborts trying to purge node_modules without a TTY.
.withEnvVariable('PNPM_CONFIG_SHAMEFULLY_HOIST', 'true')
.withWorkdir('/app');

// Copy workspace files first for caching node_modules.
Expand Down Expand Up @@ -1291,11 +1334,7 @@ export class AtomicServer {
// `/app/.pnpm-store` without the config command.
.withMountedCache('/app/.pnpm-store', dag.cacheVolume('pnpm-store'))
.withExec(['pnpm', 'config', 'set', 'store-dir', '/app/.pnpm-store'])
.withExec([
'sh',
'-c',
'yes | pnpm install --frozen-lockfile --shamefully-hoist',
]);
.withExec(['pnpm', 'install', '--frozen-lockfile']);

// data-browser bootstrap JSON lives in repo-root lib/defaults. Vite resolves ../../../lib
// from data-browser/src to filesystem /lib if /app is only browser — do not mount there
Expand Down Expand Up @@ -2032,13 +2071,13 @@ export class AtomicServer {
.withEnvVariable('NPM_CONFIG_PREFIX', '/opt/npm-global')
.withEnvVariable(
'PATH',
'/root/.local/share/pnpm:/opt/npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
`${PNPM_BIN_DIR}:/opt/npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`,
)
.withExec([
'/bin/sh',
'-c',
'curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=10.15.1 ENV="$HOME/.shrc" SHELL="$(which sh)" sh - && ' +
'export PATH=/root/.local/share/pnpm:/opt/npm-global/bin:$PATH && ' +
`curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=${PNPM_VERSION} ENV="$HOME/.shrc" SHELL="$(which sh)" sh - && ` +
`export PATH=${PNPM_BIN_DIR}:/opt/npm-global/bin:$PATH && ` +
'/bin/apt update && /bin/apt install -y zip && ' +
'if [ ! -x /opt/npm-global/bin/netlify ]; then npm install -g netlify-cli --quiet; fi && netlify --version',
]);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
version: 11.10.0
run_install: false
# The default, ~/setup-pnpm, is shared by every runner on the host.
# Two jobs installing at once failed with ENOTEMPTY (2026-09-25,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.1
version: 11.10.0
# Per-runner, not the shared ~/setup-pnpm; see main-ci.yml.
dest: ${{ runner.temp }}/setup-pnpm

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ jobs:
targets: wasm32-unknown-unknown

# `version: 8` used to be pinned here while browser/package.json declares
# `packageManager: pnpm@10.15.1`, and there was no Node at all — so this
# `packageManager: pnpm@<version>`, and there was no Node at all — so this
# job could not have run a JS build even though, as the next step
# explains, it has to. There is no root package.json for
# pnpm/action-setup to read the version from, hence the explicit 10.
# pnpm/action-setup to read the version from, hence the explicit one; keep
# it equal to browser/package.json's `packageManager`.
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
version: 11.10.0
run_install: false

# The published crate has to CONTAIN the built frontend.
Expand Down Expand Up @@ -192,7 +193,7 @@ jobs:
# the repo pin (browser/package.json) is older. There is no root
# package.json for the action to read a version from, so this is
# explicit, like the crates job.
version: 10
version: 11.10.0
run_install: false

# Do NOT run the workspace `pnpm run build`: that walks into
Expand Down Expand Up @@ -382,7 +383,7 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
version: 11.10.0
run_install: false

- uses: dtolnay/rust-toolchain@1.98.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tauri-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
node-version: 22
- uses: pnpm/action-setup@v4
with:
version: 10
version: 11.10.0
run_install: false

- uses: dtolnay/rust-toolchain@1.98.1
Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
node-version: 22
- uses: pnpm/action-setup@v4
with:
version: 10
version: 11.10.0
run_install: false

- uses: actions/setup-java@v4
Expand Down Expand Up @@ -544,7 +544,7 @@ jobs:
node-version: 22
- uses: pnpm/action-setup@v4
with:
version: 10
version: 11.10.0
run_install: false

- uses: dtolnay/rust-toolchain@1.98.1
Expand Down
6 changes: 4 additions & 2 deletions browser/create-template/templates/sveltekit-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ You can preview the production build with `<PACKAGE_MANAGER_RUN> preview`.

## Why `@swc/core` is pinned

`package.json` pins `@swc/core` and `@swc/wasm` to an exact version through
`pnpm.overrides`. Neither is a direct dependency: both arrive under
`pnpm-workspace.yaml` pins `@swc/core` and `@swc/wasm` to an exact version.
The same pins are kept in `package.json` under `pnpm.overrides` for older
pnpm versions that do not read overrides from the workspace file. Update
both copies together. Neither is a direct dependency: both arrive under
`vite-plugin-top-level-await`, which needs them to rewrite top-level `await`
(this project has some, via the `loro-crdt` wasm bundle).

Expand Down
6 changes: 6 additions & 0 deletions browser/create-template/templates/sveltekit-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"name": "sveltekit-site",
"version": "0.0.1",
"private": true,
"pnpm": {
"overrides": {
"@swc/core": "1.15.47",
"@swc/wasm": "1.15.47"
}
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
packages:
- '.'

overrides:
'@swc/core': '1.15.47'
'@swc/wasm': '1.15.47'
2 changes: 1 addition & 1 deletion browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
"create-template"
]
},
"packageManager": "pnpm@10.15.1"
"packageManager": "pnpm@11.10.0+sha512.0b7f8b98060031904c017e3a41eb187a16d40eeb829b95c4f8cb03681761fc4ab53dd219115b9b447f4dce1a05a214764461e7d3703392a9f32f9511ce8c86c8"
}
3 changes: 2 additions & 1 deletion browser/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ allowBuilds:
cbor-extract: true
esbuild: true
netlify-cli: false
unix-dgram: false
sharp: true
unix-dgram: true

# Each range below is bounded to the package's current major line
# (>=patched <nextMajor) — an open-ended ">=x" lets pnpm resolve to a much
Expand Down
Loading