Skip to content

Commit

Permalink
feat: cloudflare worker template
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Feb 20, 2024
1 parent e983dfb commit 68854fd
Show file tree
Hide file tree
Showing 15 changed files with 567 additions and 78 deletions.
15 changes: 13 additions & 2 deletions .scripts/postbuild.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dirname, relative, resolve } from 'node:path'
import glob from 'fast-glob'

await rewriteHonoJsx()
Expand All @@ -6,11 +7,21 @@ async function rewriteHonoJsx() {
const files = await glob('./src/_lib/**/*.js')
for (const file of files) {
const content = await Bun.file(file).text()
const jsxDir = relative(
dirname(file),
resolve(import.meta.dirname, '../src/_lib/jsx'),
)
await Bun.write(
file,
content
.replaceAll('hono/jsx/jsx-runtime', 'farc/jsx/jsx-runtime')
.replaceAll('hono/jsx/jsx-dev-runtime', 'farc/jsx/jsx-dev-runtime'),
.replaceAll(
'hono/jsx/jsx-runtime',
`${jsxDir.startsWith('.') ? jsxDir : `./${jsxDir}`}/jsx-runtime`,
)
.replaceAll(
'hono/jsx/jsx-dev-runtime',
`${jsxDir.startsWith('.') ? jsxDir : `./${jsxDir}`}/jsx-dev-runtime`,
),
)
}
}
Loading

0 comments on commit 68854fd

Please sign in to comment.