Skip to content

Commit ae2399d

Browse files
authored
Merge pull request #17 from bmthd/migrate-valibot-env-to-t3-env
refactor: migrate from valibot-env to @t3-oss/env-nextjs
2 parents 585b62e + a408031 commit ae2399d

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

bun.lock

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@conform-to/react": "^1.7.2",
88
"@conform-to/valibot": "^1.7.2",
99
"@next/third-parties": "^15.3.4",
10+
"@t3-oss/env-nextjs": "^0.13.8",
1011
"@valibot/i18n": "^1.0.0",
1112
"@vercel/analytics": "^1.5.0",
1213
"@yamada-ui/lucide": "^1.10.5",
@@ -22,7 +23,6 @@
2223
"remeda": "^2.23.0",
2324
"server-only": "^0.0.1",
2425
"valibot": "^1.1.0",
25-
"valibot-env": "^0.2.1",
2626
},
2727
"devDependencies": {
2828
"@biomejs/biome": "^2.0.4",
@@ -478,6 +478,10 @@
478478

479479
"@swc/helpers": ["@swc/[email protected]", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g=="],
480480

481+
"@t3-oss/env-core": ["@t3-oss/[email protected]", "", { "peerDependencies": { "arktype": "^2.1.0", "typescript": ">=5.0.0", "valibot": "^1.0.0-beta.7 || ^1.0.0", "zod": "^3.24.0 || ^4.0.0-beta.0" }, "optionalPeers": ["arktype", "typescript", "valibot", "zod"] }, "sha512-L1inmpzLQyYu4+Q1DyrXsGJYCXbtXjC4cICw1uAKv0ppYPQv656lhZPU91Qd1VS6SO/bou1/q5ufVzBGbNsUpw=="],
482+
483+
"@t3-oss/env-nextjs": ["@t3-oss/[email protected]", "", { "dependencies": { "@t3-oss/env-core": "0.13.8" }, "peerDependencies": { "arktype": "^2.1.0", "typescript": ">=5.0.0", "valibot": "^1.0.0-beta.7 || ^1.0.0", "zod": "^3.24.0 || ^4.0.0-beta.0" }, "optionalPeers": ["arktype", "typescript", "valibot", "zod"] }, "sha512-QmTLnsdQJ8BiQad2W2nvV6oUpH4oMZMqnFEjhVpzU0h3sI9hn8zb8crjWJ1Amq453mGZs6A4v4ihIeBFDOrLeQ=="],
484+
481485
"@tanstack/react-table": ["@tanstack/[email protected]", "", { "dependencies": { "@tanstack/table-core": "8.21.3" }, "peerDependencies": { "react": ">=16.8", "react-dom": ">=16.8" } }, "sha512-5nNMTSETP4ykGegmVkhjcS8tTLW6Vl4axfEGQN3v0zdHYbK4UfoqfPChclTrJ4EoK9QynqAu9oUf8VEmrpZ5Ww=="],
482486

483487
"@tanstack/table-core": ["@tanstack/[email protected]", "", {}, "sha512-ldZXEhOBb8Is7xLs01fR3YEc3DERiz5silj8tnGkFZytt1abEvl/GhUmCE0PMLaMPTa3Jk4HbKmRlHmu+gCftg=="],
@@ -1508,8 +1512,6 @@
15081512

15091513
"valibot": ["[email protected]", "", { "peerDependencies": { "typescript": ">=5" }, "optionalPeers": ["typescript"] }, "sha512-Nk8lX30Qhu+9txPYTwM0cFlWLdPFsFr6LblzqIySfbZph9+BFsAHsNvHOymEviUepeIW6KFHzpX8TKhbptBXXw=="],
15101514

1511-
"valibot-env": ["[email protected]", "", { "peerDependencies": { "valibot": "^1.0.0-beta.3" } }, "sha512-XuYSwiGuuSeaaMYl+j5qJuvKO+ZcbC24XJoyNXTZjVmsdPmGRrJfpP7LPLZtpBCG/T2RP/eIaQnaE6QCoDiU1Q=="],
1512-
15131515
"vfile": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="],
15141516

15151517
"vfile-location": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="],

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@conform-to/react": "^1.7.2",
2929
"@conform-to/valibot": "^1.7.2",
3030
"@next/third-parties": "^15.3.4",
31+
"@t3-oss/env-nextjs": "^0.13.8",
3132
"@valibot/i18n": "^1.0.0",
3233
"@vercel/analytics": "^1.5.0",
3334
"@yamada-ui/lucide": "^1.10.5",
@@ -42,8 +43,7 @@
4243
"react-dom": "^19.1.0",
4344
"remeda": "^2.23.0",
4445
"server-only": "^0.0.1",
45-
"valibot": "^1.1.0",
46-
"valibot-env": "^0.2.1"
46+
"valibot": "^1.1.0"
4747
},
4848
"devDependencies": {
4949
"@biomejs/biome": "^2.0.4",

src/utils/env/index.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1+
import { createEnv } from "@t3-oss/env-nextjs";
12
import * as v from "valibot";
2-
import { createEnv } from "valibot-env/nextjs";
33

44
/**
55
* 検証済み環境変数
6-
* @see https://zenn.dev/chot/articles/abount-valibot-env
76
*/
87
export const env = createEnv({
9-
schema: {
10-
public: {},
11-
private: {
12-
GMAIL_ADDRESS: v.pipe(v.string(), v.email()),
13-
GMAIL_PASSWORD: v.string(),
14-
},
15-
shared: {
16-
NODE_ENV: v.union([v.literal("development"), v.literal("production"), v.literal("test")]),
17-
GA_ID: v.string(),
18-
},
8+
server: {
9+
GMAIL_ADDRESS: v.pipe(v.string(), v.email()),
10+
GMAIL_PASSWORD: v.string(),
1911
},
20-
values: {
12+
client: {
13+
NEXT_PUBLIC_GA_ID: v.string(),
14+
},
15+
shared: {
16+
NODE_ENV: v.union([v.literal("development"), v.literal("production"), v.literal("test")]),
17+
},
18+
runtimeEnv: {
2119
NODE_ENV: process.env.NODE_ENV,
2220
GMAIL_ADDRESS: process.env.GMAIL_ADDRESS,
2321
GMAIL_PASSWORD: process.env.GMAIL_PASSWORD,
24-
GA_ID: process.env.NEXT_PUBLIC_GA_ID,
22+
NEXT_PUBLIC_GA_ID: process.env.NEXT_PUBLIC_GA_ID,
2523
},
2624
});

src/views/csv/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ArrowDownIcon } from "@yamada-ui/lucide";
22
import { Markdown } from "@yamada-ui/markdown";
33
import { Box, Container, Heading, HStack } from "@yamada-ui/react";
4-
import { type Column, Table, TableProps } from "@yamada-ui/table";
4+
import { type Column, Table, type TableProps } from "@yamada-ui/table";
55
import { readFileSync } from "node:fs";
66
import path from "node:path";
77
import papa from "papaparse";

src/views/layout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const LayoutPage: FC<{ children: ReactNode }> = ({ children }) => {
1313
return (
1414
<Providers>
1515
<Analytics />
16-
<GoogleAnalytics gaId={env.GA_ID} />
16+
<GoogleAnalytics gaId={env.NEXT_PUBLIC_GA_ID} />
1717
<Header />
1818
<Separator />
1919
<Navigation />

0 commit comments

Comments
 (0)