Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport Yarn workspaces to replace bootstrap command #899
Conversation
This comment has been minimized.
This comment has been minimized.
Cool thanks @bestander! |
This comment has been minimized.
This comment has been minimized.
Thanks @bestander! |
bestander
changed the title
WIP: Support Yarn workspaces to replace bootstrap command
Support Yarn workspaces to replace bootstrap command
Jun 29, 2017
This comment has been minimized.
This comment has been minimized.
@hzoo @evocateur this is ready for review. |
This comment has been minimized.
This comment has been minimized.
Bnaya
commented
Jun 30, 2017
@bestander Thanks for the great work! |
This comment has been minimized.
This comment has been minimized.
@Bnaya we are turning it on for jest here facebook/jest#3906. |
bestander
force-pushed the
bestander:yarn-workspaces
branch
from
8d93488
to
3d6f874
Jun 30, 2017
This comment has been minimized.
This comment has been minimized.
jquense
commented
Jul 5, 2017
yarn 27.0 is out yeah? can we merge this? I'd like to give it a shot |
This comment has been minimized.
This comment has been minimized.
Yes, 0.27 is out and marked as stable. |
This comment has been minimized.
This comment has been minimized.
looking now, thanks for understanding |
evocateur
requested changes
Jul 5, 2017
Apologies for the delay! |
@@ -840,6 +840,23 @@ May also be configured in `lerna.json`: | |||
} | |||
``` | |||
|
|||
#### --yarnWorkspaces |
This comment has been minimized.
This comment has been minimized.
evocateur
Jul 5, 2017
Member
I think this would be clearer as --use-workspaces
, with the long-term goal of making it client-independent.
This comment has been minimized.
This comment has been minimized.
{ | ||
... | ||
"npmClient": "yarn", | ||
"yarnWorkspaces": ["bootstrap"] |
This comment has been minimized.
This comment has been minimized.
evocateur
Jul 5, 2017
Member
I don't think this is an appropriate place to whitelist commands; that's an implementation detail if workspaces are enabled at all. In this PR alone there's already an implicit "ls"
member in this array, and that's not very clear. The useWorkspaces
(the camelization of --use-workspaces
) value should be a boolean.
This comment has been minimized.
This comment has been minimized.
@@ -55,6 +55,9 @@ export default class Repository { | |||
} | |||
|
|||
get packageConfigs() { | |||
if (this.lernaJson.yarnWorkspaces) { |
This comment has been minimized.
This comment has been minimized.
evocateur
Jul 5, 2017
Member
This isn't sufficient because it doesn't pick up any potential --use-workspaces
flag in the CLI args, only the "durable" config from a lerna.json
(mostly equivalent to the relationship of yarn
to a .yarnrc
file, CLI flags always supersede the lerna.json
values).
This comment has been minimized.
This comment has been minimized.
const { yarnWorkspaces } = this.options; | ||
|
||
if (yarnWorkspaces && (yarnWorkspaces.indexOf("bootstrap") >= 0)) { | ||
this.installRootPackageOnly(callback); |
This comment has been minimized.
This comment has been minimized.
evocateur
Jul 5, 2017
Member
No symlinking happens in this case? Or is that handled by Yarn now? (I dug through yarnpkg/yarn#3294 but my eyes glazed over before I could figure it out, sorry)
This comment has been minimized.
This comment has been minimized.
bestander
Jul 5, 2017
Author
Contributor
Yep, workspaces feature in Yarn creates symlinks in node_modules.
It also treats all workspaces as one installation, so it would hoist symlinks to the root node_modules unless there is a conflict, e.g. jest@next might be using jest-cli@stable in the root.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks @evocateur, no need to apologize. |
This comment has been minimized.
This comment has been minimized.
@evocateur, I've switched to --use-workspaces and tested that it works as a CLI config as well. |
bestander
added some commits
Jun 27, 2017
bestander
force-pushed the
bestander:yarn-workspaces
branch
from
2a663ac
to
a003740
Jul 5, 2017
This comment has been minimized.
This comment has been minimized.
I don't think my PR is responsible for appveyor fail |
This comment has been minimized.
This comment has been minimized.
Oh, npm 5 strikes again.
Export |
This comment has been minimized.
This comment has been minimized.
That's a great idea! Is that documented anywhere? I'm not against including
that fix in this PR.
…On Wed, Jul 5, 2017 at 9:53 PM, Simen Bekkhus ***@***.***> wrote:
Oh, npm 5 strikes again.
"lerna info version __TEST_VERSION__
+package-3: ┌───────────────────────────────────────────────────────────────┐
+package-3: │ npm update check failed │
+package-3: │ Try running with sudo or get access │
+package-3: │ to the local update config store via │
+package-3: │ sudo chown -R $USER:$(id -gn $USER) C:\\Users\\appveyor\\.config │
+package-3: └───────────────────────────────────────────────────────────────┘
Export NO_UPDATE_NOTIFIER in the tests?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#899 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAV5SyAgrZCxbecRqfYQsfiidSqZLXDks5sLGhigaJpZM4OGFNC>
.
|
This comment has been minimized.
This comment has been minimized.
https://github.com/yeoman/update-notifier#user-settings I also sent a PR to skip the check on CI automatically. Not sure if it will be accepted, though. yeoman/update-notifier#116 |
evocateur
approved these changes
Jul 6, 2017
Thanks @bestander! |
evocateur
merged commit 616e44c
into
lerna:master
Jul 6, 2017
evocateur
added
the
Tag: Enhancement
label
Jul 6, 2017
SimenB
reviewed
Jul 6, 2017
{ | ||
... | ||
"npmClient": "yarn", | ||
"use-workspaces": true |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks a lot, guys! |
hzoo
reviewed
Jul 6, 2017
@@ -840,6 +840,22 @@ May also be configured in `lerna.json`: | |||
} | |||
``` | |||
|
|||
#### --use-workspaces | |||
|
|||
Enables integration with [Yarn Workspaces](https://github.com/yarnpkg/rfcs/blob/master/implemented/0000-workspaces-install-phase-1.md) (available since yarn@0.27+). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Nice work everyone! |
This comment has been minimized.
This comment has been minimized.
jquense
commented
Jul 6, 2017
•
@bestander sorry to ping you here, but it doesn't seem like wonderful feature tho, i'm really excited about it ! |
This comment has been minimized.
This comment has been minimized.
@jquense, might be a bug in Yarn. |
This comment has been minimized.
This comment has been minimized.
Bnaya
commented
Jul 6, 2017
I have it up and running in my project, with my .bin files in the appropriate places |
SimenB
reviewed
Jul 7, 2017
@@ -55,6 +55,9 @@ export default class Repository { | |||
} | |||
|
|||
get packageConfigs() { | |||
if (this.lernaJson.useWorkspaces) { | |||
return this.packageJson.workspaces; |
This comment has been minimized.
This comment has been minimized.
SimenB
Jul 7, 2017
•
Contributor
|| [DEFAULT_PACKAGE_GLOB];
? This is not mentioned in the readme, so everything went boom when I tried to use this
This comment has been minimized.
This comment has been minimized.
bestander
Jul 7, 2017
Author
Contributor
Yarn does not have a default (PR welcome ;), so it would boom there if this setting is missing.
There is a comment about package.json/workspaces
being used instead of packages
https://github.com/lerna/lerna#--use-workspaces
This comment has been minimized.
This comment has been minimized.
Bnaya
referenced this pull request
Jul 7, 2017
Closed
When using with workspaces, yarn ignores nohoist settings #909
This comment has been minimized.
This comment has been minimized.
thomasfr
commented
Jul 10, 2017
•
Is it possible to exclude some node modules from beeing hoisted to the root folder? Like the lerna But besides that. Awesome work. Cuts the installation time by half with yarn workspaces for us!! From ~2minutes down to 58secs |
This comment has been minimized.
This comment has been minimized.
jquense
commented
Jul 10, 2017
I don't think so regarding no-hoist since that's how yarn workspaces work and lerna is defering to it. |
This comment has been minimized.
This comment has been minimized.
jquense
commented
Jul 11, 2017
So i've done some more testing. It appears like yarns install with workspaces doesn't different things from lerna bootstrap. The big things i've notice are:
I've tried a bunch of different configs and setups with the same results. As a replacement for |
This comment has been minimized.
This comment has been minimized.
Thanks, @jquense. |
This comment has been minimized.
This comment has been minimized.
thomasfr
commented
Jul 12, 2017
Just fyi i created an issue for |
This comment has been minimized.
This comment has been minimized.
So is |
marionebl
referenced this pull request
Nov 18, 2017
Closed
[question] Using yarn commands with non-published lerna dependencies #501
kiriappeee
referenced this pull request
Feb 7, 2018
Open
Upgrading Node to `8.9.4` and/or upgrading the `yarn` version in the image #262
evocateur
referenced this pull request
Mar 13, 2018
Closed
lerna bootstrap failing as a postinstall step with yarn workspaces #1308
tech4him1
referenced this pull request
Sep 1, 2018
Open
Package has both yarn.lock and package-lock.json #1516
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Dec 27, 2018
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
bestander commentedJun 27, 2017
•
edited
Description + Motivation and Context
Yarn has a Workspaces feature that implements Lerna's bootstrap logic in a nice "more atomic" and more native from a package manager point of view way.
The progress and all the links to the feature is here yarnpkg/yarn#3294.
Workspaces are still considered "experimental" but we are moving forward and are ready to turn it on for a couple of projects, e.g. facebook/jest#3906.
This PR integrates Yarn workspaces with Lerna by replacing all the bootstrap/hoisting logic with a simple call to
yarn install
.Also it makes Lerna use package.json/workspaces field as Yarn does.
How Has This Been Tested?
../lerna/bin/lerna.js bootstrap
Types of changes
Checklist: