unjs / unjs/pkg-types

workspace (monorepo) utils

Open
#117 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
300
Forks
30
Avg merge
20h 45m
Merged PRs (30d)
3

Description

Supporting monorepo and workspace detection

Common sources:

  • workspaces field in package.json (yarn, npm and lerna, turbo supported)
  • pnpm-workspace.yaml (pnpm, our odd friend with it's odd requirements)

Common workspace managers:

Reolve workspace

We already have findworkspaceDir but it is not strict enough to make distinguish between a monorepo and just the closest root dir of a project.

We could introduce a new resolveWorkspace utility that only detects an explicit monorepo workspace with the detected field in package.json or pnpm workspaces lock returning a workspaces config object (array of objects for forward compatibility.

Resolve workspace packages

Another utility like resolveWorkspacePkgs can be introduced to accepd resolved workspace config (from resolveWorkspace or a string to do this) and read all of its packages.

Resolve workspace packages graph

Get array of workspace packages, returning an (ordered and sorted) graph of devDependency and dependency between monorepo packages.

(PR more than welcome 🙏🏼 )

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing findworkspaceDir utility and the workspace manager documentation linked in the issue. Compare explicit workspaces fields in package.json with pnpm-workspace.yaml, then define the scope of workspace resolution, package discovery, and dependency graph ordering. Done should include agreed behavior for the proposed utilities and coverage for supported workspace configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.