mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-31 10:58:04 +08:00
feat: supporting run on bun
This commit is contained in:
parent
9ad3622526
commit
99b06e51cb
2777
pnpm-lock.yaml
generated
2777
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ import type { NewsItem } from "@shared/types"
|
|||||||
|
|
||||||
export default defineSource(async () => {
|
export default defineSource(async () => {
|
||||||
const baseURL = "https://www.gelonghui.com"
|
const baseURL = "https://www.gelonghui.com"
|
||||||
const html: any = await $fetch("https://www.gelonghui.com/news")
|
const html: any = await $fetch("https://www.gelonghui.com/news/")
|
||||||
const $ = cheerio.load(html)
|
const $ = cheerio.load(html)
|
||||||
const $main = $(".article-content")
|
const $main = $(".article-content")
|
||||||
const news: NewsItem[] = []
|
const news: NewsItem[] = []
|
||||||
|
@ -11,9 +11,6 @@ import type { VitePWAOptions } from "vite-plugin-pwa"
|
|||||||
import { VitePWA } from "vite-plugin-pwa"
|
import { VitePWA } from "vite-plugin-pwa"
|
||||||
import { projectDir } from "./shared/dir"
|
import { projectDir } from "./shared/dir"
|
||||||
|
|
||||||
const isCF = process.env.CF_PAGES
|
|
||||||
const isVercel = process.env.VERCEL
|
|
||||||
|
|
||||||
dotenv.config({
|
dotenv.config({
|
||||||
path: join(projectDir, ".env.server"),
|
path: join(projectDir, ".env.server"),
|
||||||
})
|
})
|
||||||
@ -68,18 +65,18 @@ const nitroOption: Parameters<typeof nitro>[0] = {
|
|||||||
connector: "sqlite",
|
connector: "sqlite",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
preset: "node-server",
|
||||||
alias: {
|
alias: {
|
||||||
"@shared": join(projectDir, "shared"),
|
"@shared": join(projectDir, "shared"),
|
||||||
"#": join(projectDir, "server"),
|
"#": join(projectDir, "server"),
|
||||||
},
|
},
|
||||||
preset: "node-server",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isVercel) {
|
if (process.env.VERCEL) {
|
||||||
nitroOption.preset = "vercel-edge"
|
nitroOption.preset = "vercel-edge"
|
||||||
// You can use other online database, do it yourself. For more info: https://db0.unjs.io/connectors
|
// You can use other online database, do it yourself. For more info: https://db0.unjs.io/connectors
|
||||||
nitroOption.database = undefined
|
nitroOption.database = undefined
|
||||||
} else if (isCF) {
|
} else if (process.env.CF_PAGES) {
|
||||||
nitroOption.preset = "cloudflare-pages"
|
nitroOption.preset = "cloudflare-pages"
|
||||||
nitroOption.database = {
|
nitroOption.database = {
|
||||||
default: {
|
default: {
|
||||||
@ -89,6 +86,13 @@ if (isVercel) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
} else if (process.env.BUN) {
|
||||||
|
nitroOption.preset = "bun"
|
||||||
|
nitroOption.database = {
|
||||||
|
default: {
|
||||||
|
connector: "bun-sqlite",
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user