Skip to content

feat(cli): add link and unlink commands for package development#274

Merged
fengmk2 merged 2 commits intomainfrom
10-24-feat_pm_add_link_and_unlink_commands
Oct 30, 2025
Merged

feat(cli): add link and unlink commands for package development#274
fengmk2 merged 2 commits intomainfrom
10-24-feat_pm_add_link_and_unlink_commands

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Oct 29, 2025

TL;DR

Add vite link (alias: vite ln) and vite unlink commands to create and remove symlinks for local package development.

What changed?

  • Added new link and unlink commands to the CLI that work with all package managers (pnpm, yarn, npm)
  • Implemented package manager-specific adaptations for both commands:
    • For pnpm: Supports recursive unlink with -r flag
    • For yarn: Translates recursive unlink to --all flag
    • For npm: Provides appropriate warnings for unsupported features
  • Added support for different link scenarios:
    • Register current package globally (no arguments)
    • Link a global package to current project (vite link <pkg>)
    • Link a local directory (vite link ./path/to/package)
  • Added unlink functionality with package-specific and recursive options
  • Created comprehensive test suite and snap tests to verify correct command generation for each package manager

How to test?

  1. Register the current package globally:
vite link
  1. Link a global package to your current project:
vite link react
  1. Link a package from a local directory:
vite link ./packages/my-lib
vite link ../other-project
  1. Unlink a package:
vite unlink react
  1. Unlink in all workspace packages (pnpm/yarn only):
vite unlink --recursive
vite unlink -r

Why make this change?

Local package development currently requires using package manager-specific commands with different syntaxes. This change provides a unified interface that:

  1. Automatically detects and uses the correct package manager
  2. Simplifies the workflow with a consistent command syntax
  3. Handles the differences between package managers (like pnpm's -r flag vs yarn's --all)
  4. Makes it easier to work with local packages during development without publishing
  5. Provides a clean way to remove links when they're no longer needed

Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 29, 2025

@fengmk2 fengmk2 changed the title feat(pm): add link and unlink commands feat(pm): add link command Oct 29, 2025
@fengmk2 fengmk2 changed the title feat(pm): add link command feat(cli): add link command for local package development Oct 29, 2025
@fengmk2 fengmk2 changed the title feat(cli): add link command for local package development feat(pm): add link command for local package development Oct 29, 2025
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from 89b1746 to f47b47c Compare October 30, 2025 01:52
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 970ecf1 to b722c55 Compare October 30, 2025 01:52
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from f47b47c to 8be19c4 Compare October 30, 2025 02:57
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from b722c55 to 7dd0621 Compare October 30, 2025 02:57
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from 8be19c4 to c64a1db Compare October 30, 2025 03:21
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 7dd0621 to 7934ac1 Compare October 30, 2025 03:21
@fengmk2 fengmk2 changed the title feat(pm): add link command for local package development feat(cli): add link and unlink commands for package development Oct 30, 2025
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from c64a1db to 9e246ff Compare October 30, 2025 05:52
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch 3 times, most recently from 97ce890 to 8b28157 Compare October 30, 2025 07:10
@fengmk2 fengmk2 marked this pull request as ready for review October 30, 2025 07:11
@fengmk2 fengmk2 self-assigned this Oct 30, 2025
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from 9e246ff to 6087892 Compare October 30, 2025 07:13
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 8b28157 to 1c74457 Compare October 30, 2025 07:13
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 1c74457 to 8cc9b79 Compare October 30, 2025 12:02
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_why_commands branch from 6087892 to 86831a0 Compare October 30, 2025 12:02
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 8cc9b79 to 61cc5ba Compare October 30, 2025 12:15
@fengmk2 fengmk2 changed the base branch from 10-24-feat_pm_add_why_commands to graphite-base/274 October 30, 2025 12:46
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 61cc5ba to 9482dc7 Compare October 30, 2025 12:47
@graphite-app graphite-app Bot changed the base branch from graphite-base/274 to main October 30, 2025 12:48
@fengmk2 fengmk2 force-pushed the 10-24-feat_pm_add_link_and_unlink_commands branch from 9482dc7 to bffefd4 Compare October 30, 2025 12:48
@fengmk2 fengmk2 merged commit 35b4b99 into main Oct 30, 2025
10 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Oct 30, 2025

Merge activity

@fengmk2 fengmk2 deleted the 10-24-feat_pm_add_link_and_unlink_commands branch October 30, 2025 12:59
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