Skip to content

Commit

Permalink
Fix how openRepository is used in unplugin-plugin & paraglide init
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisSigrist committed Mar 25, 2024
1 parent ea06cdd commit 7dce581
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/mighty-brooms-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@inlang/paraglide-js-adapter-unplugin": patch
"@inlang/paraglide-js": patch
---

fix `openRepository` crash in non-git environments
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const paraglide = createUnplugin((config: UserConfig) => {

const repoRoot = await findRepoRoot({ nodeishFs: fs, path: projectPath })

const repo = await openRepository(repoRoot || process.cwd(), {
const repo = await openRepository(repoRoot || "file://" + process.cwd(), {
nodeishFs: fs,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const initCommand = new Command()
// We are risking that there is no git repo. As long as we only use FS features and no Git features
// from the SDK we should be fine.
// Basic operations like `loadProject` should always work without a repo since it's used in CI.
const repo = await openRepository(repoRoot ?? process.cwd(), {
const repo = await openRepository(repoRoot ?? "file://" + process.cwd(), {
nodeishFs: nodeFsPromises,
})

Expand Down

0 comments on commit 7dce581

Please sign in to comment.