Skip to content

Zero-config node_modules detection misses nested packages in monorepos #36

Description

@rohansx

Reported by @NicolasHa. Verified against main.

In a monorepo where node_modules lives at website/node_modules rather than the repo root, workz start doesn't link it. A Node script resolving a dependency through createRequire(<repo>/website/package.json) then dies with MODULE_NOT_FOUND.

Adding "website/node_modules" to symlink_add fixes it, so this is a papercut rather than a blocker — but zero-config is what a new user relies on, and in a monorepo the interesting package.json is rarely at the root.

Cause (confirmed)

Two compounding reasons:

  1. detect_project sets info.has_node = true only from a root package.json.
  2. is_relevant("node_modules", project) returns has_node — so in a monorepo with only website/package.json, the built-in entry is filtered out and the skip is silent (see #32c).
  3. The built-in list names bare node_modules, which is root-relative anyway.

Suggested fix

Walk the repo for package.json files (respecting ignores, bounded depth) and link each one's sibling node_modules. Same idea likely applies to other per-package artifacts in polyglot monorepos (.venv, target).

Related: #32 (the silence that hides this), and the reporter's [worktree] dir = ".worktrees" nesting works well and should keep working with this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions