From 55dacdc2688d1634e10098dbe7fa752f54847aa0 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:43:43 -0700 Subject: [PATCH 1/3] Check all d.ts files --- deploy/deployChangedPackages.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/deploy/deployChangedPackages.js b/deploy/deployChangedPackages.js index 851cd59a2..08750d1b1 100644 --- a/deploy/deployChangedPackages.js +++ b/deploy/deployChangedPackages.js @@ -6,6 +6,7 @@ // ones which have changed. import * as fs from "fs"; +import * as path from "path"; import { spawnSync } from "child_process"; import { Octokit } from "@octokit/rest"; import { printUnifiedDiff } from "print-diff"; @@ -41,8 +42,7 @@ for (const dirName of fs.readdirSync(generatedDir)) { throw new Error(`Couldn't find ${pkgJSON.name}`); } - const dtsFiles = fs - .readdirSync(packageDir) + const dtsFiles = readdirRecursive(fileURLToPath(packageDir)) .filter((f) => f.endsWith(".d.ts")); const releaseNotes = []; @@ -167,3 +167,22 @@ function verify() { function getFileFromUnpkg(filepath) { return fetch(`https://unpkg.com/${filepath}`).then((r) => r.text()); } + +/** @param {string} dir */ +function readdirRecursive(dir) { + /** @type {string[]} */ + let results = []; + /** @param {string} currentDir */ + function readDir(currentDir) { + const entries = fs.readdirSync(currentDir, { withFileTypes: true }); + for (const entry of entries) { + const fullPath = path.join(currentDir, entry.name); + results.push(path.relative(dir, fullPath)); + if (entry.isDirectory()) { + readDir(fullPath); + } + } + } + readDir(dir); + return results; +} From cd3e143b3c438b4aaf25077eb48f1081d250a928 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:54:53 -0700 Subject: [PATCH 2/3] Retry unpkg requests --- deploy/deployChangedPackages.js | 16 ++++++++++++++-- package-lock.json | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/deploy/deployChangedPackages.js b/deploy/deployChangedPackages.js index 08750d1b1..a6263df4d 100644 --- a/deploy/deployChangedPackages.js +++ b/deploy/deployChangedPackages.js @@ -14,6 +14,8 @@ import { generateChangelogFrom } from "../lib/changelog.js"; import { packages } from "./createTypesPackages.js"; import { fileURLToPath } from "node:url"; import fetch from "node-fetch"; +import pRetry from 'p-retry'; + verify(); @@ -164,8 +166,18 @@ function verify() { } /** @param {string} filepath */ -function getFileFromUnpkg(filepath) { - return fetch(`https://unpkg.com/${filepath}`).then((r) => r.text()); +async function getFileFromUnpkg(filepath) { + return pRetry(async () => { + const resp = await fetch(`https://unpkg.com/${filepath}`); + if (resp.ok) { + return resp.text(); + } + if (resp.status === 404) { + return ""; + } + console.error(`Unexpected response status: ${resp.status}`); + throw new Error(resp.statusText); + }); } /** @param {string} dir */ diff --git a/package-lock.json b/package-lock.json index 9a1203c84..846bc70c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "jsonc-parser": "^3.3.1", "kdljs": "^0.3.0", "node-fetch": "^3.3.2", + "p-retry": "^7.1.0", "prettier": "^3.6.2", "print-diff": "^2.0.0", "typescript": "^5.9.2", @@ -2647,6 +2648,19 @@ "node": ">=0.10.0" } }, + "node_modules/is-network-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.0.tgz", + "integrity": "sha512-6oIwpsgRfnDiyEDLMay/GqCl3HoAtH5+RUKW29gYkL0QA+ipzpDLA16yQs7/RHCSu+BwgbJaOUqa4A99qNVQVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -3132,6 +3146,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-retry": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-7.1.0.tgz", + "integrity": "sha512-xL4PiFRQa/f9L9ZvR4/gUCRNus4N8YX80ku8kv9Jqz+ZokkiZLM0bcvX0gm1F3PDi9SPRsww1BDsTWgE6Y1GLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-network-error": "^1.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", diff --git a/package.json b/package.json index f51aab7bd..d8f6ff620 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "jsonc-parser": "^3.3.1", "kdljs": "^0.3.0", "node-fetch": "^3.3.2", + "p-retry": "^7.1.0", "prettier": "^3.6.2", "print-diff": "^2.0.0", "typescript": "^5.9.2", From a5025766a99a3d649444fe217bb65e538349f6d7 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:58:28 -0700 Subject: [PATCH 3/3] eslint with prettier should be illegal --- deploy/deployChangedPackages.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/deployChangedPackages.js b/deploy/deployChangedPackages.js index a6263df4d..9d5348fca 100644 --- a/deploy/deployChangedPackages.js +++ b/deploy/deployChangedPackages.js @@ -14,8 +14,7 @@ import { generateChangelogFrom } from "../lib/changelog.js"; import { packages } from "./createTypesPackages.js"; import { fileURLToPath } from "node:url"; import fetch from "node-fetch"; -import pRetry from 'p-retry'; - +import pRetry from "p-retry"; verify(); @@ -44,8 +43,9 @@ for (const dirName of fs.readdirSync(generatedDir)) { throw new Error(`Couldn't find ${pkgJSON.name}`); } - const dtsFiles = readdirRecursive(fileURLToPath(packageDir)) - .filter((f) => f.endsWith(".d.ts")); + const dtsFiles = readdirRecursive(fileURLToPath(packageDir)).filter((f) => + f.endsWith(".d.ts"), + ); const releaseNotes = [];