-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds the workspace documentation #632
Conversation
Deploy preview ready! Built with commit 477929f |
b9ccd5c
to
2adae37
Compare
lang/en/docs/workspaces.md
Outdated
|
||
{% 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Workspace/Workspaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only need to run
yarn install
once 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they can be installed from anywhere, actually, as long as you're in the workspace tree
lang/en/docs/workspaces.md
Outdated
|
||
### 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
lang/en/docs/workspaces.md
Outdated
|
||
### 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be suggest the packages/* pattern which is pretty common?
2adae37
to
2258763
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
lang/en/docs/workspaces.md
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remembered: it is important to mention the following too:
- Workspaces only works in private packages
- You can disable workspaces via setting
workspaces-experimental
tofalse
in.yarnrc
lang/en/docs/workspaces.md
Outdated
|
||
### 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: improve performance
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 |
lang/en/docs/workspaces.md
Outdated
workspaces-experimental false | ||
``` | ||
|
||
### Limitations & Caveheats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: caveats
7e39b34
to
7d3c6bf
Compare
7d3c6bf
to
477929f
Compare
The language
is a bit strong and could be interpreted as " |
No description provided.