Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand corepack use documentation description #610

Open
MikeMcC399 opened this issue Jan 24, 2025 · 0 comments
Open

Expand corepack use documentation description #610

MikeMcC399 opened this issue Jan 24, 2025 · 0 comments

Comments

@MikeMcC399
Copy link
Contributor

Issue

Under README > corepack use the complete description currently says:

corepack use <name[@]>

When run, this command will retrieve the latest release matching the provided descriptor, assign it to the project's package.json file, and automatically perform an install.

package.json location

There is no description of how the command navigates the directory hierarchy to locate a possible existing package.json to modify.

Using the test example of @arcanis in #607 (comment) shows that it operates on the root of a hierarchy:

corepack enable yarn
cd $(mktemp -d)
yarn init -2 -w
mkdir -p packages/foo
echo '{}' > packages/foo/package.json
jq .packageManager package.json
(cd packages/foo && corepack use [email protected])
jq .packageManager package.json

In this example case, the result is that:

  • packages/foo/package.json contains {}

  • package.json contains

    {
      "name": "tmp.IcgYOXK7aS",
      "packageManager": "[email protected]+sha512.837566d24eec14ec0f5f1411adb544e892b3454255e61fdef8fd05f3429480102806bac7446bc9daff3896b01ae4b62d00096c7e989f1596f2af10b927532f39",
      "workspaces": [
        "packages/*"
      ]
    }
    

package.json creation

If no package.json file is found, then one is created. This effect of the command is not described.

Suggestion

For the README > corepack use section:

  • Add text to explain how the location for the package.json file is determined.
  • Add text which describes how a package.json file and / or a packageManager field is created if they don't exist.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant