link-workspace-packages

Links workspace packages in monorepos across npm, yarn, pnpm, and bun, resolving dependency errors for internal imports.

1|Updated Jun 12, 2024
One-click install
npx skills add https://github.com/cskiwi/badman-m3 --skill link-workspace-packages-cskiwi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: link-workspace-packages
Source: https://github.com/cskiwi/badman-m3/tree/main/.claude/skills/link-workspace-packages
Command: npx skills add https://github.com/cskiwi/badman-m3 --skill link-workspace-packages-cskiwi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the process of linking packages within a monorepo, resolving dependency issues that arise from creating or importing sibling packages.

Core Features & Use Cases

  • Cross-Package Linking: Establishes dependencies between packages in a monorepo using their respective package managers (npm, yarn, pnpm, bun).
  • Dependency Resolution: Fixes common errors like "cannot find module" or "TS2307" when importing from workspace packages.
  • Use Case: After creating a new UI component library, use this Skill to link it to your main application package, ensuring all internal references are correctly resolved.

Quick Start

Use the link-workspace-packages skill to add the @org/ui package as a dependency to the @org/app package using pnpm.

Frequently Asked Questions about link-workspace-packages

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix the "cannot find module" error when importing a local package in a monorepo?

Linking workspace packages resolves "cannot find module" and TS2307 errors by establishing dependencies between sibling packages using package manager-specific workspace protocols for correct symlink creation.

How do I link a new UI component library to my main application using pnpm?

You can link a UI component library to your main application by adding the internal package as a dependency using pnpm's workspace protocol, which ensures seamless integration and correct import resolution.

Does this monorepo package linking approach work with both npm and bun?

Yes, this approach works with npm and bun, as well as yarn and pnpm, by adhering to each package manager's specific workspace protocols to ensure correct symlink creation and dependency declaration across the monorepo.

What is the best way to resolve dependency issues when importing sibling packages in a monorepo?

The best way to resolve sibling package dependency issues is to use automated workspace linking, which establishes correct dependencies between packages and addresses resolution errors for seamless internal imports.

Why are my TypeScript TS2307 errors occurring when importing from workspace packages?

TS2307 errors occur when importing workspace packages because the internal dependencies are not properly linked; resolving this requires adhering to your package manager's workspace protocols for correct dependency declaration.