| 23 | } |
| 24 | |
| 25 | async function getPublishablePackages() { |
| 26 | const packages = [] |
| 27 | |
| 28 | for (const workspaceDir of WORKSPACE_DIRS) { |
| 29 | const absWorkspaceDir = path.resolve(workspaceDir) |
| 30 | if (!existsSync(absWorkspaceDir)) continue |
| 31 | |
| 32 | const dirEntries = await readdir(absWorkspaceDir, { withFileTypes: true }) |
| 33 | for (const dirEntry of dirEntries) { |
| 34 | if (!dirEntry.isDirectory()) continue |
| 35 | |
| 36 | const relDir = path.join(workspaceDir, dirEntry.name) |
| 37 | const packageJsonPath = path.resolve(relDir, 'package.json') |
| 38 | if (!existsSync(packageJsonPath)) continue |
| 39 | |
| 40 | const raw = await readFile(packageJsonPath, 'utf8') |
| 41 | const pkg = JSON.parse(raw) |
| 42 | if (pkg.private || typeof pkg.name !== 'string') continue |
| 43 | |
| 44 | packages.push({ |
| 45 | name: pkg.name, |
| 46 | dir: relDir.replace(/\\/g, '/'), |
| 47 | }) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | return packages |
| 52 | } |
| 53 | |
| 54 | function getBaseSha() { |
| 55 | const lastReleaseSha = runGit(`log --format=%H --grep="^${RELEASE_COMMIT_PREFIX}" -n 1 HEAD`) |