mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-19 13:32:17 +08:00
add typings for license-checker
This commit is contained in:
87
types/license-checker/index.d.ts
vendored
Normal file
87
types/license-checker/index.d.ts
vendored
Normal 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;
|
||||
13
types/license-checker/license-checker-tests.ts
Normal file
13
types/license-checker/license-checker-tests.ts
Normal 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
|
||||
}
|
||||
});
|
||||
22
types/license-checker/tsconfig.json
Normal file
22
types/license-checker/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/license-checker/tslint.json
Normal file
1
types/license-checker/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user