fix: db was not auto created
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ import { ourongxing, react } from "@ourongxing/eslint-config"
|
|||||||
export default ourongxing({
|
export default ourongxing({
|
||||||
type: "app",
|
type: "app",
|
||||||
// 貌似不能 ./ 开头,
|
// 貌似不能 ./ 开头,
|
||||||
ignores: ["src/routeTree.gen.ts", "imports.app.d.ts", "public/", ".vscode"],
|
ignores: ["src/routeTree.gen.ts", "imports.app.d.ts", "public/", ".vscode", "**/*.json"],
|
||||||
}).append(react({
|
}).append(react({
|
||||||
files: ["src/**"],
|
files: ["src/**"],
|
||||||
}))
|
}))
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ const nitroOption: Parameters<typeof viteNitro>[0] = {
|
|||||||
sourceMap: false,
|
sourceMap: false,
|
||||||
database: {
|
database: {
|
||||||
default: {
|
default: {
|
||||||
connector: "sqlite",
|
connector: "better-sqlite3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
imports: {
|
imports: {
|
||||||
|
|||||||
+15
-5
@@ -104,20 +104,30 @@
|
|||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"dayjs": "patches/dayjs.patch"
|
"dayjs": "patches/dayjs.patch"
|
||||||
}
|
},
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@napi-rs/pinyin",
|
||||||
|
"@parcel/watcher",
|
||||||
|
"@swc/core",
|
||||||
|
"better-sqlite3",
|
||||||
|
"esbuild",
|
||||||
|
"sharp",
|
||||||
|
"simple-git-hooks",
|
||||||
|
"workerd"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"cross-spawn": ">=7.0.6",
|
"cross-spawn": ">=7.0.6",
|
||||||
"dayjs": "1.11.13",
|
"dayjs": "1.11.13",
|
||||||
"picomatch": "^4.0.2"
|
"picomatch": "^4.0.2",
|
||||||
|
"react": "^19",
|
||||||
|
"db0": "^0.3.1",
|
||||||
|
"vite": "^6"
|
||||||
},
|
},
|
||||||
"simple-git-hooks": {
|
"simple-git-hooks": {
|
||||||
"pre-commit": "npx lint-staged"
|
"pre-commit": "npx lint-staged"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*": "eslint --fix"
|
"*": "eslint --fix"
|
||||||
},
|
|
||||||
"volta": {
|
|
||||||
"node": "22.12.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+1322
-1580
File diff suppressed because it is too large
Load Diff
@@ -73,13 +73,13 @@ export class Cache {
|
|||||||
|
|
||||||
export async function getCacheTable() {
|
export async function getCacheTable() {
|
||||||
try {
|
try {
|
||||||
// 如果没有数据库,这里不会报错,只会在第一次访问的时候报错
|
|
||||||
const db = useDatabase()
|
const db = useDatabase()
|
||||||
|
logger.info("db: ", db.getInstance())
|
||||||
if (process.env.ENABLE_CACHE === "false") return
|
if (process.env.ENABLE_CACHE === "false") return
|
||||||
const cacheTable = new Cache(db)
|
const cacheTable = new Cache(db)
|
||||||
if (process.env.INIT_TABLE !== "false") await cacheTable.init()
|
if (process.env.INIT_TABLE !== "false") await cacheTable.init()
|
||||||
return cacheTable
|
return cacheTable
|
||||||
} catch {
|
} catch (e) {
|
||||||
// logger.error("failed to init database ", e)
|
logger.error("failed to init database ", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user