From 787171a8062884eda0cc7c232fa37300bb1159cd Mon Sep 17 00:00:00 2001 From: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com> Date: Tue, 10 Nov 2026 08:29:11 +0530 Subject: [PATCH] docs: clarify package.json resolution in corepack use Explains how corepack use resolves the target package.json by searching the current and parent directories, how it traverses upwards in workspaces to find an existing packageManager definition, and notes that a new package.json is created in cwd if no manifest is found. Fixes #610 Signed-off-by: Abdul karim mia <97598943+abdul-karim-mia@users.noreply.github.com> --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e2adeb949..14162f248 100644 --- a/README.md +++ b/README.md @@ -274,9 +274,16 @@ suitable for use with `corepack install -g`. ### `corepack use ]>` When run, this command will retrieve the latest release matching the provided -descriptor, assign it to the project's package.json file, and automatically +descriptor, assign it to the project's `package.json` file, and automatically perform an install. +Corepack locates the project manifest by searching the current directory and +traversing parent directories until a `package.json` is found. In a monorepo or +workspace structure, it searches upwards for an existing `package.json` that +defines a `packageManager` field. If no `package.json` exists anywhere in the +directory hierarchy, a new `package.json` with the assigned `packageManager` +specification will be created in the current directory. + ### `corepack up` Retrieve the latest available version for the current major release line of