-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
👍 型安全に環境変数を扱うよう変更
- Loading branch information
Showing
9 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Importing env files here to validate on build | ||
import './src/env.mjs'; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const config = { | ||
reactStrictMode: true, | ||
/** Enables hot reloading for local packages without a build step */ | ||
transpilePackages: [], | ||
/** We already do linting and typechecking as separate tasks in CI */ | ||
eslint: { ignoreDuringBuilds: true }, | ||
typescript: { ignoreBuildErrors: true }, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { createEnv } from '@t3-oss/env-nextjs'; | ||
import { z } from 'zod'; | ||
|
||
export const env = createEnv({ | ||
/** | ||
* Specify your server-side environment variables schema here. This way you can ensure the app isn't | ||
* built with invalid env vars. | ||
*/ | ||
server: { | ||
NODE_ENV: z.string().min(1), | ||
}, | ||
/** | ||
* Specify your client-side environment variables schema here. | ||
* For them to be exposed to the client, prefix them with `NEXT_PUBLIC_`. | ||
*/ | ||
client: { | ||
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: z.string().min(1), | ||
}, | ||
/** | ||
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away. | ||
*/ | ||
runtimeEnv: { | ||
NODE_ENV: process.env.NODE_ENV, | ||
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID, | ||
}, | ||
skipValidation: !!process.env.CI || !!process.env.SKIP_ENV_VALIDATION, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
'use client'; | ||
|
||
import { GA_TRACKING_ID } from '@/lib'; | ||
import { env } from '@/env.mjs'; | ||
|
||
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages | ||
export const pageView = (url: string) => { | ||
if (!GA_TRACKING_ID) return; | ||
window.gtag('config', GA_TRACKING_ID, { | ||
window.gtag('config', env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID, { | ||
page_path: url, | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './analytics'; | ||
export * from './constants'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
b0391bd
There was a problem hiding this comment.
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:
tatsutakein-jp – ./
tatsutakein-jp-git-main-tatsutakein.vercel.app
tatsutakein-jp-tatsutakein.vercel.app
tatsutakein.jp
www.tatsutakein.jp