Skip to content

Commit 6a132b1

Browse files
Fix SQL utils on windows (#57)
1 parent a1661fa commit 6a132b1

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

docs/utils-reference/getting-started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ npm install --save @raycast/utils
1616

1717
## Changelog
1818

19+
### v2.2.1
20+
21+
- Fix compiled file to actually make `useSQL` and `executeSQL` work on Windows.
22+
1923
### v2.2.0
2024

2125
- Make `useSQL` and `executeSQL` work on Windows.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@raycast/utils",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "Set of utilities to streamline building Raycast extensions",
55
"author": "Raycast Technologies Ltd.",
66
"homepage": "https://developers.raycast.com/utilities/getting-started",

src/sql-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export async function baseExecuteSQL<T = unknown>(
3030

3131
let sqlite3: typeof import("node:sqlite");
3232
try {
33-
sqlite3 = require("node:sqlite");
33+
// this is a bit ugly but we can't directly import "node:sqlite" here because parcel will hoist it anyway and it will break when it's not available
34+
const dynamicImport = (module: string) => import(module);
35+
sqlite3 = await dynamicImport("node:sqlite");
3436
} catch (error) {
3537
// If sqlite3 is not available, we fallback to using the sqlite3 CLI (available on macOS and Linux by default).
3638
return sqliteFallback<T>(databasePath, query, options);

0 commit comments

Comments
 (0)