This code prevents you from running this tool when your top-level package.json has an empty name field. There's a note saying this shouldn't matter because "npm won't let a package without name be published", but when I'm running against a local directory, my top-level package.json isn't something which is necessarily going to be published.
Concretely, my workflow for local projects is usually echo '{}' > package.json; npm i stuff. That all works fine without a name field. I wouldn't add a name unless I was actually going to publish on npm.
It looks like the check + warning happens too soon and might be delayed to where package.name is required. At least the root package should be allowed to have no name
This code prevents you from running this tool when your top-level
package.json
has an emptyname
field. There's a note saying this shouldn't matter because "npm won't let a package without name be published", but when I'm running against a local directory, my top-level package.json isn't something which is necessarily going to be published.Concretely, my workflow for local projects is usually
echo '{}' > package.json; npm i stuff
. That all works fine without aname
field. I wouldn't add a name unless I was actually going to publish on npm.