Skip to content

Commit 8222487

Browse files
committed
Expect a potential .dylib when building on MacOS
1 parent b3f853f commit 8222487

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/cmake-rn/src/platforms/node.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export const platform: Platform<Target[], NodeOpts> = {
9090
.filter(
9191
(dirent) =>
9292
dirent.isFile() &&
93-
(dirent.name.endsWith(".so") || dirent.name.endsWith(".node")),
93+
(dirent.name.endsWith(".so") ||
94+
dirent.name.endsWith(".dylib") ||
95+
dirent.name.endsWith(".node")),
9496
)
9597
.map((dirent) => path.join(dirent.parentPath, dirent.name));
9698
assert.equal(result.length, 1, "Expected exactly one library file");

packages/host/src/node/prebuilds/node.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ export async function createNodeLibsDirectory({
5050
const osArch = DIRECTORY_NAMES_PER_TARGET[triplet];
5151
const osArchOutputPath = path.join(outputPath, osArch);
5252
await fs.promises.mkdir(osArchOutputPath, { recursive: true });
53-
// Strip the ".so" extension from the library name
54-
const libraryName = path.basename(libraryPath, ".so");
55-
const nodeSuffixedName =
56-
path.extname(libraryName) === ".node"
57-
? libraryName
58-
: `${libraryName}.node`;
53+
// Strip any extension from the library name and rename it to .node
54+
const libraryName = path
55+
.basename(libraryPath)
56+
.replaceAll(/\.so$|\.dylib$|\.node$/g, "");
57+
const nodeSuffixedName = `${libraryName}.node`;
5958
const libraryOutputPath = path.join(osArchOutputPath, nodeSuffixedName);
6059
await fs.promises.copyFile(libraryPath, libraryOutputPath);
6160
}

0 commit comments

Comments
 (0)