jsenv / importmap-node-module

Generate importmap for node_modules
33 stars 4 forks source link

Why require `name` in the top-level package.json? #62

Closed bakkot closed 1 year ago

bakkot commented 1 year ago

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.

dmail commented 1 year ago

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

dmail commented 1 year ago

I'm planning to work on this during the week