Skip to content

deno: nested package.json bound to root deno.lock without workspaces #45342

Description

@RahulGautamSingh

Discussed in #45325

Originally posted by a-connoisseur August 18, 2026

Description

In a repo where each subdirectory is a standalone Deno project (its own deno.json, package.json, deno.lock) with no npm/Deno workspaces, the deno manager attaches every nested package.json to the root deno.lock in addition to extracting each against its own lock. During lockFileMaintenance this deletes the root lock while running deno install in a subdirectory, ending in Artifact file update failure with only some locks refreshed.

Root cause

detectNodeCompatWorkspaces in lib/modules/manager/deno/compat.ts sets filters = undefined when no workspaces is declared and calls findPackages(dir, { patterns: undefined }), which defaults to ['.', '**'] and returns every package.json in the tree. collectPackageJson binds all of them to the root lock. The other caller, post.ts, guards the same call with isNonEmptyArray(pkg.managerData?.workspaces); collectPackageJson does not.

Fix

Skip the member sweep when no workspaces are declared (mirror the post.ts
guard), so a lock is only ever paired with its own package.json unless a
workspace is explicitly declared.

Metadata

Metadata

Assignees

No one assigned

    Labels

    manager:denoRelated to the deno manager

    Type

    Fields

    Priority

    Medium

    Datasource

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions