File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11import * as fs from 'fs' ;
22import * as path from 'path' ;
3+ import { fileURLToPath } from 'url' ;
34
45export interface InitNativeOptions {
56 database ?: string ;
@@ -35,9 +36,14 @@ function libExt(): string {
3536 return 'so' ;
3637}
3738
39+ function packageRootDir ( ) : string {
40+ // dist/node-entry.js -> package root
41+ const here = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
42+ return path . resolve ( here , '..' ) ;
43+ }
44+
3845function findLocalPrebuilt ( ) : string | undefined {
39- const root = process . cwd ( ) ;
40- const outDir = path . join ( root , 'dist' , 'native' ) ;
46+ const outDir = path . join ( packageRootDir ( ) , 'dist' , 'native' ) ;
4147 if ( ! fs . existsSync ( outDir ) ) return undefined ;
4248 const ext = libExt ( ) ;
4349 const triple = platformTriple ( ) ;
You can’t perform that action at this time.
0 commit comments