Skip to content

Commit

Permalink
chore: not override rslib's rsbuild version when test plugins (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy authored Jan 3, 2025
1 parent a9ca38d commit 42ff957
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export async function test(options: RunOptions) {
await $`pnpm exec playwright install --with-deps`
}
},
overrides: {
// not override rslib's rsbuild version
'@rslib/core>@rsbuild/core': 'latest',
},
test: [
'build',
async () => {
Expand Down
13 changes: 9 additions & 4 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,15 @@ async function applyPackageOverrides(
// remove boolean flags
overrides = Object.fromEntries(
Object.entries(overrides)
//eslint-disable-next-line @typescript-eslint/no-unused-vars
.filter(([key, value]) => typeof value === 'string')
.filter(([_key, value]) => typeof value === 'string')
.map(([key, value]) => [key, useFileProtocol(value as string)]),
)

const localOverrides = Object.fromEntries(
Object.entries(overrides).filter(([_key, value]) =>
value.startsWith('file:'),
),
)
await $`git clean -fdxq` // remove current install

const agent = await detect({ cwd: dir, autoInstall: false })
Expand All @@ -421,7 +426,7 @@ async function applyPackageOverrides(
}
pkg.devDependencies = {
...pkg.devDependencies,
...overrides, // overrides must be present in devDependencies or dependencies otherwise they may not work
...localOverrides, // overrides must be present in devDependencies or dependencies otherwise they may not work
}
if (!pkg.pnpm) {
pkg.pnpm = {}
Expand All @@ -436,7 +441,7 @@ async function applyPackageOverrides(
}
pkg.devDependencies = {
...pkg.devDependencies,
...overrides, // overrides must be present in devDependencies or dependencies otherwise they may not work
...localOverrides, // overrides must be present in devDependencies or dependencies otherwise they may not work
}
pkg.resolutions = {
...pkg.resolutions,
Expand Down

0 comments on commit 42ff957

Please sign in to comment.