add typings for license-checker

This commit is contained in:
Rogier Schouten
2017-06-29 15:41:29 +02:00
parent 4d12d79360
commit 39d6470a22
4 changed files with 123 additions and 0 deletions

87
types/license-checker/index.d.ts vendored Normal file
View File

@@ -0,0 +1,87 @@
// Type definitions for license-checker 11.0
// Project: https://github.com/davglass/license-checker
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* Options struct for the init() function
*/
export interface InitOpts {
/**
* Path to start checking dependencies from
*/
start: string;
/**
* only show production dependencies
*/
production?: boolean;
/**
* only show development dependencies
*/
development?: boolean;
/**
* report guessed licenses as unknown licenses
*/
unknown?: boolean;
/**
* only list packages with unknown or guessed licenses
*/
onlyunknown?: boolean;
/**
* to add a custom Format file in JSON
*/
customPath?: string;
/**
* exclude modules which licenses are in the comma-separated list from the output
*/
exclude?: string[];
/**
* Use chalk to colorize the licenses member of each returned module info. Unknown licenses become red.
*/
color?: boolean;
/**
* output the location of the license files as relative paths
*/
relativeLicensePath?: boolean;
}
/**
* Information about one dependency
*/
export interface ModuleInfo {
/**
* licenses, separated by ' OR '
*/
licenses: string;
/**
* Repository URL
*/
repository: string;
/**
* Publisher name
*/
publisher?: string;
/**
* Publisher e-mail
*/
email?: string;
/**
* Publisher URL
*/
url?: string;
/**
* Path to license file, if available
*/
licenseFile?: string;
}
export interface ModuleInfos {
[packageName: string]: ModuleInfo;
}
/**
* Run the license check
* @param opts specifies the path to the module to check dependencies of
* @param callback
*/
export function init(opts: InitOpts, callback: (err: Error, ret: ModuleInfos) => void): void;

View File

@@ -0,0 +1,13 @@
// From README.md:
import * as checker from 'license-checker';
checker.init({
start: '/path/to/start/looking'
}, (err: Error, json: checker.ModuleInfos): void => {
if (err) {
// Handle error
} else {
// The sorted json data
}
});

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"license-checker-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }