TSD is a TypeScript definition file package manager. let you easily download and install definition files to use in TypeScript projects.
To view online package search - http://www.tsdpm.com/
To contribute by adding new references - How to contribute
TSD is installed using node and npm. To install TSD use:
npm install tsd -g
Your best friend at this stage is probably
tsd -h
.
To view all repository files use:
tsd all
This will print all file definitions available on repository. To install some file on local project you must use install
command followed by a lib name:
tsd install node
This will create by default a folder named d.ts
(if it doesn't exists) and will download the file definition to this folder.
You can define your own custom folder to store definition files with the command:
tsd ncfg
This will create a file named tsd-config.json
on current folder with the following content:
{
"localPath": "ts-definitions",
"repositoryType": "1",
"uri": "https://github.com/Diullei/tsd/raw/master/deploy/repository.json"
}
- localPath - Must be the path to your local folder to store definition files. This folder will be created in the first time if not exists.
- repositoryType - this property is used to define if uri is a local folder or a url. Use
0
to local folder or1
to url. - uri - Define if the repository file is an url or a local folder.
Some definition files have dependencies of another files like socket.io
that depends of node
. To install dependencies you can use tsd install
command followed by a list of libs to install.
Example:
tsd install socket.io node express
This will install express, socket.io and node definitions.
You can use install*
command to allow TSD tool to automatically map and install all necessary dependencies. If you use install* sochet.io
this will install sochet.io
and node
because sochet.io
has node
mapped as a dependency. If you use the command:
tsd install* knockback
TSD will install knockback
, knockout
and backbone
definition.
You can always use tsd update
command to verify if your local libs are updated.
To make a search for any file you must use search
command.
Example:
tsd search backbone
TSD get the file definitions from DefinitelyTyped project. You can view the repository references inside repository.json file (I'm working to add some anothers). If you want to contribute please make a fork from tsd repo, change the repository.json and make a pull request.
This file is updated constantly.
To contribute adding new definition files references, "fork" this project and add a new file on repo_data
folder according to the following specifications:
{
"name": "LIB NAME", // must match the file name without json extension
"description": "LIB DESCRIPTION",
"versions": [
{
"version": "x.x", // LIB VERSION
"key": "FILE VERSION KEY", // must be a unique key like a guid. You can use this tool
// http://www.guidgenerator.com/ to generate this key
"dependencies": [
{
"name": "LIB NAME",
"version": "VERSION"
}
],
"url": "DEFINITION FILE URL",
"author": "DEFINITION FILE AUTHOR",
"author_url": "AUTHOR URL"
}
]
}
Example:
{
"name": "angular-resource",
"description": "Google - Angular.Js",
"versions": [
{
"version": "1.0",
"key": "8918D3CF-AAF2-4572-B3D2-509716336A99",
"dependencies": [
{
"name": "angular",
"version": "latest"
}
],
"url": "https://github.com/borisyankov/DefinitelyTyped/raw/master/angularjs/angular-resource.d.ts",
"author": "Diego Vilar",
"author_url": "https://github.com/diegovilar"
}
]
}
Done that, send a pull request.
NOTE: The definition files can be placed anywhere on the web, however I think this project (DefinitelyTyped) is the best place.
- Web site http://www.tsdpm.com/
- Friendly console output.
- Multiple installs at once install command #3. Thanks to @Crwth
- Command for show/info #2. Thanks to @semperos
- Allow user to change repository url from local config file
- Command to create local config file
- Solved issue: DefinitelyTyped directory structure is lost #4. Thanks to @Crwth
TSD is distributed under the MIT license. See license file here or below:
Copyright (c) 2012 by Diullei Gomes
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.