在打字时,读取文档之后的新的tsd管理器用于打字稿定义我对于不同来源的意思以及如何通过指定源和版本来安装感到困惑
例如,如果您搜索基础网站
typings search foundation-sites
Run Code Online (Sandbox Code Playgroud)
结果是
Run Code Online (Sandbox Code Playgroud)foundation-sites global 2016-02-11T00:39:58.000Z 1 foundation-sites dt 2016-03-17T12:06:54.000Z 1 http://foundation.zurb.com/
此命令typings install foundation-sites --save失败.
然后我添加了环境标志并且它有效,但是根据我的研究,全局和dt都被认为是环境因素,尽管我仍然不完全理解环境在环境中的环境意味着什么,以及全局环境.请参阅更详细的页面描述源.此页面列出了我们已经了解的dt中的3个环境
用于共享环境功能的lib(环境)
env用于编程环境类型(环境)
全球图书馆(环境)
上述差异意味着什么?
如果你有多个来源,如上面的搜索结果,只使用-ambient没有指定来源
1)哪一个安装,为什么?来自全球的日期或之后的日期.
是否可以提供正确的安装命令来选择源和版本.请包括非环境回购的示例,例如github和环境回购,例如global和dt
2)全局和dt源都需要--ambient标志吗?
3)只有在打字机注册表中的npm文件夹中,才会自动安装打字机.
例如,我可以使用typings install moment它安装,它的工作原理.从我可以告诉它的工作原理,因为它列在typings注册表中的npm文件夹中.
按照Corey的建议运行命令 typings install dt!foundation-sites
导致错误bash:!foundation-sites:找不到事件
修复:感谢Corey - 对于bash用户,使用\例句进行转义
typings install dt\!foundation-sites
Run Code Online (Sandbox Code Playgroud)
我认为环境意味着它来自DefinitelyTyped:
[ambient]在查找中包含DefinitelyTyped
打字文件进一步指出:
你可能想知道从使用TSD到打字是什么样的.使用Typings与使用TSD非常相似.你以前会有的地方:
tsd install react --save你现在会:
打字安装反应 - 边框 - 保存
我相信DefinitelyTyped只会在任何定义的版本上,因为它不支持版本控制.你需要使用以下方法指定你想要的那个:
typings install (with no arguments, in package directory)
typings install [<name>=]<location>
<name> Module name of the installed definition
<location> The location to read from (described below)
Valid Locations:
[<source>!]<pkg>[@<version>][#<tag>]
file:<path>
github:<org>/<repo>[/<path>][#<commitish>]
bitbucket:<org>/<repo>[/<path>][#<commitish>]
npm:<pkg>[/<path>]
bower:<pkg>[/<path>]
http(s)://<host>/<path>
<source> The registry mirror (E.g. "npm", "bower", "env", "global", "dt", ...)
<path> Path to a `.d.ts` file or `typings.json`
<host> A domain name (with optional port)
<version> A semver range (E.g. ">=4.0")
<tag> The specific tag of a registry entry
<commitish> A git commit, tag or branch
Options:
[--save|-S] Persist to "dependencies"
[--save-dev|-D] Persist to "devDependencies"
[--save-peer|-P] Persist to "peerDependencies"
[--ambient|-A] Install and persist as an ambient definition
[-SA] Persist to "ambientDependencies"
[-DA] Persist to "ambientDevDependencies"
[--production] Install only production dependencies (omits dev dependencies)
Aliases: i, in
Run Code Online (Sandbox Code Playgroud)
例如,
>typings install dt!foundation-sites
typings INFO reference Stripped reference "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/jquery/jquery.d.ts" during installation from "foundation-sites"
foundation-sites
??? (No dependencies)
Run Code Online (Sandbox Code Playgroud)
然后我在typings/browser/definitions/foudation-sites中获得了dt版本.
所以你的问题的答案是:
1)哪一个安装,为什么?来自全球的日期或之后的日期.
也不必指定源
2)全局和dt源都需要--ambient标志吗?
不,-ambient将"安装并保持为环境定义"
3)只有在打字机注册表中的npm文件夹中,才会自动安装打字机.
我认为安装只有在没有歧义的情况下才是"自动的".
| 归档时间: |
|
| 查看次数: |
3360 次 |
| 最近记录: |