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

Feature: Don't require version if package has "private": true #84

Closed
altano opened this issue Mar 29, 2024 · 5 comments · Fixed by #87
Closed

Feature: Don't require version if package has "private": true #84

altano opened this issue Mar 29, 2024 · 5 comments · Fixed by #87
Labels
good first issue Good for newcomers, please hop on! 🙌 status: accepting prs Please, send a pull request to resolve this! 🙏 type: feature New enhancement or request 🚀

Comments

@altano
Copy link

altano commented Mar 29, 2024

While it is valid for a private package ("private": true) to have a version, it certainly shouldn't require one.

Tools like changeset require that you remove the private package version number (instead of, say providing a useless one like 0.0.1) or it will try to manage that version, even if the package is private. Ideally this package would just allow no versions on private packages.

(Moving the discussion from JoshuaKGoldberg/eslint-plugin-package-json#250 to here)

@altano
Copy link
Author

altano commented Mar 29, 2024

BTW the README for this project mentions an option to pick which spec to use, with "npm" being the default.

Where is the npm package.json spec? I can't find it.

@JoshuaKGoldberg
Copy link
Owner

👍 from me on this. The npm docs in https://docs.npmjs.com/cli/v10/configuring-npm/package-json#version say:

If you don't plan to publish your package, the name and version fields are optional.

Ignoring whether skipping the name is ok even if it's optional, skipping version seems like a straightforward "yes". Thanks for filing!

@JoshuaKGoldberg JoshuaKGoldberg added type: feature New enhancement or request 🚀 status: accepting prs Please, send a pull request to resolve this! 🙏 good first issue Good for newcomers, please hop on! 🙌 labels Mar 29, 2024
@JoshuaKGoldberg
Copy link
Owner

Where is the npm package.json spec? I can't find it.

I don't believe there's a spec more specific than what's linked in the README: docs.npmjs.com. I've never seen one at any rate.

@altano
Copy link
Author

altano commented Apr 2, 2024

FWIW I went back to having a version of "0.0.0" in my private packages because pnpm won't publish packages that have dev dependencies on private packages without a version, for some reason. I was also able to get changesets to ignore these private, versioned packages so I'm a happy camper. (pnpm/pnpm#5094)

I still think this feature request is a good idea for this package, so I'm not closing the issue. Just thought I'd call out that I'm not clamoring for it.

@JoshuaKGoldberg
Copy link
Owner

Published in package-json-validator@0.6.5. Thanks for the issue @altano and PR @hyoban! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers, please hop on! 🙌 status: accepting prs Please, send a pull request to resolve this! 🙏 type: feature New enhancement or request 🚀
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants