File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -14,20 +14,24 @@ package_json_path = nil
1414# When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
1515# Find the users package.json by searching up through parent directories
1616if is_user_app
17- current_dir = File . dirname ( File . expand_path ( __dir__ ) )
17+ current_dir = File . expand_path ( __dir__ )
18+ # Move one level up to the parent directory
19+ current_dir = File . dirname ( current_dir )
1820
21+ # Find the package.json by searching up through parent directories
1922 loop do
2023 package_path = File . join ( current_dir , "package.json" )
2124 if File . exist? ( package_path )
2225 package_json_path = package_path
2326 break
2427 end
2528
26- break if File . dirname ( current_dir ) == current_dir # reached filesystem root
29+ parent_dir = File . dirname ( current_dir )
30+ break if parent_dir == current_dir # reached filesystem root
2731 current_dir = parent_dir
2832 end
2933
30- raise "package.json not found? It's needed to read any op-sqlite config (if available) " if package_json_path . nil?
34+ raise "package.json not found" if package_json_path . nil?
3135else
3236 package_json_path = File . join ( __dir__ , "example" , "package.json" )
3337end
You can’t perform that action at this time.
0 commit comments