jeffijoe / typesync

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

reduce unused typing package #35

Closed septs closed 5 years ago

septs commented 5 years ago
# install package
npm install history

# sync typing
typesync

# uninstall package
npm uninstall history

# re-sync typing
typesync # should need to remove @types/history
  1. the issue can use m(modules) field for check in search-index-min.json.
  2. package with g(globals) field have side effects e.q: @types/jquery only use typing

search-index-min.json structure definition: https://github.com/microsoft/types-publisher/blob/467eb14e3fe0204aa0f5e06549271fa4bea457e1/src/create-search-index.ts#L21-L34

jeffijoe commented 5 years ago

Doing this would automatically uninstall ambient typings like @types/node which is undesirable.

septs commented 5 years ago

@jeffijoe include global definition cannot be removed

image

septs commented 5 years ago

This idea can only be processed without a global definition because he has no side effects.

septs commented 5 years ago
➜  Downloads # no side-effects libraries
➜  Downloads cat search-index-min.json | jq '(.[].g | length) == 0' | grep 'true' | wc -l
    4880
➜  Downloads # side-effects libraries
➜  Downloads cat search-index-min.json | jq '(.[].g | length) > 0' | grep 'true' | wc -l
    1166