如何从 github 存储库安装打字稿定义 [英] how to install typescript definitions from github repo

查看:25
本文介绍了如何从 github 存储库安装打字稿定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何为像 aurelia-validatejs 这样的库安装 typescript defs?

how do you install the typescript defs for a library like aurelia-validatejs?

就像我做了 npm install aurelia-validatejs --save 将它添加到 package.jsonnode_modules 文件夹.是否有typings 命令将打字稿定义放入typings.jsontypings/globals 文件夹?如果不是我怎么做.

Like the I did the npm install aurelia-validatejs --save to add it to the package.json and node_modules folders. Is there a typings command to get the typescript definitions into the typings.json and typings/globals folder? If not how can I do it.

库 src 和 typescript 导出位于 aurelia/validatejs github 存储库

The library src and typescript exports are located at in the aurelia/validatejs github repo

如果相关,我正在玩一个基于 aurelia webpack-typescript 框架 我想让validatejs 和/或其他插件工作!如果有一篇博文展示如何将插件安装到 webpack-typescript 框架中,那就太酷了.

In case its relevant, I am playing in a project based on the aurelia webpack-typescript skeleton and I want to get validatejs and or other plugins working! It would be really cool if there was a blog post showing how to do plug in installs into the webpack-typescript skelton.

推荐答案

使用命令:

typings install github:aurelia/validatejs/dist/aurelia-validatejs.d.ts#ee3479eb6edacb31e2a1b7fdc8871e615970d293 --save --global

或者您可以手动将其添加到您的 typings.json 文件中:

Or you can manually add it to your typings.json file:

{
    "name": "Test",
    "version": false,
    "globalDependencies": {
        "aurelia-validatejs": "github:aurelia/validatejs/dist/aurelia-validatejs.d.ts#ee3479eb6edacb31e2a1b7fdc8871e615970d293"
    }
}

然后运行typings install.

来自文档(参见有效位置")

From documentation (see "Valid Locations")

aurelia/validatejs - 是 org/repo

aurelia/validatejs - is org/repo

dist/aurelia-validatejs.d.ts - 是路径

ee3479eb6edacb31e2a1b7fdc8871e615970d293 - 是一个提交

这篇关于如何从 github 存储库安装打字稿定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆