-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild-weak-node-api.ts
More file actions
34 lines (29 loc) · 1007 Bytes
/
build-weak-node-api.ts
File metadata and controls
34 lines (29 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env tsx
import { execSync } from "node:child_process";
import { platform } from "node:os";
// First generate the weak node API
execSync("npm run generate-weak-node-api", { stdio: "inherit" });
// Build command with common flags
const baseCommand = "react-native-node-api-cmake --no-auto-link --no-weak-node-api-linkage --source ./weak-node-api";
// Platform-specific flags
let platformFlags = "";
switch (platform()) {
case "darwin":
// macOS: build for both Android and Apple
platformFlags = "--android --apple --xcframework-extension";
break;
case "win32":
// Windows: only Android (no Apple/Xcode support)
platformFlags = "--android";
break;
case "linux":
// Linux: only Android
platformFlags = "--android";
break;
default:
console.error(`Unsupported platform: ${platform()}`);
process.exit(1);
}
const fullCommand = `${baseCommand} ${platformFlags}`;
console.log(`Running: ${fullCommand}`);
execSync(fullCommand, { stdio: "inherit" });