Skip to content

Commit d0b77f2

Browse files
committed
Update Ferric to use weakNodeApiPath
1 parent 5683ea1 commit d0b77f2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/ferric/src/cargo.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import assert from "node:assert/strict";
22
import cp from "node:child_process";
33
import fs from "node:fs";
44
import path from "node:path";
5-
import { fileURLToPath } from "node:url";
65

76
import { spawn } from "bufout";
87
import chalk from "chalk";
@@ -15,9 +14,7 @@ import {
1514
isAppleTarget,
1615
} from "./targets.js";
1716

18-
const WEAK_NODE_API_PATH = fileURLToPath(
19-
import.meta.resolve("react-native-node-api/weak-node-api")
20-
);
17+
import { weakNodeApiPath } from "react-native-node-api";
2118

2219
const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record<AppleTargetName, string> = {
2320
"aarch64-apple-darwin": "macos-arm64_x86_64", // Universal
@@ -126,18 +123,16 @@ export function getTargetAndroidPlatform(target: AndroidTargetName) {
126123
}
127124

128125
export function getWeakNodeApiFrameworkPath(target: AppleTargetName) {
129-
assert(fs.existsSync(WEAK_NODE_API_PATH), "Expected weak-node-api to exist");
130126
return joinPathAndAssertExistence(
131-
WEAK_NODE_API_PATH,
127+
weakNodeApiPath,
132128
"weak-node-api.xcframework",
133129
APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target]
134130
);
135131
}
136132

137133
export function getWeakNodeApiAndroidLibraryPath(target: AndroidTargetName) {
138-
assert(fs.existsSync(WEAK_NODE_API_PATH), "Expected weak-node-api to exist");
139134
return joinPathAndAssertExistence(
140-
WEAK_NODE_API_PATH,
135+
weakNodeApiPath,
141136
"weak-node-api.android.node",
142137
ANDROID_ARCH_PR_TARGET[target]
143138
);
@@ -202,7 +197,10 @@ export function getTargetEnvironmentVariables({
202197
toolchainBinPath,
203198
`${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}`
204199
),
205-
TARGET_AR: joinPathAndAssertExistence(toolchainBinPath, `llvm-ar${exeMaybe}`),
200+
TARGET_AR: joinPathAndAssertExistence(
201+
toolchainBinPath,
202+
`llvm-ar${exeMaybe}`
203+
),
206204
TARGET_RANLIB: joinPathAndAssertExistence(
207205
toolchainBinPath,
208206
`llvm-ranlib${exeMaybe}`

0 commit comments

Comments
 (0)