Expand `corepack use` documentation description
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 45/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
调研方向
更新 README 的 corepack use 部分,以链接的 issue 607 测试示例及其 shell 命令作为行为参考。记录该命令如何通过目录层级查找 package.json,以及在不存在文件或 packageManager 字段时会创建什么;当这两种行为都得到清晰描述时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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 https://github.com/nodejs/corepack/issues/607#issuecomment-2609834263 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 yarn@4.5.0)
jq .packageManager package.json
In this example case, the result is that:
-
packages/foo/package.jsoncontains{} -
package.jsoncontains{ "name": "tmp.IcgYOXK7aS", "packageManager": "yarn@4.5.0+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.jsonfile is determined. - Add text which describes how a
package.jsonfile and / or apackageManagerfield is created if they don't exist.
Related
- 主要语言
- TypeScript
- 星标
- 3.8k
- 派生
- 279
- 平均合并
- 1 小时 47 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nodejs/corepack 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 4/5 3-5 天 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 68/100
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100