Skip to content

fix(cli): preserve single-segment project path in updateWorkspaceConfig#1582

Merged
fengmk2 merged 2 commits into
voidzero-dev:mainfrom
jong-kyung:fix/update-workspace-config-single-segment
May 15, 2026
Merged

fix(cli): preserve single-segment project path in updateWorkspaceConfig#1582
fengmk2 merged 2 commits into
voidzero-dev:mainfrom
jong-kyung:fix/update-workspace-config-single-segment

Conversation

@jong-kyung
Copy link
Copy Markdown
Collaborator

@jong-kyung jong-kyung commented May 15, 2026

Summary

vp create --directory website was writing packages: [ ./* ] to pnpm-workspace.yaml instead of packages: [ website ]. Fix the pattern-derivation so single-segment paths stay literal.

Cause

  let pattern = path.dirname(projectPath);
  if (!pattern) {
    // intent : "website" -> "website"
    pattern = projectPath;
  } else {
    // "foo/bar/app" -> "foo/bar/*"
    pattern = `${pattern}/*`;
  }

path.dirname('website') returns '.', not ''. '.' is truthy, so the literal branch never fired — every single-segment path became ./*.

The fix:

const parentDir = path.dirname(projectPath);
const pattern = parentDir === '.' ? projectPath : `${parentDir}/*`;

./* over-matches in pnpm (picks up every root sibling with a package.json) and accumulates on repeat calls because minimatch('name', './*') returns false, so the skip-when-matched guard misses it.

path.dirname returns '.' for single-segment paths like 'website', which
made the previous truthiness check fall through to the '/*' branch and
emit './*' instead of the intended literal pattern. Handle '.' explicitly
so a project at the repo root keeps its name as the workspace pattern.

Adds unit coverage for updateWorkspaceConfig pattern derivation,
discoverWorkspacePackages, updatePackageJsonWithDeps, and
findPackageJsonFilesFromPatterns — none of which had tests before.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 44d5961
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a06aee5c18ac30008114456
😎 Deploy Preview https://deploy-preview-1582--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@jong-kyung
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jong-kyung jong-kyung self-assigned this May 15, 2026
@jong-kyung jong-kyung marked this pull request as ready for review May 15, 2026 05:33
@jong-kyung
Copy link
Copy Markdown
Collaborator Author

@fengmk2 Could you please re-run the CI for this PR?

@jong-kyung jong-kyung requested a review from fengmk2 May 15, 2026 05:34
@fengmk2 fengmk2 merged commit 45703ff into voidzero-dev:main May 15, 2026
59 of 61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants