Skip to content

Commit 8d111d1

Browse files
committed
Build node-tests in parallel
1 parent f1e42c8 commit 8d111d1

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/node-tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"bootstrap": "npm run copy-tests && npm run gyp-to-cmake && npm run build-tests && npm run bundle"
1919
},
2020
"devDependencies": {
21+
"bufout": "^0.3.2",
2122
"cmake-js": "^7.3.1",
2223
"cmake-rn": "*",
2324
"gyp-to-cmake": "*",
Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
import { execSync } from "node:child_process";
1+
import path from "node:path";
2+
3+
import { spawn, SpawnFailure } from "bufout";
24

35
import { findCMakeProjects } from "./utils.mjs";
46

5-
const projectDirectories = findCMakeProjects();
6-
7-
for (const projectDirectory of projectDirectories) {
8-
console.log(
9-
`Running "cmake-rn" in ${projectDirectory} to build for React Native`
10-
);
11-
execSync("cmake-rn", {
12-
cwd: projectDirectory,
13-
stdio: "inherit",
14-
});
15-
}
7+
const rootPath = path.join(import.meta.dirname, "..");
8+
const projectPaths = findCMakeProjects();
9+
10+
await Promise.all(
11+
projectPaths.map(async (projectPath) => {
12+
console.log(
13+
`Running "cmake-rn" in ${path.relative(
14+
rootPath,
15+
projectPath
16+
)} to build for React Native`
17+
);
18+
await spawn("cmake-rn", [], { cwd: projectPath, outputMode: "buffered" });
19+
})
20+
).catch((err) => {
21+
process.exitCode = 1;
22+
if (err instanceof SpawnFailure) {
23+
err.flushOutput("both");
24+
} else if (err instanceof Error) {
25+
console.error(err.message);
26+
} else {
27+
console.error(err);
28+
}
29+
});

0 commit comments

Comments
 (0)