Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow SQL files to be imported #89

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.sql' {
const content: string
export default content
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"deploy": "wrangler deploy",
"deploy-with-ui": "pnpm run build && wrangler deploy",
"dev": "vite dev",
"dev": "pnpm run build && wrangler dev",
"build": "vite build --mode client && vite build",
"start": "wrangler dev",
"publish-npm-module": "npm publish --access public",
Expand Down
Empty file added src/sql/user.sql
Empty file.
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default defineConfig(({ mode }) => {

const entry = './src/index.ts'
return {
assetsInclude: ['**/*.sql'],
server: { port: 8787 },
plugins: [
devServer({ adapter: cloudflareAdapter, entry }),
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
assetsInclude: ['**/*.sql'],
test: {
coverage: {
provider: 'istanbul',
Expand Down
4 changes: 4 additions & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ compatibility_flags = ["nodejs_compat_v2"]

assets = { directory = "./public/" }

rules = [
{ type = "Text", globs = ["**/*.sql"], fallthrough = true }
]

# Service Bindings
## DO NOT REMOVE: TEMPLATE SERVICES ##

Expand Down
Loading