|
6 | 6 | // ones which have changed. |
7 | 7 |
|
8 | 8 | import * as fs from "fs"; |
| 9 | +import * as path from "path"; |
9 | 10 | import { spawnSync } from "child_process"; |
10 | 11 | import { Octokit } from "@octokit/rest"; |
11 | 12 | import { printUnifiedDiff } from "print-diff"; |
@@ -41,8 +42,7 @@ for (const dirName of fs.readdirSync(generatedDir)) { |
41 | 42 | throw new Error(`Couldn't find ${pkgJSON.name}`); |
42 | 43 | } |
43 | 44 |
|
44 | | - const dtsFiles = fs |
45 | | - .readdirSync(packageDir) |
| 45 | + const dtsFiles = readdirRecursive(fileURLToPath(packageDir)) |
46 | 46 | .filter((f) => f.endsWith(".d.ts")); |
47 | 47 |
|
48 | 48 | const releaseNotes = []; |
@@ -167,3 +167,22 @@ function verify() { |
167 | 167 | function getFileFromUnpkg(filepath) { |
168 | 168 | return fetch(`https://unpkg.com/${filepath}`).then((r) => r.text()); |
169 | 169 | } |
| 170 | + |
| 171 | +/** @param {string} dir */ |
| 172 | +function readdirRecursive(dir) { |
| 173 | + /** @type {string[]} */ |
| 174 | + let results = []; |
| 175 | + /** @param {string} currentDir */ |
| 176 | + function readDir(currentDir) { |
| 177 | + const entries = fs.readdirSync(currentDir, { withFileTypes: true }); |
| 178 | + for (const entry of entries) { |
| 179 | + const fullPath = path.join(currentDir, entry.name); |
| 180 | + results.push(path.relative(dir, fullPath)); |
| 181 | + if (entry.isDirectory()) { |
| 182 | + readDir(fullPath); |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + readDir(dir); |
| 187 | + return results; |
| 188 | +} |
0 commit comments