Skip to content

feat: support load package graph from yarn/npm workspaces#60

Merged
wan9chi merged 4 commits into
mainfrom
support-yarn-and-npm-workspaces
Aug 27, 2025
Merged

feat: support load package graph from yarn/npm workspaces#60
wan9chi merged 4 commits into
mainfrom
support-yarn-and-npm-workspaces

Conversation

@fengmk2

@fengmk2 fengmk2 commented Aug 27, 2025

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fengmk2 fengmk2 requested a review from Copilot August 27, 2025 07:30

This comment was marked as outdated.

fengmk2 and others added 2 commits August 27, 2025 15:38
Apply automatic formatting from cargo fmt to improve code consistency.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fengmk2 fengmk2 requested a review from Copilot August 27, 2025 07:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for loading package graphs from yarn/npm workspaces in addition to the existing pnpm workspace support. The implementation extends the workspace detection logic to recognize package.json files with workspaces fields and adds comprehensive test coverage for various workspace scenarios.

  • Refactored workspace detection to support npm/yarn workspaces alongside pnpm workspaces
  • Added a helper function open_exists_file to reduce code duplication
  • Expanded test coverage with 13 new test cases covering single packages, different workspace types, edge cases, and dependency patterns

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/vite_package_manager/src/package_manager.rs Added npm/yarn workspace support, refactored file opening logic, and updated tests
crates/vite_package_manager/src/lib.rs Added NpmWorkspace struct, updated get_package_graph function to handle multiple workspace types, and added comprehensive test suite

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread crates/vite_package_manager/src/lib.rs
Comment thread crates/vite_package_manager/src/lib.rs

@wan9chi wan9chi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +402 to +415

// Create packages directory
fs::create_dir_all(temp_dir.path().join("packages")).unwrap();

// Create included package
fs::create_dir_all(temp_dir.path().join("packages/included")).unwrap();
let included = serde_json::json!({
"name": "included-pkg"
});
fs::write(temp_dir.path().join("packages/included/package.json"), included.to_string())
.unwrap();

// Create excluded package
fs::create_dir_all(temp_dir.path().join("packages/excluded-test")).unwrap();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could really use snapshot testing 😂

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take a try

@wan9chi wan9chi force-pushed the support-yarn-and-npm-workspaces branch from 58e609c to b02419e Compare August 27, 2025 08:22
@wan9chi wan9chi merged commit ba50b61 into main Aug 27, 2025
4 checks passed
@wan9chi wan9chi deleted the support-yarn-and-npm-workspaces branch August 27, 2025 08:42
fengmk2 added a commit that referenced this pull request Jul 9, 2026
fengmk2 added a commit that referenced this pull request Jul 9, 2026
Bumps the pinned `voidzero-dev/pkg-pr-registry-bridge` publish action in
`publish-preview.yml` from `4fbc413` (bridge #60) to `f57eaa9` (bridge
#61).

The bridge removed its `PKG_PR_NEW_BASE` var and the Worker's on-demand
pkg.pr.new fallback; it now serves preview artifacts only from R2. The
action's inputs are unchanged and this step packs locally, so publish
behavior here is identical. This just keeps the pin in sync with the
deployed bridge.
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.

3 participants