diff --git a/types/license-checker/index.d.ts b/types/license-checker/index.d.ts new file mode 100644 index 0000000000..0059c8b321 --- /dev/null +++ b/types/license-checker/index.d.ts @@ -0,0 +1,87 @@ +// Type definitions for license-checker 11.0 +// Project: https://github.com/davglass/license-checker +// Definitions by: Rogier Schouten +// 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; diff --git a/types/license-checker/license-checker-tests.ts b/types/license-checker/license-checker-tests.ts new file mode 100644 index 0000000000..0caf98a373 --- /dev/null +++ b/types/license-checker/license-checker-tests.ts @@ -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 + } +}); diff --git a/types/license-checker/tsconfig.json b/types/license-checker/tsconfig.json new file mode 100644 index 0000000000..4560756381 --- /dev/null +++ b/types/license-checker/tsconfig.json @@ -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" + ] +} diff --git a/types/license-checker/tslint.json b/types/license-checker/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/license-checker/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }