88import * as fs from "fs" ;
99import { basename } from "path" ;
1010import { spawnSync , execSync } from "child_process" ;
11- import { Octokit } from "@octokit/core " ;
11+ import { Octokit } from "@octokit/rest " ;
1212import printDiff from "print-diff" ;
1313import { generateChangelogFrom } from "../lib/changelog.js" ;
1414import { packages } from "./createTypesPackages.mjs" ;
@@ -36,8 +36,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
3636 . readdirSync ( packageDir )
3737 . filter ( ( f ) => f . endsWith ( ".d.ts" ) ) ;
3838
39- /** @type {string[] } */
40- let releaseNotes = [ ] ;
39+ let releaseNotes = "" ;
4140
4241 // Look through each .d.ts file included in a package to
4342 // determine if anything has changed
@@ -63,10 +62,10 @@ for (const dirName of fs.readdirSync(generatedDir)) {
6362 console . log ( `Comparing ${ file } from ${ olderVersion } , to now:` ) ;
6463 printDiff ( oldFile , generatedDTSContent ) ;
6564
66- const title = `\n## \`${ file } \`\n` ;
65+ const title = `\n## \`${ file } \`\n\n ` ;
6766 const notes = generateChangelogFrom ( oldFile , generatedDTSContent ) ;
68- releaseNotes . push ( title ) ;
69- releaseNotes . push ( notes . trim ( ) === "" ? "No changes" : notes ) ;
67+ releaseNotes = title ;
68+ releaseNotes += notes . trim ( ) === "" ? "No changes" : notes ;
7069
7170 upload = upload || oldFile !== generatedDTSContent ;
7271 } catch ( error ) {
@@ -106,7 +105,7 @@ Assuming that this means we need to upload this package.`);
106105 }
107106
108107 console . log ( "\n# Release notes:" ) ;
109- console . log ( releaseNotes . join ( "\n" ) , "\n\n" ) ;
108+ console . log ( releaseNotes , "\n\n" ) ;
110109}
111110// Warn if we did a dry run.
112111if ( ! process . env . NODE_AUTH_TOKEN ) {
@@ -124,7 +123,7 @@ async function createRelease(tag, body) {
124123 const octokit = new Octokit ( { auth : authToken } ) ;
125124
126125 try {
127- await octokit . request ( "POST / repos/{owner}/{repo}/releases" , {
126+ await octokit . repos . createRelease ( {
128127 owner : "microsoft" ,
129128 repo : "TypeScript-DOM-lib-generator" ,
130129 tag_name : tag ,
0 commit comments