Skip to content

Commit

Permalink
fix(config): πŸ› βš™οΈ tsconfig, env μˆ˜μ •
Browse files Browse the repository at this point in the history
  • Loading branch information
gracefullight committed Mar 23, 2024
1 parent d80d89d commit 2ca6685
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
12 changes: 11 additions & 1 deletion apps/web/src/env.js β†’ apps/web/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

// ? https://env.t3.gg/docs/nextjs
// ? https://github.com/t3-oss/t3-env/issues/153
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment
export const env = createEnv({
shared: {
NODE_ENV: z.enum(["development", "test", "production"]),
},
/**
* Specify your server-side environment variables schema here. This way you can ensure the app
* isn't built with invalid env vars.
*/
server: {
DATABASE_URL: z.string().url(),
DATABASE_URL_NON_POOLING: z.string().url(),
NODE_ENV: z.enum(["development", "test", "production"]),
NEXTAUTH_SECRET:
process.env.NODE_ENV === "production"
? z.string().min(1)
Expand Down Expand Up @@ -61,4 +66,9 @@ export const env = createEnv({
* This is especially useful for Docker builds.
*/
skipValidation: !!process.env.SKIP_ENV_VALIDATION,
/**
* Makes it so that empty strings are treated as undefined. `SOME_VAR: z.string()` and
* `SOME_VAR=''` will throw an error.
*/
emptyStringAsUndefined: true,
});
4 changes: 2 additions & 2 deletions packages/config/ts/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"display": "Default",
"compilerOptions": {
"target": "ES2022",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": ["dom", "dom.iterable", "ES2022"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true
Expand Down
5 changes: 4 additions & 1 deletion packages/config/ts/nextjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"compilerOptions": {
"plugins": [{ "name": "next" }],
"incremental": true,
"jsx": "preserve"
"jsx": "preserve",

"moduleDetection": "force",
"moduleResolution": "Bundler"
}
}

0 comments on commit 2ca6685

Please sign in to comment.