Skip to content

Commit

Permalink
fix: try undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
typedarray committed Jan 6, 2025
1 parent 1924da1 commit 0a09116
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
database: [Postgres, PGLite]
database: [Postgres, PGlite]
steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/utils/pglite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { type PGliteOptions as Options, PGlite } from "@electric-sql/pglite";
export type PGliteOptions = Prettify<Options & { dataDir: string }>;

export function createPglite(options: PGliteOptions) {
if (options.dataDir !== "memory://")
// Windows doesn't like the "memory://" path, and PGlite uses the memory FS
// PGlite uses the memory FS by default, and Windows doesn't like the "memory://"
// path, so it's better to use `undefined` here.
if (options.dataDir === "memory://") {
// @ts-expect-error
options.dataDir = undefined;
} else {
mkdirSync(options.dataDir, { recursive: true });
}

return new PGlite(options);
}

0 comments on commit 0a09116

Please sign in to comment.