I have an old NodeJS project that has a package.json
file with all dependencies of the project, some of them with frozen versions which I would like to keep so that my code would not be broken due to deprecations.
我有一个旧的NodeJS项目,它有一个package.json文件,其中包含项目的所有依赖项,其中一些文件包含我希望保留的冻结版本,以便我的代码不会因弃用而被破坏。
Now I am migrating to TypeScript, and would like to automatically install all type definitions of all the libraries present in the existing package.json
file.
现在我正在迁移到TypeScript,并希望自动安装现有package.json文件中存在的所有库的所有类型定义。
I understand that there is a tool called typings
that can install and manage the type definitions, but I'd like to avoid of a manual script to install all type definitions using it. There must be a more elegant way...
我知道有一个名为typings的工具可以安装和管理类型定义,但我想避免使用手动脚本来安装所有类型定义。必须有一个更优雅的方式......
How can i do it?
我该怎么做?
1 个解决方案
#1
2
The tool you're probably referring to is tsd
and its configuration is usually placed in tsd.json
and the usual place for d.ts
files is typings
folder.
你可能指的工具是tsd,它的配置通常放在tsd.json中,而d.ts文件的通常位置是typings文件夹。
Then you can configure package.json
as described on the DefinitelyTyped project.
然后,您可以按照DefinitelyTyped项目中的描述配置package.json。
Also you can find very recent discussion about further developments in this topic in this DefinitelyTyped issue
您还可以在此DefinitelyTyped问题中找到有关此主题的进一步发展的最新讨论
UPDATE: tsd
is deprecated in favour to its successor typings
so naming in the question is correct.
更新:tsd被弃用以支持其后继类型,因此在问题中命名是正确的。
#1
2
The tool you're probably referring to is tsd
and its configuration is usually placed in tsd.json
and the usual place for d.ts
files is typings
folder.
你可能指的工具是tsd,它的配置通常放在tsd.json中,而d.ts文件的通常位置是typings文件夹。
Then you can configure package.json
as described on the DefinitelyTyped project.
然后,您可以按照DefinitelyTyped项目中的描述配置package.json。
Also you can find very recent discussion about further developments in this topic in this DefinitelyTyped issue
您还可以在此DefinitelyTyped问题中找到有关此主题的进一步发展的最新讨论
UPDATE: tsd
is deprecated in favour to its successor typings
so naming in the question is correct.
更新:tsd被弃用以支持其后继类型,因此在问题中命名是正确的。