link-workspace-packages

Link workspace packages in monorepos using npm, yarn, pnpm, and bun commands.

Updated Oct 21, 2023
One-click install
npx skills add https://github.com/andre-goldmann/jdg.digital --skill link-workspace-packages-andre-goldmann
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: link-workspace-packages
Source: https://github.com/andre-goldmann/jdg.digital/tree/main/apps/.opencode/skills/link-workspace-packages
Command: npx skills add https://github.com/andre-goldmann/jdg.digital --skill link-workspace-packages-andre-goldmann

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the process of linking related packages within a monorepo, resolving dependency issues that arise from package managers not correctly recognizing or linking sibling packages.

Core Features & Use Cases

  • Package Manager Agnostic Linking: Supports npm, yarn, pnpm, and bun.
  • Dependency Resolution: Fixes "cannot find module" and other import errors for workspace packages.
  • Use Case: When you create a new UI component package and need to use it in your main application package within the same monorepo, this skill will correctly add the UI package as a dependency and ensure it's linked.

Quick Start

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

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 'cannot find module' errors for workspace packages in a monorepo?

To fix 'cannot find module' errors in a monorepo, you need to correctly link workspace packages by declaring dependencies and creating symlinks. This ensures sibling packages are recognized and resolves TS2307 import errors.

Can I link monorepo workspace packages using different package managers like pnpm or bun?

Yes, you can link monorepo workspace packages using pnpm or bun. This linking process is package manager agnostic and supports npm, yarn, pnpm, and bun by leveraging their specific workspace commands.

What is the best way to add a new UI component package as a dependency in an application package within a monorepo?

The best way to add a UI component package as a dependency in a monorepo application is to use automated workspace linking. This correctly declares the sibling package and ensures symlink creation for seamless inter-package communication.

Why does TypeScript show TS2307 errors for sibling packages in my monorepo?

TypeScript shows TS2307 errors for sibling packages in a monorepo because the package manager did not correctly recognize or link them. Automating the workspace linking process resolves these dependency issues.

Does linking workspace packages automatically handle symlink creation across npm and yarn?

Yes, linking workspace packages automatically handles symlink creation across npm and yarn. By leveraging package manager-specific workspace commands, it ensures correct dependency declaration and symlink creation for seamless communication.