diff --git a/packages/definitions-parser/src/packages.ts b/packages/definitions-parser/src/packages.ts index 561f137a14..7003c0e9fd 100644 --- a/packages/definitions-parser/src/packages.ts +++ b/packages/definitions-parser/src/packages.ts @@ -573,6 +573,9 @@ export class TypingsData extends PackageBase { get files(): readonly string[] { return this.data.files; } + get dtsFiles(): readonly string[] { + return this.data.files.filter(f => f.endsWith(".d.ts")); + } get license(): License { return this.data.license; } diff --git a/packages/publisher/src/generate-packages.ts b/packages/publisher/src/generate-packages.ts index 471a313a6a..05a2693415 100644 --- a/packages/publisher/src/generate-packages.ts +++ b/packages/publisher/src/generate-packages.ts @@ -275,6 +275,14 @@ export function createReadme(typing: TypingsData): string { lines.push("# Details"); lines.push(`Files were exported from ${definitelyTypedURL}/tree/${sourceBranch}/types/${typing.subDirectoryPath}.`); + if (typing.dtsFiles.length === 1) { + const dts = typing.dtsFiles[0] + lines.push("## " + path.basename(dts)) + lines.push("```ts") + lines.push(readFileSync(dts, "utf8")) + lines.push("```") + } + lines.push(""); lines.push("### Additional Details"); lines.push(` * Last updated: ${new Date().toUTCString()}`);