Workspace naming is confusing #510
-
I may be missing something obvious, but why aren't packages within a workspace defined as such? There are contradictions among the documentation which interchanges between packages and workspaces. First off for me a workspace is the top-level folder which holds all of the packages that you work in. But the inner packages which can be published to npm are packages. In dictionary we have a definition:
So my understanding here is top-level workspace is a package that containers configuration defining more (inner) workspaces. So it sounds like the inner packages are also called workspaces? But the example lists them as packages. {
"name": "workspace-example",
"version": "1.0.0",
"workspaces": {
"packages": [
"packages/*"
]
}
} So are they packages or workspaces?
and the motivation
Notes |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 20 replies
-
Fwiw that's not the case in Yarn, which is perhaps the main way the JS ecosystem is exposed to workspaces. To quote the nomenclature from our documentation:
I would discourage you from deviating from this definition if you intend to keep the
This is one article, versus years of consistent usage. Articles can make mistakes too. |
Beta Was this translation helpful? Give feedback.
-
Naming things is hard. Human language is a slippery beast at best. (This is similar to the module/package/dependency semantic rats' nest, and occasionally gets entangled with it.) We have been trying to converge on this terminology, which I believe is compatible with Yarn's semantics:
Within npm's internals (particularly Arborist), we also have the following more technical definitions:
npm does not (yet?) have a concept of "worktrees". I do not personally have any strong opinion on how these terms are defined, but I am very much in agreement with @arcanis that it's valuable to have npm and yarn be in sync here. Since yarn implemented workspaces a few years ahead of npm, yarn has set the definitions, and that's fine. Changing them now seems like it would not be worthwhile. I am willing to bet that some of npm's documentation is currently using these terms imprecisely or even incorrectly. Those cases are documentation bugs that should be fixed. I do realize that lerna predates yarn, and yarn deviated from lerna's naming conventions. But (a) npm is more like yarn than it is like lerna, and (b) we have to pick one to follow, and we picked yarn, and here we are. Picking lerna's definitions instead would have also been fine, but it's not how it went. |
Beta Was this translation helpful? Give feedback.
Naming things is hard. Human language is a slippery beast at best. (This is similar to the module/package/dependency semantic rats' nest, and occasionally gets entangled with it.)
We have been trying to converge on this terminology, which I believe is compatible with Yarn's semantics:
project
orproject root
- The parent directory where you run npm commands, which has a package.json, and is typically the root of the git repository. This may include aworkspaces
definition in its package.json file. This may be a published package, or just a parent of workspaces that does not define any other functionality of its own. If it definesworkspaces
in package.json, then you may use npm commands …