-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Integrated with Yarn workspaces #3906
Conversation
We need to bump Yarn 0.27 to stable to fix CI. |
This is super sweet @bestander! Mind rebasing and giving me an update on what the remaining problems are on this diff? |
@cpojer will do. |
If I recall correctly we're already using os. tmpdir in some of integration tests so I'm not opposed to do it in this case. |
Yep, I'm fine with it also. |
Waiting for Yarn 0.27.2 release to be stable so that CI would run installation correctly |
@bestander is yarn stable now? |
Yes
…On Tue, Jul 4, 2017 at 10:47 AM Michał Pierzchała ***@***.***> wrote:
@bestander <https://github.com/bestander> is yarn stable now?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3906 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWMiDz9h7tLKElwPrEsWAls1iychmks5sKnqwgaJpZM4OEsZ->
.
|
Would you mind rebasing this diff when you have a while? :) |
Will do today.
Do you have any background on the es5 tests that are failing?
It seems like hoisting of workspace folders to the root affects the bundle
…On Tue, Jul 4, 2017 at 11:22 AM Michał Pierzchała ***@***.***> wrote:
Would you mind rebasing this diff when you have a while? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3906 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWFpGJ-GlNi3157_dbOFXiaKpnUs_ks5sKoLdgaJpZM4OEsZ->
.
|
It passes locally, I've rebased and restarted the build, we'll see :) |
Thanks, mate
…On Tue, Jul 4, 2017 at 11:55 AM Michał Pierzchała ***@***.***> wrote:
It passes locally, I've rebased and restarted the build, we'll see :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3906 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWMRFwBodTHAXgufq2GpW9RvPMhCAks5sKoqdgaJpZM4OEsZ->
.
|
Sound weird that this affects the rollup build, but now I'm super happy that I added the eslint check. 😊 Have you looked into the es5 build for each package and see if they all contains un-transpiled code? |
Looking into the bundle reveals that I guess this will happen as node library authors are targeting newer version of node. |
Yes it fails locally if you clean repo from all node_modules in packages
…On Tue, Jul 4, 2017 at 1:16 PM Kenneth Skovhus ***@***.***> wrote:
@bestander <https://github.com/bestander> does it also fail locally?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3906 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWDd2TZN2UKeMAok5b8-BvtSqsTEhks5sKp2GgaJpZM4OEsZ->
.
|
This patch solves the problem by also running Babel on From b62040420421da46de054e7b9afc25649b45700d Mon Sep 17 00:00:00 2001
From: Kenneth Skovhus <kenneth.skovhus@gmail.com>
Date: Tue, 4 Jul 2017 22:39:04 +0200
Subject: [PATCH] Fix browser build (ansi-styles contains ES2015 code)
---
scripts/browserBuild.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/browserBuild.js b/scripts/browserBuild.js
index ac43ca0..db1b4a2 100644
--- a/scripts/browserBuild.js
+++ b/scripts/browserBuild.js
@@ -20,7 +20,7 @@ const babelEs5Options = Object.assign(
{},
{
babelrc: false,
- exclude: 'node_modules/**',
+ exclude: 'node_modules/babel-runtime/**',
plugins: [
'syntax-trailing-function-commas',
'transform-flow-strip-types',
--
2.10.2 @thymikee @bestander |
@@ -5,15 +5,17 @@ environment: | |||
install: | |||
- ps: Install-Product node $env:nodejs_version x64 | |||
- node --version | |||
- yarn --version | |||
- yarn install | |||
- curl -fsSL -o yarn.js https://github.com/yarnpkg/yarn/releases/download/v0.27.5/yarn-0.27.5.js |
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.
Wouldn't npm install --global yarn@0.27.5
be nicer here than node ./yarn.js
?
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.
Then we would need to be sure that npm global dir precedes appveyor's global Yarn installation in PATH.
I don't have a strong opinion on this and happy to change to anything that maintainers think is best.
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.
To me it is just more standard to rely on a global yarn installation. I hope appveyour global Yarn installation will be overridden by a npm install -g
.
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.
So what should I do here, npm install -g
?
@@ -1,727 +0,0 @@ | |||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. |
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.
Does this mean that each package dependencies are not locked by a yarn.lock
file?
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.
Ah, yes. 😎
Unlike Lerna Yarn hoists workspaces to the root node_modules.
packages/jest-diff/yarn.lock
Outdated
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" | ||
|
||
ansi-styles@^2.2.1: |
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.
This is the reason why the ES5 build fails as jest-diff
used to use ansi-styles@2.x
and now is uses whatever the global jest
package.json defines (which is ansi-styles@3.0.0
)...
Why don't we want these lock files anymore? This might cause other issues as all packages dependencies might have changed.
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 read you description again @bestander and some of the Yarn Workspace RFCs. I guess removing the packages lockfiles and node_modules is exactly what you means by
Unlike Lerna Yarn hoists workspaces to the root node_modules.
: )
Can we whitelist only the node_moduels that are not ES5 compliant and transform those? I'd much rather compile only one or two that need it, rather than all of them. |
@cpojer a whitelist might be a moving target, but probably a better option. 👍🏻 This works: - exclude: 'node_modules/**',
+ exclude: 'node_modules/!(ansi-styles|remove-trailing-separator)/**',
|
Yeah let's do this. It's fine with me if we have to update this list from time to time. |
lerna.json
Outdated
"packages": [ | ||
"packages/*" | ||
] | ||
"yarnWorkspaces": ["bootstrap"] |
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.
Waiting for the Lerna PR to merge first
Thanks a lot, @skovhus, this fixed the build. The way rollup picks modules is a bit concerning though, it all goes down to what structure is inside the root node_modules and it is conforms with Node.js resolution, not for browser builds for each package in isolation We might rethink how those jest-mock and jest-matchers are built. |
Codecov Report
@@ Coverage Diff @@
## master #3906 +/- ##
==========================================
+ Coverage 59.87% 60.13% +0.26%
==========================================
Files 196 195 -1
Lines 6794 6736 -58
Branches 6 6
==========================================
- Hits 4068 4051 -17
+ Misses 2723 2682 -41
Partials 3 3
Continue to review full report at Codecov.
|
Are we good to go on this one? Is the latest version stable and rolled out so that people can use this feature? |
I was able to install yarn 0.27.5 through |
we can put "engines" entry in package.json though |
A lot of dependencies might have been bumped in all packages as dependencies are resolved from outer package.json file now. But I guess this is fairly safe due to the test coverage we have. |
@thymikee, "engines" probably won't do much, in latest npm it is not strict. |
Updates Lerna to 2.0.0, it supports workspaces now |
And I'm getting another error about |
Should be green now again. |
@bestander has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Woohoo, awesome work @bestander! |
* enabled workspaces * updated lerna to 2.0.0 with workspaces support
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Yarn 0.27 has workspaces feature that should be a better alternative to Lerna boostrapping.
Yarn workspaces still don't replace Lerna (and probably won't do it completely for a long time), so Lerna publishing is still used for Jest.
This PR replaces Lerna bootstrap phase with Yarn workspaces.
Things to discuss:
It means that integration/examples test don't run in isolation from the workspace root so I removed symlinking to babel-jest et al. at the tests boostrapping.
One test
integration_tests/__tests__/transform.test.js
required to be running in isolation, so I changed the test bootstrap to execute on a copy on a temp folder.Known issues:
Test plan
yarn run publish
and lerna seems to handle version bumping and npm publishing correctly