Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions deploy/deployChangedPackages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as fs from "fs";
import { basename } from "path";
import { spawnSync, execSync } from "child_process";
import { Octokit } from "@octokit/core";
import { Octokit } from "@octokit/rest";
import printDiff from "print-diff";
import { generateChangelogFrom } from "../lib/changelog.js";
import { packages } from "./createTypesPackages.mjs";
Expand Down Expand Up @@ -36,8 +36,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
.readdirSync(packageDir)
.filter((f) => f.endsWith(".d.ts"));

/** @type {string[]} */
let releaseNotes = [];
let releaseNotes = "";

// Look through each .d.ts file included in a package to
// determine if anything has changed
Expand All @@ -63,10 +62,10 @@ for (const dirName of fs.readdirSync(generatedDir)) {
console.log(`Comparing ${file} from ${olderVersion}, to now:`);
printDiff(oldFile, generatedDTSContent);

const title = `\n## \`${file}\`\n`;
const title = `\n## \`${file}\`\n\n`;
const notes = generateChangelogFrom(oldFile, generatedDTSContent);
releaseNotes.push(title);
releaseNotes.push(notes.trim() === "" ? "No changes" : notes);
releaseNotes = title;
releaseNotes += notes.trim() === "" ? "No changes" : notes;

upload = upload || oldFile !== generatedDTSContent;
} catch (error) {
Expand Down Expand Up @@ -106,7 +105,7 @@ Assuming that this means we need to upload this package.`);
}

console.log("\n# Release notes:");
console.log(releaseNotes.join("\n"), "\n\n");
console.log(releaseNotes, "\n\n");
}
// Warn if we did a dry run.
if (!process.env.NODE_AUTH_TOKEN) {
Expand All @@ -124,7 +123,7 @@ async function createRelease(tag, body) {
const octokit = new Octokit({ auth: authToken });

try {
await octokit.request("POST /repos/{owner}/{repo}/releases", {
await octokit.repos.createRelease({
owner: "microsoft",
repo: "TypeScript-DOM-lib-generator",
tag_name: tag,
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"type": "module",
"devDependencies": {
"@mdn/browser-compat-data": "^3.3.13",
"@octokit/rest": "^16.43.2",
"@types/jsdom": "^16.2.13",
"@types/node": "^16.4.8",
"@types/node-fetch": "^2.5.12",
Expand Down