Adds the workspace documentation#632
Conversation
|
Deploy preview ready! Built with commit 477929f |
b9ccd5c to
2adae37
Compare
|
|
||
| {% include vars.html %} | ||
|
|
||
| Workspace are a new way to setup your package architecture that's available by default starting from Yarn 1.0. It allows you to setup multiple packages in such a way that you only need to run `yarn install` once to install all of them in a single pass. |
There was a problem hiding this comment.
you only need to run
yarn installonce to install all of them in a single pass
you only need to run yarn install at the root, to install everything in a single pass.
There was a problem hiding this comment.
they can be installed from anywhere, actually, as long as you're in the workspace tree
|
|
||
| ### Why would you want to do this? | ||
|
|
||
| - Your dependencies can be linked together, which means that a workspace can depend on another and always use the most up-to-date version of it, without having to run `yarn install` again like with the `file:` protocol, and with better safety mechanisms than with `yarn link`. |
There was a problem hiding this comment.
Better to split into two sentences:
Your dependencies can be linked together, which means a workspace can depend on another and use the latest version of it from the monorepo. This is also a safer mechanism than yarn link since yarn now keeps track of actual dependencies along with versions even if they are linked locally.
|
|
||
| ### Tips & Tricks | ||
|
|
||
| - The `workspaces` field is an array containing the paths to each workspace. Since it might be tedious to keep track of each of them, this field also accepts glob patterns! |
There was a problem hiding this comment.
May be suggest the packages/* pattern which is pretty common?
2adae37 to
2258763
Compare
|
|
||
| Yarn's workspaces are the low-level primitives that tools like Lerna can (and [do](https://github.com/lerna/lerna/pull/899)!) use. They will never try to support the high-level feature that Lerna offers, but by implementing the core logic of the resolution and linking steps inside Yarn itself we hope to enable new usages and improve performances. | ||
|
|
||
| ### Tips & Tricks |
There was a problem hiding this comment.
Just remembered: it is important to mention the following too:
- Workspaces only works in private packages
- You can disable workspaces via setting
workspaces-experimentaltofalsein.yarnrc
|
|
||
| ### How does it compare to Lerna? | ||
|
|
||
| Yarn's workspaces are the low-level primitives that tools like Lerna can (and [do](https://github.com/lerna/lerna/pull/899)!) use. They will never try to support the high-level feature that Lerna offers, but by implementing the core logic of the resolution and linking steps inside Yarn itself we hope to enable new usages and improve performances. |
2258763 to
7e39b34
Compare
|
@Haroenv is there something to do for this page to appear on https://deploy-preview-632--yarnpkg.netlify.com/en/docs? It seems automatic since the code of this page is blank, but I don't see it appear :( |
|
yes, seems like that data file needs to be filled for it to render correctly, see https://deploy-preview-632--yarnpkg.netlify.com/en/docs/workspaces |
| workspaces-experimental false | ||
| ``` | ||
|
|
||
| ### Limitations & Caveheats |
7e39b34 to
7d3c6bf
Compare
7d3c6bf to
477929f
Compare
|
The language
is a bit strong and could be interpreted as " |
No description provided.