-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug]: Disable formatting of package.json bin object to string #6184
Comments
I believe the code change needs to be made in Manifest.ts berry/packages/yarnpkg-core/sources/Manifest.ts Lines 825 to 827 in a3e5695
|
npm v10 currently emits warning during publish 🦋 error npm WARN publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.
🦋 error npm WARN publish errors corrected:
🦋 error npm WARN publish "bin" was converted to an object This was observed in aws/aws-sdk-js-codemod#818 (comment) |
I'm a little hesitant to make this change in Yarn since this warning is a client-side message that a third-party tool emits ( Yarn sends the same metadata as the ones contained in the tarball to the registry, so we don't have reasons to make this change (by contrast npm was turning the field into an object during publish, so for them it makes sense to stop doing that). |
The request in this issue is not to format Right now, yarn package manage forces authors to use short form. |
Yes, but that's not the only change we perform. For instance we also normalize the |
Perhaps it would be possible to have an option which simply disables styling? I mean, one can use |
This puts us in an inconvenient place where we are forced to use Note: build artifacts/archives are usually used in CI pipelines to pass the packages between different jobs. This allows to publish the exact version that was package and tested and avoid rebuilding the package during release, where there would be a risk of building it in a different way/context than the one that was tested. |
This behavior of forcing styling on package.json is personally annoying since it conflicts with other formatters in our hooks, causing a bunch of back and forth for no reason. I don't see why tampering with the format (inserting line breaks) should be the default behavior when running yarn. |
This has been tripping me up on a couple of occasions too. I would love for yarn to follow npm's lead here. But of course I don't have the full picture that the Yarn maintainers have, so I don't want to come across as too pushy or entitled here 🙂 |
I see the point here, but I have a package that has name with scope like |
Yes, because the implicit bin name is always the package name without its scope (otherwise the slash would make it impossible to add to the PATH). |
Thanks for the reply. I could not find information about such behavior. |
Self-service
Describe the bug
Yarn package formats package.json
bin
object to string, when there's single executable same as the name of the package.Although this is recommended in npm documentation at the time of issue creation, it is going to be removed as per npm/package-json#83 (comment)
To reproduce
Environment
System: OS: macOS 14.0 CPU: (8) arm64 Apple M1 Pro Binaries: Node: 20.11.1 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-8dd2dbeb/node Yarn: 4.1.1 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-8dd2dbeb/yarn npm: 10.2.4 - ~/Library/Caches/fnm_multishells/42983_1711069674367/bin/npm
Additional context
No response
The text was updated successfully, but these errors were encountered: