jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.51k stars 21 forks source link

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

Closed cryptiklemur closed 4 years ago

cryptiklemur commented 4 years ago

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 https://github.com/npm/cli/issues/481 is required for this on npm.

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

jeffijoe commented 4 years ago

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

cryptiklemur commented 4 years ago

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 commented 4 years ago

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

cryptiklemur commented 4 years ago

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 commented 3 years ago

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

cryptiklemur commented 3 years ago

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

karlhorky commented 3 years ago

Ahh, I guess you mean the following:

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 commented 3 years ago

I'll add this to the other issue too.