-
Notifications
You must be signed in to change notification settings - Fork 94
Use yarn workspaces #268
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
Use yarn workspaces #268
Conversation
Thank you! 🍕 I was just about to start working on it myself! I am looking forward to merge it ASAP, just need someone else to have a look at it. |
.gitignore
Outdated
npm-debug.log | ||
lerna-*.log | ||
npm-*.log | ||
yarn-*.log |
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.
Could you please change these 3 to simply *.log
?
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.
And also would be nice to add package-lock.json
.
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.
Could you please change these 3 to simply
*.log
?
Sure.
And also would be nice to add
package-lock.json
.
Could you please explain why?
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 make sure it won't be accidentally added in the future when someone installs deps with npm
.
d89bff3
to
07400b5
Compare
254dd29
to
523ab44
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.
Great! Would like someone else to have a look: @jvanbruegge @zcei @andywer
523ab44
to
acd8d80
Compare
acd8d80
to
1591443
Compare
"scripts": { | ||
"test": "lerna run test", | ||
"postinstall": "lerna bootstrap && link-parent-bin" |
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.
Why not hook up on the postinstall
hook?
Btw, we might not need lerna bootstrap
anymore if we run yarn
and have workspaces. We still need link-parent-bin
, though, since yarn also tends to fail to link bins installed in top-level node_modules.
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.
Are you sure yarn fails to link bins? Is there a way to test it?
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.
I set-up a few monorepos with yarn workspaces in the last couple of month and encountered that issue at least twice.
Not sure if there is a real way to test. But if a package has a dependency with a CLI tool (ava
for instance) and the dependency is installed in the monorepo-wide node_modules
, then I think the tool will always be missing from the packages
node_modules/.bin` as of now.
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.
But the tests are green... 🤔
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.
I've just installed this branch and yarn didn't create links for packages that are not in the root, so I guess this is the default behaviour. Why do you need it for by the way?
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.
Let's give it a try :)
Sorry, @andywer, what do you mean?
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.
I meant
So, should I remove the bootstrap script from the root package?
👉I think it should still work without lerna bootstrap
when using yarn and yarn workspaces. Let's try and see if that's so 😉
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.
@andywer Well, it works on my machine, tests are passing and build runs without any errors.
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.
Good enough for me 😅
But seriously, I think it does pretty much exactly the same, so let's get rid of one of them.
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.
lerna bootstrap
actually just uses yarn install when using workspaces, so +1 to killing any references to it.
@@ -1,4 +1 @@ | |||
declare var module : any | |||
declare var process : any | |||
|
|||
module.exports = process.env.TEST |
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.
I'd like to keep having something TypeScript specific in the app.ts
- currently we set the webpack config to read from app.ts
and have the ts block set up, but I think it would also work without, as it currently is valid JS.
Probably a simple
module.exports = process.env.TEST as string
would be enough
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.
@zcei What about this?
function add(a: number, b: number): number {
return a + b;
}
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.
Even better
Updated and merged. Thanks everyone for working on it! |
No description provided.