mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add typings for legal-eagle (#22722)
This commit is contained in:
28
types/legal-eagle/index.d.ts
vendored
Normal file
28
types/legal-eagle/index.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for legal-eagle 0.15
|
||||
// Project: https://github.com/atom/legal-eagle
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function legalEagle(
|
||||
options: legalEagle.Options,
|
||||
cb: (err: Error | null, licenseSummary: legalEagle.LicenseLookup) => void
|
||||
): void;
|
||||
|
||||
declare namespace legalEagle {
|
||||
interface Options {
|
||||
path: string;
|
||||
overrides?: LicenseLookup;
|
||||
omitPermissive?: boolean;
|
||||
}
|
||||
interface LicenseLookup {
|
||||
[id: string]: Entry;
|
||||
}
|
||||
interface Entry {
|
||||
license: string;
|
||||
source: string;
|
||||
repository: string;
|
||||
sourceText: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = legalEagle;
|
||||
44
types/legal-eagle/legal-eagle-tests.ts
Normal file
44
types/legal-eagle/legal-eagle-tests.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import legalEagle = require('legal-eagle');
|
||||
|
||||
// from the package's README
|
||||
legalEagle({path: process.cwd()}, (err, summary) => {
|
||||
if (err != null) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
console.log(summary);
|
||||
});
|
||||
|
||||
// from GitHub desktop
|
||||
declare var appRoot: string;
|
||||
legalEagle(
|
||||
{
|
||||
path: appRoot,
|
||||
overrides: {
|
||||
'foo@1.2.3': {
|
||||
repository: 'git+ssh://git@github.com/foo/bar',
|
||||
license: '...',
|
||||
source: '...',
|
||||
sourceText: '...',
|
||||
}
|
||||
},
|
||||
omitPermissive: true
|
||||
}, (err, summary) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object.keys(summary).length > 0) {
|
||||
let licensesMessage = '';
|
||||
for (const key in summary) {
|
||||
const license = summary[key];
|
||||
licensesMessage += `${key} (${license.repository}): ${license.license}\n`;
|
||||
}
|
||||
|
||||
throw new Error(licensesMessage);
|
||||
}
|
||||
}
|
||||
);
|
||||
23
types/legal-eagle/tsconfig.json
Normal file
23
types/legal-eagle/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"legal-eagle-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/legal-eagle/tslint.json
Normal file
1
types/legal-eagle/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user