Skip to content

Commit

Permalink
fix prepare-v2 output for submodules (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubhy authored Nov 10, 2023
1 parent 1abe180 commit 25c9074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-pants-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/build-utils": patch
---

Fix prepare-v2 output
5 changes: 3 additions & 2 deletions src/PrepareV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ export const run = Effect.gen(function*(_) {
fs.exists(path.join("src", "impl", `${module}.ts`)),
)

const moduleName = module.slice(module.lastIndexOf("/") + 1)
const topComment = content.match(/\/\*\*\n.+?\*\//s)?.[0] ?? ""

if (hasImpl) {
return `export {\n ${
topComment.split("\n").join("\n ")
}\n ${module}\n} from "./${module}.js"`
}\n ${moduleName}\n} from "./${module}.js"`
}

return `${topComment}\nexport * as ${module} from "./${module}.js"`
return `${topComment}\nexport * as ${moduleName} from "./${module}.js"`
}),
{ concurrency: "inherit" },
),
Expand Down

0 comments on commit 25c9074

Please sign in to comment.