TypeScript Definition Package Manager
TSD is a TypeScript definition file package manager. Easily search and install community contributed definition files directly from the DefinitelyTyped repository.
0.5.x
is functional but still heavily in development and not ready for production-critical use. It might just work fine though.
0.5.x
not backwards compatible with the config files from earlier versions (as the data source changed so much).
Use TSD as a CLI command $ tsd
, similar to $ npm
and $ bower
. All functionality is also exported as a node.js module: require('tsd')
.
❌ Not yet on npm. Install global using node using npm:
$ npm install tsd -g
🔧 For development preview install from a git-checkout (at whatever state it is):
$ npm install
$ grunt build
$ npm install . -g
🚀 For npm preview install directly from github (if you feel particularly adventurous):
$ npm install git://github.com/Diullei/tsd#develop-0.5.x -g
$ tsd
$ tsd -h
$ tsd search <selector>
$ tsd install <selector>
$ tsd info <selector>
$ tsd history <selector>
$ tsd reinstall
...
TSD uses selectors to query the definition list:
$ tsd install project/module
Consider these definitions:
project/module.d.ts
project/module-0.1.2.d.ts
project/module-0.1.2-alpha.d.ts
project/module-addon.d.ts
project-plugin/plugin.d.ts
other/module.d.ts
other/helper.d.ts
other/plugin.d.ts
Notice the pattern, and ignore the .d.ts
extension:
<project>/<module><semver>.d.ts
Select definitions using only the module name:
module
module-addon
Or use a selector derived from the path format:
project/module
The selector also supports globbing, for example:
project/*
project*
module*
project/module*
project-*/plugin*
project*/*-*
project/plugin*
other/module
*/module
*/module-*
*/*plugin
❌ Not yet. Note: the semver postfix is expected to be separated by a dash and possibly a 'v'
module-0.1.2
module-0.1.2-alpha
module-v0.1.2
❌ Not yet. If there are multiple matches with same module name they will be prioritised:
The unversioned name is considered being most recent.Then versions are compared as expected following these comparison rules.
Include TSD as any npm dependency in your project and create instances of the API class. The internal API use to implement the CLI is exposed.
var tsd = require('tsd');
var api = new tsd.API(new tsd.Context('path/to/tsd-config.json'));
api.search(new tsd.Selector('jquery/*')).then(function(res) {
//yes
util.inspect(res);
}, function(err) {
//this is bad
});
TSD uses Promise/A+ by the excellent kriskowal/q and kriskowal/q-io packages. 👈👍
❌ Not yet.
TSD is written in TypeScript and build using Grunt. All definition data pulled live from DefinitelyTyped using the Github API.
To rebuild clone or fork the repos:
// install dependencies
$ npm install
// build and test
$ grunt test
// only rebuild
$ grunt build
Either install global or use in dev folder:
// run in dev folder
$ node ./build/cli.js install angular --dev
// install to globa;
$ npm install . -g
TSD uses gruntfile-gtx to easily test separate test sets during development:
// list aliases
$ grunt -h
// for example: run only api tests
$ grunt gtx:api
Contributions will be welcome once the application architecture stabilises a bit more.
- Full rewrite by @Bartvds: drops the separated TSD data registry in favour of using the Github API to pull definitions directly from DefinitelyTyped.
Copyright (c) 2012 by Diullei Gomes
Licensed under the MIT license.