Thinkmill / manypkg

☔️ An umbrella for your monorepo
MIT License
914 stars 49 forks source link

INVALID_PACKAGE_NAME & empty root workspace name #222

Open kachkaev opened 2 months ago

kachkaev commented 2 months ago

👋 folks!

I wonder if you would be interested in a small change to INVALID_PACKAGE_NAME.ts. The rule is triggered even if the root workspace is not named, but turning this rule off makes all workspace names non-lintable.

We could allow root package name to be empty. It's not referred to from other namespaces and not published on npm, so the name is not used anywhere in practice.

Suggestion:

https://github.com/Thinkmill/manypkg/blob/a01efc9c25900b7d21b6d517a2021b021f8b3922/packages/cli/src/checks/INVALID_PACKAGE_NAME.ts#L14-L15

 validate: (workspace) => { 
-   if (!workspace.packageJson.name) { 
+   if (!workspace.packageJson.name && workspace.relativeDir !== ".") { 

WYDT?

Andarist commented 2 months ago

We could allow root package name to be empty. It's not referred to from other namespaces and not published on npm, so the name is not used anywhere in practice.

It's not used-used but IIRC some package managers still require it. Perhaps we could double-check which ones do and which ones don't and allow anonymous roots with those that don't. I'm not inclined to do that investigation myself though :p