Skip to content

Commit

Permalink
fix: onlyBuiltDependencies not added on new projects (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel3108 authored Feb 7, 2025
1 parent 3a174e6 commit 9bf0372
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-phones-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: `onlyBuiltDependencies` not added on new projects
9 changes: 6 additions & 3 deletions packages/cli/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ export function addPnpmBuildDependendencies(
// other package managers are currently not affected by this change
if (!packageManager || packageManager !== 'pnpm') return;

// find the workspace root
// find the workspace root (if present)
const pnpmWorkspacePath = find.up('pnpm-workspace.yaml', { cwd });
if (!pnpmWorkspacePath) return;
let packageDirectory;

if (pnpmWorkspacePath) packageDirectory = path.dirname(pnpmWorkspacePath);
else packageDirectory = cwd;

// load the package.json
const pkgPath = path.join(path.dirname(pnpmWorkspacePath), 'package.json');
const pkgPath = path.join(packageDirectory, 'package.json');
const content = fs.readFileSync(pkgPath, 'utf-8');
const { data, generateCode } = parseJson(content);

Expand Down

0 comments on commit 9bf0372

Please sign in to comment.