Skip to content
Open
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
5 changes: 3 additions & 2 deletions tests/one.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { runInRepo, $ } from '../utils.ts'
import type { RunOptions } from '../types.d.ts'
import { runInRepo } from '../utils.ts'

export async function test(options: RunOptions) {
await runInRepo({
...options,
repo: 'onejs/one',
branch: 'main',
build: ['clean:build', 'build'],
beforeTest: 'yarn playwright install chromium',
beforeInstall: async () => $`npm install -g bun`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this would install bun@latest, it would be better to use the exact bun version set in your packageManager or devEngines field in package.json.

given corepack is entering maintenance and won't be shipped with node in a future release we'll have to move vite-ecosystem-ci away from it at one point so learning how to do the install from npm directly could help.

Idea: read package.json, extract pm+version, run <pm> --version to see if currently installed one is matching version, if not run npm i -g <pm>@version and rerun <pm> --version to confirm.

Copy link
Copy Markdown
Member

@sapphi-red sapphi-red Mar 5, 2026

Choose a reason for hiding this comment

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

npm i -g will override the installed bun locally. I'd prefer to avoid that. Can we install it in this repo and use that instead? I guess we need to manage multiple versions as each project may use a different version.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i'm working on a PoC currently, that only auto-installs if github actions is detected, otherwise tells the user to do it.

but of course this doesn't work for all package managers, yarn doesn't have its latest majors on npm, insetad you have to npm i -g yarn which installs yarn v 1.2.2 and then you have to yarn set version <version you actually want> but it'll complain you have to use corepack if it detects a packageManager field. fml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the idea with installing it locally is nice too, we'd have to set up a separate directory (maybe inside workspace?) and then manipulate path so that it is prefered. This is problematic during local use too though because while we can control path in scripted calls, users can also try to run commands in workspace from their own terminal (i often do to reproduce things) and that path we cannot access/change, leading to inconsistent results.

Afraid there is no solution that fits CI and local use that doesn't involve moving everything into containers that provide the consistent binaries/environment to 100% replicate things.
Future me might work on this. But for now we need a practical way to have bun matching packageManager to support the one test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

see #443 for a simplistic approach

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

that didn't go anywhere either. i'm leaning towards not supporting bun in vite-ecosystem-ci for now.

beforeTest: 'bunx playwright install chromium',
test: 'test:vite-ecosystem-ci',
})
}
Expand Down
7 changes: 7 additions & 0 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ export async function applyPackageOverrides(
pkg.devDependencies[name] = version
}
}
} else if (pm === 'bun') {
pkg.overrides = {
...pkg.overrides,
...overrides,
}
} else {
throw new Error(`unsupported package manager detected: ${pm}`)
}
Expand All @@ -637,6 +642,8 @@ export async function applyPackageOverrides(
await $`yarn install`
} else if (pm === 'npm') {
await $`npm install`
} else if (pm === 'bun') {
await $`bun install`
}
}

Expand Down