Skip to content
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

Update peer dependency from rest-ts-express to rest-ts-core #2

Closed
erikhofer opened this issue Nov 19, 2018 · 8 comments
Closed

Update peer dependency from rest-ts-express to rest-ts-core #2

erikhofer opened this issue Nov 19, 2018 · 8 comments

Comments

@erikhofer
Copy link

"rest-ts-core": "^0.0.2"

It still works but npm shows a warning:

npm WARN rest-ts-express@0.0.7 requires a peer of rest-ts-core@^0.0.2 but none was installed.

Can lerna do this automatically?

@erikhofer
Copy link
Author

Same for axios:

"rest-ts-core": "^0.0.2"

@erikhofer
Copy link
Author

This seems to be intended: lerna/lerna#1575
Maybe use normal dependency instead of peer?

@hmil
Copy link
Owner

hmil commented Nov 30, 2018

Yes, I think I will do that.

@hmil
Copy link
Owner

hmil commented Nov 30, 2018

Thanks for binging this up!

@hmil
Copy link
Owner

hmil commented Nov 30, 2018

It's the first time I'm using lerna and I have to say I'm pretty disappointed. I've used Makefiles so far and I think I'll just go back to that because lerna is not helping at all, it's just adding useless overhead.

Now, for the problem in this issue. I will keep the dependency as a "peerDependency" with the caret range because it suits the use case of this module quite well. Then the release script should take care to update the actual version in the peerDependencies block.

@erikhofer
Copy link
Author

I think lerna is great for managing dependencies between different packages in a monorepo. Do you think it's worth it to implement the functionality of lerna manually, e.g. the creation of symlinks for dependencies?

Also what is the reasoning for using peerDependencies across different parts of the same project?

@hmil
Copy link
Owner

hmil commented Nov 30, 2018

In this repo I'm not sharing code across the projects, so it doesn't really matter if I have a symlink or not. A simple "baseURL": ".." in tsconfig.json would do the trick with much less complexity.

Besides, even for projects that share code, I've use a different system based on a combination of baseURL and NODE_PATH which I describe in details here: https://blog.hmil.fr/2018/05/TypeScript-project-structure2/ .

Maybe lerna reduces the boilerplate and makes publishing easier, but at the same time it requires prior knowledge of the tool. Like here, if I want to know how to update the cross-dependencies of my project, it'll require hours of googling. I'm better off rolling my own system and this way I can tweak it at ease.

Also what is the reasoning for using peerDependencies across different parts of the same project?

By using peerDependencies I let the consumer of my library chose which exact version they want to roll. Usually they'll set everything to the same version, but imagine there's a feature they need in rest-ts-axios@2.1.1 but there is a bug in rest-ts-core@2.1.1. They can easily downgrade to rest-ts-core@2.0.2 and keep rest-ts-axios@2.1.1, if I use peerDependencies with caret range. With hard dependencies there is no escape hatch.

@hmil hmil closed this as completed Dec 1, 2018
@hmil
Copy link
Owner

hmil commented Dec 2, 2018

Hey @erikhofer ,

I made a bunch of modifications over the week-end, including a lot of bug fixes. I also changed the way you create the express router to use a builder instead of a plain object hash. It's supposed to help provide better auto-completion than the previous solution.

If you are still using this library, please check out the latest version and let me know what you think!

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

No branches or pull requests

2 participants