Skip to content

Commit c6c162b

Browse files
fix: resolve lmdb binaries correctly (#327)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent e721c27 commit c6c162b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Diff for: plugin/src/helpers/files.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,23 @@ export const relocateBinaries = async (baseDir: string): Promise<void> => {
104104
return
105105
}
106106

107-
const lmdbPath = findModuleFromBase({
107+
let lmdbPath = findModuleFromBase({
108108
paths: [gatsbyPath, baseDir],
109-
candidates: ['lmdb-store', 'lmdb'],
109+
candidates: ['lmdb-store'],
110110
})
111111

112112
if (!lmdbPath) {
113-
console.log(`Could not find lmdb module in ${gatsbyPath}`)
114-
return
113+
const modulePath = findModuleFromBase({
114+
paths: [gatsbyPath, baseDir],
115+
candidates: ['lmdb'],
116+
})
117+
if (modulePath) {
118+
// The lmdb package resolves to a subdirectory of the module, and we need the root
119+
lmdbPath = dirname(modulePath)
120+
} else {
121+
console.log(`Could not find lmdb module in ${gatsbyPath}`)
122+
return
123+
}
115124
}
116125

117126
console.log(
@@ -135,6 +144,8 @@ export const relocateBinaries = async (baseDir: string): Promise<void> => {
135144
if (existsSync(from) && !existsSync(to)) {
136145
console.log(`Copying ${from} to ${to}`)
137146
await copyFile(from, to)
147+
} else {
148+
console.log(`Skipping ${from}`)
138149
}
139150
}
140151
}

0 commit comments

Comments
 (0)