Skip to content

Commit

Permalink
chore: bump some dips (#1584)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge authored Oct 6, 2023
1 parent b5c663d commit 9614d84
Show file tree
Hide file tree
Showing 22 changed files with 115 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-pandas-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": minor
---

bump deps and add `emptyStringAsUndefined` option for `t3-env`
5 changes: 5 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
env:
NEXTAUTH_SECRET: foo
DATABASE_URL: mysql://root:root@localhost:3306/test # can't use url from example env cause we block that in t3-env
DISCORD_CLIENT_ID: bar
DISCORD_CLIENT_SECRET: baz

build-t3-app-with-bun:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -148,3 +150,6 @@ jobs:
# - run: cd ../ci-bun && bun --bun run build
env:
NEXTAUTH_SECRET: foo
DATABASE_URL: mysql://root:root@localhost:3306/test # can't use url from example env cause we block that in t3-env
DISCORD_CLIENT_ID: bar
DISCORD_CLIENT_SECRET: baz
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@next-auth/prisma-adapter": "^1.0.7",
"@planetscale/database": "^1.11.0",
"@prisma/client": "^5.1.1",
"@t3-oss/env-nextjs": "^0.6.0",
"@t3-oss/env-nextjs": "^0.7.0",
"@tanstack/react-query": "^4.32.6",
"@trpc/client": "^10.37.1",
"@trpc/next": "^10.37.1",
Expand All @@ -89,6 +89,6 @@
"tsup": "^6.7.0",
"type-fest": "^3.7.0",
"typescript": "^5.0.4",
"zod": "^3.21.4"
"zod": "^3.22.4"
}
}
8 changes: 4 additions & 4 deletions cli/template/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"lint": "next lint"
},
"dependencies": {
"@t3-oss/env-nextjs": "^0.6.0",
"next": "^13.4.19",
"@t3-oss/env-nextjs": "^0.7.0",
"next": "^13.5.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"zod": "^3.21.4"
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.44.2",
Expand All @@ -23,7 +23,7 @@
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"eslint": "^8.47.0",
"eslint-config-next": "^13.4.19",
"eslint-config-next": "^13.5.4",
"typescript": "^5.1.6"
}
}
7 changes: 6 additions & 1 deletion cli/template/base/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
Expand All @@ -32,4 +32,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,
});
15 changes: 10 additions & 5 deletions cli/template/extras/src/env/with-auth-db.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ export const env = createEnv({
.default("development"),
NEXTAUTH_SECRET:
process.env.NODE_ENV === "production"
? z.string().min(1)
: z.string().min(1).optional(),
? z.string()
: z.string().optional(),
NEXTAUTH_URL: z.preprocess(
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
// Since NextAuth.js automatically uses the VERCEL_URL if present.
(str) => process.env.VERCEL_URL ?? str,
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
process.env.VERCEL ? z.string().min(1) : z.string().url()
process.env.VERCEL ? z.string() : z.string().url()
),
// Add `.min(1) on ID and SECRET if you want to make sure they're not empty
// Add ` on ID and SECRET if you want to make sure they're not empty
DISCORD_CLIENT_ID: z.string(),
DISCORD_CLIENT_SECRET: z.string(),
},
Expand All @@ -39,7 +39,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
Expand All @@ -59,4 +59,9 @@ export const env = createEnv({
* 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,
});
15 changes: 10 additions & 5 deletions cli/template/extras/src/env/with-auth.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ export const env = createEnv({
.default("development"),
NEXTAUTH_SECRET:
process.env.NODE_ENV === "production"
? z.string().min(1)
: z.string().min(1).optional(),
? z.string()
: z.string().optional(),
NEXTAUTH_URL: z.preprocess(
// This makes Vercel deployments not fail if you don't set NEXTAUTH_URL
// Since NextAuth.js automatically uses the VERCEL_URL if present.
(str) => process.env.VERCEL_URL ?? str,
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
process.env.VERCEL ? z.string().min(1) : z.string().url()
process.env.VERCEL ? z.string() : z.string().url()
),
// Add `.min(1) on ID and SECRET if you want to make sure they're not empty
// Add ` on ID and SECRET if you want to make sure they're not empty
DISCORD_CLIENT_ID: z.string(),
DISCORD_CLIENT_SECRET: z.string(),
},
Expand All @@ -32,7 +32,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
Expand All @@ -52,4 +52,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,
});
7 changes: 6 additions & 1 deletion cli/template/extras/src/env/with-db.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
Expand All @@ -42,4 +42,9 @@ export const env = createEnv({
* 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,
});
49 changes: 29 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions upgrade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@radix-ui/react-label": "^2.0.1",
"@radix-ui/react-select": "^1.2.1",
"@radix-ui/react-slot": "^1.0.1",
"@t3-oss/env-nextjs": "^0.6.0",
"@t3-oss/env-nextjs": "^0.7.0",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"gitdiff-parser": "^0.3.1",
Expand All @@ -37,7 +37,7 @@
"shiki": "^0.14.1",
"tailwind-merge": "^1.12.0",
"tailwindcss-animate": "^1.0.5",
"zod": "^3.21.4"
"zod": "^3.22.4"
},
"devDependencies": {
"@types/eslint": "^8.37.0",
Expand Down
13 changes: 9 additions & 4 deletions upgrade/src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export const env = createEnv({
*/
server: {
NODE_ENV: z.enum(["development", "test", "production"]),
GITHUB_PERSONAL_ACCESS_TOKEN: z.string().min(1),
GITHUB_DIFFS_OWNER: z.string().min(1),
GITHUB_DIFFS_REPO: z.string().min(1),
GITHUB_PERSONAL_ACCESS_TOKEN: z.string(),
GITHUB_DIFFS_OWNER: z.string(),
GITHUB_DIFFS_REPO: z.string(),
},

/**
Expand All @@ -19,7 +19,7 @@ export const env = createEnv({
* `NEXT_PUBLIC_`.
*/
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string().min(1),
// NEXT_PUBLIC_CLIENTVAR: z.string(),
},

/**
Expand All @@ -34,4 +34,9 @@ export const env = createEnv({
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
},
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,
});
2 changes: 1 addition & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"tailwind-scrollbar": "^3.0.0",
"treeify": "^1.1.0",
"unist-util-visit": "^4.1.2",
"zod": "^3.21.4"
"zod": "^3.22.4"
},
"devDependencies": {
"@astrojs/react": "^2.1.3",
Expand Down
2 changes: 0 additions & 2 deletions www/src/pages/ar/usage/env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ export const serverEnv = {
};
```

**ملحوطة:** النص الفارغ تتعامل معة zod علي أنه نص صحيح، إذا ما اردت ان تُغيّر هذا الاسلوب فإستخدم `z.string().min(1)`

**ملحوطة:** أضف إسم المُتغيير `TWITTER_API_TOKEN` في example.env ولكن لا تُضف الـ token

```
Expand Down
6 changes: 0 additions & 6 deletions www/src/pages/en/usage/env-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ export const env = createEnv({
});
```

<Callout type="info">
An empty string is still a string, so `z.string()` will accept an empty string
as a valid value. If you want to make sure that the environment variable is
not empty, you can use `z.string().min(1)`.
</Callout>

3. _Optional:_ Add the environment variable to `.env.example` and make sure not to include the secret in the `runtimeEnv` option

```bash
Expand Down
2 changes: 0 additions & 2 deletions www/src/pages/es/usage/env-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ export const serverSchema = z.object({
});
```

_**NOTA:** Una cadena vacía sigue siendo una cadena, por lo que `z.string()` aceptará una cadena vacía como un valor válido. Si quieres asegurarte de que la variable de entorno no esté vacía, puedes usar `z.string().min(1)`._

3. Opcional: agrega la variable de entorno a `.env.example`, pero no incluyas el token

```
Expand Down
Loading

2 comments on commit 9614d84

@vercel
Copy link

@vercel vercel bot commented on 9614d84 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 9614d84 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

t3-upgrade – ./upgrade

t3-upgrade.vercel.app
t3-upgrade-git-next-t3-oss.vercel.app
t3-upgrade-t3-oss.vercel.app

Please sign in to comment.