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

Automatically search for types before npm install of a package #44

Closed
cryptiklemur opened this issue Nov 28, 2019 · 8 comments
Closed

Comments

@cryptiklemur
Copy link

This may already be possible with yarn, but it would be nice to be able to have typesync search for type packages to install before installing a requested package, so they all get installed at the same time.

Would seem that npm/cli#481 is required for this on npm.

https://docs.npmjs.com/misc/scripts#hook-scripts might also work?

@jeffijoe
Copy link
Owner

That sounds like something you could do with a bash script and without typesync by doing npm install @types/package; npm install package.

@cryptiklemur
Copy link
Author

That’s not what I want. Problems with that not-withstanding, I don’t want to use another script. I want typesync to integrate with npm/yarn

@jeffijoe
Copy link
Owner

Closing as out of scope. Unix philosophy of composition applies here.

@cryptiklemur
Copy link
Author

Thats a bummer. One of the flaws of Unix, in general, is the lack of focus on UX/DX. Stuff like "composition" requirement philosophies cause that.

@karlhorky
Copy link
Contributor

You could set something pretty similar up for yourself with postinstall, as I mentioned in #63

@cryptiklemur
Copy link
Author

postinstall still requires running npm i or yarn again. which ends up running this again. Its a pretty bad UX

@karlhorky
Copy link
Contributor

Ahh, I guess you mean the following:

  • yarn add styled-components
  • postinstall automatically runs typesync, which adds @types/styled-components to the package.json
  • then yarn needs to be run again, in order to install them again

That makes sense, for sure!

I suppose one workaround for now would be to do the postinstall like this: typesync && yarn. Not ideal (two install cycles), but it works.

Like you mention, a preinstall hook or similar would be much better!

@karlhorky
Copy link
Contributor

I'll add this to the other issue too.

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

3 participants