Open mathio opened 1 year ago
I don't think so (that there should be any default for version), as npm docs say: If you plan to publish your package, the most important things in your package.json are the name and version fields as they will be required.
You are right. However with semantic-release you may omit the version
in your package.json
because it manages it on its own via git tags (as mentioned in semantic-release FAQ). I use yalc
for such package locally. However maybe I could add "version": "0.0.0"
to package.json
for compatibility 🤔
If you want to enforce version
maybe we could update this check:
if (!pkg.name && pkg.version) {
console.log(
'Package manifest',
packagePath,
'should contain name and version.'
)
return null
}
To this:
if (!pkg.name || !pkg.version) { // <-- check if name or version is missing
console.log(
'Package manifest',
packagePath,
'should contain name and version.'
)
return null
}
Does that make sense?
When no version is provided in package manifest (eg. project is using semantic release) use version
0.0.1
as defaultCurrently when I run
yalc publish
in project without version I get an error: