(packageName, cleanNodeModules = false)
| 50 | |
| 51 | // Helper function to build a package (install + build) |
| 52 | async function buildPackage(packageName, cleanNodeModules = false) { |
| 53 | const packagePath = path.join(__dirname, "..", "packages", packageName); |
| 54 | |
| 55 | if (!fs.existsSync(packagePath)) { |
| 56 | throw new Error(`Package directory not found: ${packagePath}`); |
| 57 | } |
| 58 | |
| 59 | if (cleanNodeModules) { |
| 60 | const nodeModulesPath = path.join(packagePath, "node_modules"); |
| 61 | if (fs.existsSync(nodeModulesPath)) { |
| 62 | console.log(`🧹 Cleaning node_modules for ${packageName}`); |
| 63 | await fsPromises.rm(nodeModulesPath, { recursive: true, force: true }); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | await runCommand(npmInstallCmd, packagePath, `${packageName} (install)`); |
| 68 | |
| 69 | return runCommand("npm run build", packagePath, `${packageName} (build)`); |
| 70 | } |
| 71 | |
| 72 | async function buildPackagesInParallel(packages, cleanNodeModules = false) { |
| 73 | const buildPromises = packages.map((pkg) => |
no test coverage detected