Skip to content

Expand corepack use documentation description #610

Open
@MikeMcC399

Description

@MikeMcC399

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions