Typings CLI 实用程序使 typings 文件夹匹配的命令 typings.json

Command for Typings CLI utility to make typings folder match typings.json

我有一个大型团队使用 Typescript 处理一个 repo,没有人将 /typings 文件夹签入团队的共享存储库,他们只签入指定版本信息的 typings.json 文件对于项目所需的每个定义集。

有时有人会从 typings.json 中删除定义集,因为他们正在处理的项目部分不再使用该库(或者我们找到了更好的定义集),使用
typings uninstall --global --save dt~whatever,这在他们的本地机器上运行良好,但是 当他们推上新的 typings.json 而我或其他人将其拉下时,当我们 运行 typings install,该命令只会将新定义添加到 typings 文件夹,不会从 typings 文件夹中删除不再存在于 typings.json 中的定义。

有没有一个命令我可以运行 通过区分当前typings.json和[的状态来添加新的定义集和删除删除的集 =12=] 当 typings 命令是最后一个时 运行?

目前我们只是让每个人每次拉取时都删除整个 typings 文件夹和 运行 typings install,但这有点低效,因为我们有一个现在有很多定义集。

注意:我们尝试了 typings uninstalltypings uninstall --save,但它们只会抛出错误(看来您只能指定要卸载的特定定义集)。

使用

typings prune

在您的项目目录中。它将删除 typings 目录中存在但未在 typings.json 文件中列出的所有类型。

有关 the Typings documentation 的更多信息。