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
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default defineConfig({
}

> cat .yarnrc.yml # check .yarnrc.yml
nodeLinker: node-modules
nodeLinker: pnpm
catalog:
vite: npm:@voidzero-dev/vite-plus-core@latest
vitest: npm:@voidzero-dev/vite-plus-test@latest
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/create/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ describe('renameFiles', () => {

it('renames `_npmrc` and `_yarnrc.yml`', () => {
write('_npmrc', 'auto-install-peers=true\n');
write('_yarnrc.yml', 'nodeLinker: node-modules\n');
write('_yarnrc.yml', 'nodeLinker: pnpm\n');
renameFiles(projectDir);
expect(exists('_npmrc')).toBe(false);
expect(exists('_yarnrc.yml')).toBe(false);
expect(read('.npmrc')).toBe('auto-install-peers=true\n');
expect(read('.yarnrc.yml')).toBe('nodeLinker: node-modules\n');
expect(read('.yarnrc.yml')).toBe('nodeLinker: pnpm\n');
});

it('is a no-op when no source files exist', () => {
Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/create/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1300,14 +1300,15 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
// migrate before the vite-plus rewrite so the generated .oxlintrc/.oxfmtrc
// get merged into vite.config.ts — matching `vp migrate`. Pin the
// packageManager field (vite_install hardcodes pnpm in CI/non-TTY when no
// signal is present) and force yarn's classic node_modules layout
// (Plug'n'Play zip entries break @oxlint/migrate's fileURLToPath resolution).
// signal is present) and force yarn's pnpm linker (its node_modules entries
// are real on-disk files, unlike Plug'n'Play zip entries that break
// @oxlint/migrate's fileURLToPath resolution).
const installAndMigrate = async (installCwd: string) => {
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
if (workspaceInfo.packageManager === PackageManager.yarn) {
const yarnrcPath = path.join(fullPath, '.yarnrc.yml');
if (!fs.existsSync(yarnrcPath)) {
fs.writeFileSync(yarnrcPath, 'nodeLinker: node-modules\n');
fs.writeFileSync(yarnrcPath, 'nodeLinker: pnpm\n');
}
}
updateCreateProgress('Installing dependencies');
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/migration/__tests__/migrator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ describe('ensureVitePlusBootstrap', () => {
nodeLinker: string;
catalog: Record<string, string>;
};
expect(yarnrc.nodeLinker).toBe('node-modules');
expect(yarnrc.nodeLinker).toBe('pnpm');
expect(yarnrc.catalog.vite).toBe('npm:@voidzero-dev/vite-plus-core@latest');
expect(yarnrc.catalog.vitest).toBe('npm:@voidzero-dev/vite-plus-test@latest');
expect(yarnrc.catalog['vite-plus']).toBe('latest');
Expand Down Expand Up @@ -1723,7 +1723,7 @@ describe('rewriteMonorepo yarn catalog', () => {
nodeLinker: string;
catalogs: Record<string, Record<string, string>>;
};
expect(yarnrc.nodeLinker).toBe('node-modules');
expect(yarnrc.nodeLinker).toBe('pnpm');
expect(yarnrc.catalogs.vite7.vite).toBe('npm:@voidzero-dev/vite-plus-core@latest');
expect(yarnrc.catalogs.vite7.react).toBe('^18.0.0');
expect(yarnrc.catalogs.test.vitest).toBe('npm:@voidzero-dev/vite-plus-test@latest');
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/migration/migrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ function rewriteYarnrcYml(projectPath: string): void {

editYamlFile(yarnrcYmlPath, (doc) => {
if (!doc.has('nodeLinker')) {
doc.set('nodeLinker', 'node-modules');
doc.set('nodeLinker', 'pnpm');
}
// catalog
rewriteCatalog(doc);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/templates/monorepo/_yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nodeLinker: node-modules
nodeLinker: pnpm
catalog:
'@types/node': ^24
typescript: ^5
3 changes: 3 additions & 0 deletions rfcs/migration-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,14 @@ peerDependencyRules:
`.yarnrc.yml`

```yaml
nodeLinker: pnpm
catalog:
vite: npm:@voidzero-dev/vite-plus-core@latest
vitest: npm:@voidzero-dev/vite-plus-test@latest
```

`nodeLinker` is only added when absent, so a project that already pins a linker keeps its own value. The `pnpm` linker is used (real on-disk `node_modules` entries via a content-addressable store) rather than yarn's default Plug'n'Play, whose zip entries break `@oxlint/migrate`'s `fileURLToPath` resolution.

`package.json`

```json
Expand Down
Loading