jeffijoe / typesync

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

Add `postinstall` script recommendation in readme #63

Closed karlhorky closed 3 years ago

karlhorky commented 3 years ago

Hi, thanks for this project, really cool!

What are your thoughts on using typesync in a postinstall script? So that @types packages are installed automatically?

If https://github.com/jeffijoe/typesync/issues/46 gets implemented with "removing unused types", then it may be a good idea to recommend postinstall-postinstall for users of Yarn.

jeffijoe commented 3 years ago

46 should be possible now with the --ignorepackages option

karlhorky commented 3 years ago

Ok, and about the postinstall idea? Have any thoughts?

jeffijoe commented 3 years ago

I haven't tried it so I can't speak for it. I have heard, though, that postinstall are a can of worms.

karlhorky commented 3 years ago

Hm, ok. To be clear, I mean just adding this line to the package.json:

{
  "scripts": {
+    "postinstall": "typesync"
  }
}

This would cause the typesync command to be automatically run after each npm install or yarn add. Example in npm docs.

jeffijoe commented 3 years ago

Sure. You can add it as a recommendation to the readme.

karlhorky commented 3 years ago

Maybe the recommended postinstall should actually be typesync && npm install (or typesync && yarn), because of what @aequasi mentioned: https://github.com/jeffijoe/typesync/issues/44#issuecomment-768928750

karlhorky commented 3 years ago

Ok, opened #65 for this