Skip to content

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

Merged
merged 8 commits into from
Apr 23, 2018
Merged

Conversation

dmitmel
Copy link
Contributor

@dmitmel dmitmel commented Apr 21, 2018

No description provided.

@vlad-zhukov vlad-zhukov added this to the 2.0.0 milestone Apr 21, 2018
@vlad-zhukov vlad-zhukov mentioned this pull request Apr 21, 2018
17 tasks
@vlad-zhukov
Copy link
Collaborator

vlad-zhukov commented Apr 21, 2018

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
Copy link
Collaborator

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

@dmitmel dmitmel force-pushed the feature/yarn-workspaces branch from d89bff3 to 07400b5 Compare April 21, 2018 18:40
@dmitmel dmitmel force-pushed the feature/yarn-workspaces branch 2 times, most recently from 254dd29 to 523ab44 Compare April 21, 2018 19:03
Copy link
Collaborator

@vlad-zhukov vlad-zhukov left a 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

@dmitmel dmitmel force-pushed the feature/yarn-workspaces branch from 523ab44 to acd8d80 Compare April 21, 2018 20:12
@dmitmel dmitmel force-pushed the feature/yarn-workspaces branch from acd8d80 to 1591443 Compare April 21, 2018 21:14
"scripts": {
"test": "lerna run test",
"postinstall": "lerna bootstrap && link-parent-bin"
Copy link
Owner

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.

Copy link
Collaborator

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?

Copy link
Owner

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.

Copy link
Owner

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... 🤔

Copy link
Collaborator

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?

Copy link
Contributor Author

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?

Copy link
Owner

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 😉

Copy link
Contributor Author

@dmitmel dmitmel Apr 22, 2018

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.

Copy link
Owner

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.

Copy link

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
Copy link
Collaborator

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

Copy link
Contributor Author

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;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better

@vlad-zhukov vlad-zhukov merged commit 65eb792 into andywer:release-2.0 Apr 23, 2018
@vlad-zhukov
Copy link
Collaborator

Updated and merged. Thanks everyone for working on it!

@dmitmel dmitmel deleted the feature/yarn-workspaces branch April 23, 2018 19:35
andywer pushed a commit that referenced this pull request Jun 19, 2018
marcofugaro pushed a commit to marcofugaro/webpack-blocks that referenced this pull request Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants