client/scripts/build-packages.ts
Alois 82a483d7ab
Some checks failed
/ build-web (push) Failing after 3m41s
/ build-desktop (linux) (push) Failing after 3m43s
/ build-mobile (push) Failing after 6m33s
/ release (push) Has been skipped
(feat): migrate bun to pnpm
(feat): some mtp stuff
(wip): electron app tray
2026-07-04 01:18:54 +02:00

45 lines
1.1 KiB
TypeScript

import { existsSync, readdirSync, statSync } from "fs";
import { join } from "path";
import { execSync } from "child_process";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
const _dirname = dirname(fileURLToPath(import.meta.url));
const packagesDir = join(_dirname, "..", "packages");
function getPackageDirs(dir: string): string[] {
const entries = readdirSync(dir);
const dirs: string[] = [];
for (const entry of entries) {
const fullPath = join(dir, entry);
if (!statSync(fullPath).isDirectory()) continue;
if (existsSync(join(fullPath, "package.json"))) {
dirs.push(fullPath);
continue;
}
dirs.push(...getPackageDirs(fullPath));
}
return dirs;
}
const packageDirs = getPackageDirs(packagesDir);
for (const fullPath of packageDirs) {
const entry = fullPath.replace(packagesDir + "/", "");
console.log(`Building ${entry}...`);
try {
execSync("pnpm run build", { cwd: fullPath, stdio: "inherit" });
console.log(`${entry} built successfully.`);
} catch {
console.error(`Failed to build ${entry}.`);
process.exit(1);
}
}
console.log("Done!");