From fae72a8ab7fc0955ff49f50fbec25c0e482c41b1 Mon Sep 17 00:00:00 2001 From: Mickael Jeanroy Date: Mon, 31 May 2021 21:51:56 +0200 Subject: [PATCH] chore(typing): fix dependency typings --- src/index.d.ts | 76 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index d37cf982..cbcf822f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -104,47 +104,85 @@ interface BannerOptions { export type Banner = string | BannerOptions; +/** + * Dependency Repository Description. + */ +interface DependencyRepository { + /** + * Repository URL. + */ + readonly url: string; + + /** + * Repository Type (git, svn, etc.). + */ + readonly type: string; +} + /** * Dependency information is derived from the package.json file */ export interface Dependency { - readonly name: string, - readonly maintainers: string[], - readonly version: string, - readonly description: string, - readonly repository: { - readonly url: string, - readonly type: string, - }, + /** + * Dependency Name. + */ + readonly name: string | null; + + /** + * Dependency Maintainers list. + */ + readonly maintainers: string[]; - readonly homepage: string, + /** + * Dependency Version. + */ + readonly version: string | null; + + /** + * Dependency Description. + */ + readonly description: string | null; + + /** + * Dependency Repository Location. + */ + readonly repository: string | DependencyRepository | null; /** - * If dependency is private + * Repository Public Homepage. */ - readonly private: boolean, + readonly homepage: string | null; /** - * SPDX License short ID + * If dependency is private. */ - readonly license: string, + readonly private: boolean; /** - * Full License file text + * SPDX License short ID. */ - readonly licenseText: string, + readonly license: string | null; /** - * Author information + * Full License file text. */ - readonly author: Person, - readonly contributors: Person[], + readonly licenseText: string | null; + + /** + * Author information. + */ + readonly author: Person | null; + + /** + * Dependency Contributes list. + */ + readonly contributors: Person[]; /** * Turns the dependency into a formatted string * @returns formatted dependency license info */ - text: () => string, + text: () => string; } export type ThirdPartyOutput = string | ((dependencies: Dependency[]) => void) | {