Closed wojtekmaj closed 4 months ago
Duplicate of https://github.com/yarnpkg/berry/issues/6184
Doesn't seem to be the same kind of issue to me.
{
"name": "test-yarn",
"packageManager": "yarn@4.1.1",
"bin": {
"test-yarn": "./path/to/file"
}
}
⬇️
{
"name": "test-yarn",
"packageManager": "yarn@4.1.1",
"bin": "./path/to/file"
}
vs.
{
"name": "test-yarn",
"packageManager": "yarn@4.1.1",
"files": ["./path/to/file", "./another/path"]
}
⬇️
{
"name": "test-yarn",
"packageManager": "yarn@4.1.1",
"files": [
"./path/to/file",
"./another/path"
]
}
are very different. The former changes the structure, while the latter is formatting only.
Depends.
If you want to make this issue specifically about the --immutable
flag taking the formatting into account, then it's not a bug.
The --immutable
flag ensures that someone cloning your branch and running an install won't see spurious changes; whether those changes are semantic or syntactic doesn't matter: it'd be confusing either way ("should I commit those changes?").
Self-service
Describe the bug
Given a package.json formatted differently than to Yarn's liking, Yarn will reformat it, even on CI, even with
--immutable
option passed.To reproduce
yarn init
yarn
package.json
changes are revertedEnvironment
Additional context
It appears like package.json auto-formatting is undocumented and there is no way to turn it off. This causes hard to debug issues when working with Yarn & other tools, and possibly hurts the performance, too.