Skip to content

Commit 92afbdd

Browse files
committed
fix(migration): allow file: versions in force-mode workspace yaml override
Remove the !VITE_PLUS_VERSION.startsWith('file:') guard so force mode with file: tgz versions also writes the vite-plus override to pnpm-workspace.yaml. Also rename a misleading test.
1 parent 4217486 commit 92afbdd

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

packages/cli/src/migration/__tests__/migrator.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,13 @@ describe('rewriteStandaloneProject pnpm workspace yaml', () => {
418418
expect(rules.ignoreMissing).toEqual(['@types/node']);
419419
});
420420

421-
it('moves remaining non-Vite overrides to pnpm-workspace.yaml', () => {
422-
// Project has NO pnpm field, but we simulate re-migration by creating
423-
// the workspace yaml first, then calling with a package.json that has no pnpm
421+
it('writes vite overrides with catalog references to pnpm-workspace.yaml', () => {
424422
fs.writeFileSync(
425423
path.join(tmpDir, 'package.json'),
426424
JSON.stringify({ name: 'test', devDependencies: { vite: '^7.0.0' } }),
427425
);
428426
rewriteStandaloneProject(tmpDir, makeWorkspaceInfo(tmpDir, PackageManager.pnpm), true, true);
429427

430-
// Verify workspace yaml has overrides
431428
const yaml = readYaml(path.join(tmpDir, 'pnpm-workspace.yaml'));
432429
expect(yaml).toContain("vite: 'catalog:'");
433430
expect(yaml).toContain("vitest: 'catalog:'");

packages/cli/src/migration/migrator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ export function rewriteStandaloneProject(
732732
rewritePnpmWorkspaceYaml(projectPath);
733733
// In force-override mode, also override vite-plus itself so transitive
734734
// deps resolve to the local tgz instead of the published version.
735-
if (isForceOverrideMode() && !VITE_PLUS_VERSION.startsWith('file:')) {
735+
if (isForceOverrideMode()) {
736736
migratePnpmOverridesToWorkspaceYaml(projectPath, {
737737
[VITE_PLUS_NAME]: VITE_PLUS_VERSION,
738738
});

0 commit comments

Comments
 (0)