From 061181d59d3852710ebe8713deeee5bb449c1136 Mon Sep 17 00:00:00 2001 From: dswbx Date: Tue, 27 May 2025 20:25:37 +0200 Subject: [PATCH] repo chores: fixed root dir, removed unused class, added .env.example --- app/.env.example | 42 ++++++++++++ app/src/core/server/lib/jscValidator.ts | 29 -------- app/tsconfig.build.json | 12 +++- app/tsconfig.json | 90 ++++++++++++------------- app/vite.config.ts | 5 +- 5 files changed, 100 insertions(+), 78 deletions(-) create mode 100644 app/.env.example delete mode 100644 app/src/core/server/lib/jscValidator.ts diff --git a/app/.env.example b/app/.env.example new file mode 100644 index 0000000..a70d8e7 --- /dev/null +++ b/app/.env.example @@ -0,0 +1,42 @@ +# ===== DB Settings ===== +VITE_DB_URL=:memory: +# you can set a location for a database here, it'll overwrite the previous setting +# ideally use the ".db" folder (create it first), it's git ignored +VITE_DB_URL=file:.db/dev.db + +# alternatively, you can use url/token combination +#VITE_DB_URL= +#VITE_DB_TOKEN= + + +# ===== DEV Server ===== +# restart the dev server on every change (enable with "1") +VITE_APP_FRESH= +# displays react-scan widget (enable with "1") +VITE_DEBUG_RERENDERS= +# console logs registered routes on start (enable with "1") +VITE_SHOW_ROUTES= + + +# ===== Test Credentials ===== +RESEND_API_KEY= +R2_TOKEN= + +R2_ACCESS_KEY= +R2_SECRET_ACCESS_KEY= +R2_URL= + +AWS_ACCESS_KEY= +AWS_SECRET_KEY= +AWS_S3_URL= + +OAUTH_CLIENT_ID= +OAUTH_CLIENT_SECRET= + +PUBLIC_POSTHOG_KEY= +PUBLIC_POSTHOG_HOST= + +# ===== Internals ===== +BKND_CLI_CREATE_REF=main +BKND_CLI_LOG_LEVEL=debug +BKND_MODULES_DEBUG=1 \ No newline at end of file diff --git a/app/src/core/server/lib/jscValidator.ts b/app/src/core/server/lib/jscValidator.ts deleted file mode 100644 index c61f362..0000000 --- a/app/src/core/server/lib/jscValidator.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { Env, Input, MiddlewareHandler, ValidationTargets } from "hono"; -import { validator } from "hono/validator"; -import type { Static, TSchema } from "simple-jsonschema-ts"; - -export const honoValidator = < - Target extends keyof ValidationTargets, - E extends Env, - P extends string, - const Schema extends TSchema = TSchema, - Out = Static, - I extends Input = { - in: { [K in Target]: Static }; - out: { [K in Target]: Static }; - }, ->( - target: Target, - schema: Schema, -): MiddlewareHandler => { - // @ts-expect-error not typed well - return validator(target, async (value, c) => { - const coersed = schema.coerce(value); - const result = schema.validate(coersed); - if (!result.valid) { - return c.json({ ...result, schema }, 400); - } - - return coersed as Out; - }); -}; diff --git a/app/tsconfig.build.json b/app/tsconfig.build.json index 14c4f27..31ea592 100644 --- a/app/tsconfig.build.json +++ b/app/tsconfig.build.json @@ -1,5 +1,11 @@ { - "extends": "./tsconfig.json", - "include": ["./src/**/*.ts", "./src/**/*.tsx"], - "exclude": ["./node_modules", "./__test__", "./e2e"] + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/types", + "rootDir": "./src", + "baseUrl": ".", + "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo" + }, + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "exclude": ["./node_modules", "./__test__", "./e2e"] } diff --git a/app/tsconfig.json b/app/tsconfig.json index 8ff85f4..e8cc40d 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -1,47 +1,47 @@ { - "compilerOptions": { - "types": ["bun-types", "@cloudflare/workers-types"], - "composite": false, - "incremental": true, - "module": "ESNext", - "moduleResolution": "bundler", - "jsx": "react-jsx", - "allowImportingTsExtensions": false, - "target": "ES2022", - "noImplicitAny": false, - "allowJs": true, - "verbatimModuleSyntax": true, - "declaration": true, - "strict": true, - "allowUnusedLabels": false, - "allowUnreachableCode": false, - "exactOptionalPropertyTypes": false, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": false, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": false, - "noUnusedParameters": false, - "isolatedModules": true, - "esModuleInterop": true, - "skipLibCheck": true, - "rootDir": "./src", - "outDir": "./dist/types", - "baseUrl": ".", - "paths": { - "*": ["./src/*"], - "bknd": ["./src/*"] - } - }, - "include": [ - "./src/**/*.ts", - "./src/**/*.tsx", - "vite.dev.ts", - "build.ts", - "build.cli.ts", - "__test__", - "e2e/**/*.ts" - ], - "exclude": ["node_modules", "dist", "dist/types", "**/*.d.ts"] + "compilerOptions": { + "types": ["bun-types", "@cloudflare/workers-types"], + "composite": false, + "incremental": true, + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "allowImportingTsExtensions": false, + "target": "ES2022", + "noImplicitAny": false, + "allowJs": true, + "verbatimModuleSyntax": true, + "declaration": true, + "strict": true, + "allowUnusedLabels": false, + "allowUnreachableCode": false, + "exactOptionalPropertyTypes": false, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "isolatedModules": true, + "esModuleInterop": true, + "skipLibCheck": true, + "rootDir": ".", + "baseUrl": ".", + "outDir": "./dist/types", + "paths": { + "*": ["./src/*"], + "bknd": ["./src/*"] + } + }, + "include": [ + "./src/**/*.ts", + "./src/**/*.tsx", + "vite.dev.ts", + "build.ts", + "build.cli.ts", + "__test__", + "e2e/**/*.ts" + ], + "exclude": ["node_modules", "dist", "dist/types", "**/*.d.ts"] } diff --git a/app/vite.config.ts b/app/vite.config.ts index 1e28989..2fb1930 100644 --- a/app/vite.config.ts +++ b/app/vite.config.ts @@ -23,7 +23,10 @@ export default defineConfig({ }, plugins: [ react(), - tsconfigPaths(), + tsconfigPaths({ + // otherwise it'll throw an error because of examples/astro + ignoreConfigErrors: true, + }), devServer({ ...devServerConfig, entry: "./vite.dev.ts",