diff --git a/env/client.mjs b/env/client.mjs deleted file mode 100644 index 58eb7342a..000000000 --- a/env/client.mjs +++ /dev/null @@ -1,36 +0,0 @@ -// @ts-check -import { clientEnv, clientSchema } from './schema.mjs' - -const _clientEnv = clientSchema.safeParse(clientEnv) - -export const formatErrors = ( - /** @type {import('zod').ZodFormattedError,string>} */ - errors -) => - Object.entries(errors) - .map(([name, value]) => { - if (value && '_errors' in value) { - return `${name}: ${value._errors.join(', ')}\n` - } - return null - }) - .filter(Boolean) - -if (!_clientEnv.success) { - const msg = [ - '❌ Invalid environment variables [Client]:\n', - ...formatErrors(_clientEnv.error.format()), - ].join('') - console.error(msg) - throw new Error(msg) -} - -for (let key of Object.keys(_clientEnv.data)) { - if (!key.startsWith('NEXT_PUBLIC_')) { - const msg = `❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'` - console.warn(msg) - throw new Error(msg) - } -} - -export const env = _clientEnv.data diff --git a/env/client.ts b/env/client.ts new file mode 100644 index 000000000..ed878b643 --- /dev/null +++ b/env/client.ts @@ -0,0 +1,8 @@ +import { createEnv } from "@t3-oss/env-nextjs" +// import { z } from "zod"; + +export const env = createEnv({ + client: {}, + emptyStringAsUndefined: true, + runtimeEnv: {}, +}); \ No newline at end of file diff --git a/env/schema.mjs b/env/schema.mjs deleted file mode 100644 index c5917cb71..000000000 --- a/env/schema.mjs +++ /dev/null @@ -1,50 +0,0 @@ -// @ts-check -import { z } from "zod" - -/** - * Specify your server-side environment variables schema here. - * This way you can ensure the app isn"t built with invalid env vars. - */ -export const serverSchema = z.object({ - CMS_ACCESS_TOKEN: z.string(), - CMS_API_KEY: z.string(), - CMS_ENVIRONMENT: z.enum(["development", "production", "staging", "test"]), - CMS_URL: z.string(), - CMS_PREVIEW_URL: z.string(), - CMS_PREVIEW_TOKEN: z.string(), - NODE_ENV: z.enum(["development", "test", "production"]), - PRINT_QUERY: z.boolean().default(false), -}) - -/** - * You can't destruct `process.env` as a regular object in the Next.js - * middleware, so you have to do it manually here. - * @type {{ [k in keyof z.input]: string | undefined }} - */ -export const serverEnv = { - CMS_ACCESS_TOKEN: process.env.CMS_ACCESS_TOKEN, - CMS_API_KEY: process.env.CMS_API_KEY, - CMS_ENVIRONMENT: process.env.CMS_ENVIRONMENT, - CMS_URL: process.env.CMS_URL, - CMS_PREVIEW_URL: process.env.CMS_PREVIEW_URL, - CMS_PREVIEW_TOKEN: process.env.CMS_PREVIEW_TOKEN, - NODE_ENV: process.env.NODE_ENV, - PRINT_QUERY: process.env.PRINT_QUERY, -}; - -/** - * Specify your client-side environment variables schema here. - * This way you can ensure the app isn"t built with invalid env vars. - * To expose them to the client, prefix them with `NEXT_PUBLIC_`. - */ -export const clientSchema = z.object({ -}) - -/** - * You can't destruct `process.env` as a regular object, so you have to do - * it manually here. This is because Next.js evaluates this at build time, - * and only used environment variables are included in the build. - * @type {{ [k in keyof z.infer]: z.infer[k] | undefined }} - */ -export const clientEnv = { -} diff --git a/env/server.mjs b/env/server.mjs deleted file mode 100644 index ce7c54482..000000000 --- a/env/server.mjs +++ /dev/null @@ -1,33 +0,0 @@ -// @ts-check -/** - * This file is included in `/next.config.mjs` which ensures the app isn't built with invalid env vars. - * It has to be a `.mjs`-file to be imported there. - */ -import { serverSchema, serverEnv } from './schema.mjs' -import { env as clientEnv, formatErrors } from './client.mjs' - -const _serverEnv = serverSchema.safeParse(serverEnv) - -if (!_serverEnv.success) { - const msg = [ - '❌ Invalid environment variables [Server]:\n', - ...formatErrors(_serverEnv.error.format()), - ].join('') - console.error(msg) - throw new Error(msg) -} - -for (let key of Object.keys(_serverEnv.data)) { - const msg = [] - if (key.startsWith('NEXT_PUBLIC_')) { - msg.push( - `❌ You are exposing a server-side env-variable: ${key}\n` - ) - } - if (msg.length) { - console.warn(msg.join('')) - throw new Error(msg.join('')) - } -} - -export const env = { ..._serverEnv.data, ...clientEnv } diff --git a/env/server.ts b/env/server.ts new file mode 100644 index 000000000..8922405f4 --- /dev/null +++ b/env/server.ts @@ -0,0 +1,26 @@ +import { createEnv } from "@t3-oss/env-nextjs" +import { z } from "zod"; + +export const env = createEnv({ + server: { + CMS_ACCESS_TOKEN: z.string(), + CMS_API_KEY: z.string(), + CMS_ENVIRONMENT: z.enum(["development", "production", "staging", "test"]), + CMS_URL: z.string(), + CMS_PREVIEW_URL: z.string(), + CMS_PREVIEW_TOKEN: z.string(), + NODE_ENV: z.enum(["development", "test", "production"]), + PRINT_QUERY: z.boolean().default(false), + }, + emptyStringAsUndefined: true, + runtimeEnv: { + CMS_ACCESS_TOKEN: process.env.CMS_ACCESS_TOKEN, + CMS_API_KEY: process.env.CMS_API_KEY, + CMS_ENVIRONMENT: process.env.CMS_ENVIRONMENT, + CMS_URL: process.env.CMS_URL, + CMS_PREVIEW_URL: process.env.CMS_PREVIEW_URL, + CMS_PREVIEW_TOKEN: process.env.CMS_PREVIEW_TOKEN, + NODE_ENV: process.env.NODE_ENV, + PRINT_QUERY: process.env.PRINT_QUERY, + }, +}); \ No newline at end of file diff --git a/lib/previewRequest.ts b/lib/previewRequest.ts index 8f358878f..add923e7e 100644 --- a/lib/previewRequest.ts +++ b/lib/previewRequest.ts @@ -1,7 +1,7 @@ import "server-only"; import { request as graphqlRequest } from "graphql-request"; -import { env } from "@/env/server.mjs"; +import { env } from "@/env/server"; import type { Data } from "@/types/request"; import type { DocumentNode } from "graphql"; diff --git a/lib/request.ts b/lib/request.ts index c43d7c1bb..92e5889e4 100644 --- a/lib/request.ts +++ b/lib/request.ts @@ -1,6 +1,6 @@ import "server-only" import { request as graphqlRequest } from "graphql-request" -import { env } from "@/env/server.mjs" +import { env } from "@/env/server" import type { Data } from "@/types/request" import type { DocumentNode } from "graphql" diff --git a/next.config.js b/next.config.js index c3d59e8e3..9853b1e4a 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,13 @@ +import createJiti from "jiti" + +const jiti = createJiti(new URL(import.meta.url).pathname); + +jiti("./env/server"); +jiti("./env/client"); + /** @type {import('next').NextConfig} */ const nextConfig = { + eslint: { ignoreDuringBuilds: true }, images: { remotePatterns: [ { @@ -21,4 +29,4 @@ const nextConfig = { } }; -module.exports = nextConfig; +export default nextConfig \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c393cc767..9fa5c3bf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,11 +9,12 @@ "version": "0.1.0", "dependencies": { "@contentstack/live-preview-utils": "^1.4.0", + "@t3-oss/env-nextjs": "0.9.2", "class-variance-authority": "^0.7.0", "graphql": "16.8.1", "graphql-request": "6.1.0", "graphql-tag": "2.12.6", - "next": "14.0.4", + "next": "14.1.0", "react": "^18", "react-dom": "^18", "server-only": "0.0.1", @@ -25,6 +26,7 @@ "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.0.4", + "jiti": "1.21.0", "typescript": "^5" }, "engines": { @@ -161,9 +163,9 @@ "dev": true }, "node_modules/@next/env": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.4.tgz", - "integrity": "sha512-irQnbMLbUNQpP1wcE5NstJtbuA/69kRfzBrpAD7Gsn8zm/CY6YQYc3HQBz8QPxwISG26tIm5afvvVbu508oBeQ==" + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.1.0.tgz", + "integrity": "sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.0.4", @@ -175,9 +177,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.4.tgz", - "integrity": "sha512-mF05E/5uPthWzyYDyptcwHptucf/jj09i2SXBPwNzbgBNc+XnwzrL0U6BmPjQeOL+FiB+iG1gwBeq7mlDjSRPg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.0.tgz", + "integrity": "sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==", "cpu": [ "arm64" ], @@ -190,9 +192,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.4.tgz", - "integrity": "sha512-IZQ3C7Bx0k2rYtrZZxKKiusMTM9WWcK5ajyhOZkYYTCc8xytmwSzR1skU7qLgVT/EY9xtXDG0WhY6fyujnI3rw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.0.tgz", + "integrity": "sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==", "cpu": [ "x64" ], @@ -205,9 +207,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.4.tgz", - "integrity": "sha512-VwwZKrBQo/MGb1VOrxJ6LrKvbpo7UbROuyMRvQKTFKhNaXjUmKTu7wxVkIuCARAfiI8JpaWAnKR+D6tzpCcM4w==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.0.tgz", + "integrity": "sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==", "cpu": [ "arm64" ], @@ -220,9 +222,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.4.tgz", - "integrity": "sha512-8QftwPEW37XxXoAwsn+nXlodKWHfpMaSvt81W43Wh8dv0gkheD+30ezWMcFGHLI71KiWmHK5PSQbTQGUiidvLQ==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.0.tgz", + "integrity": "sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==", "cpu": [ "arm64" ], @@ -235,9 +237,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.4.tgz", - "integrity": "sha512-/s/Pme3VKfZAfISlYVq2hzFS8AcAIOTnoKupc/j4WlvF6GQ0VouS2Q2KEgPuO1eMBwakWPB1aYFIA4VNVh667A==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.0.tgz", + "integrity": "sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==", "cpu": [ "x64" ], @@ -250,9 +252,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.4.tgz", - "integrity": "sha512-m8z/6Fyal4L9Bnlxde5g2Mfa1Z7dasMQyhEhskDATpqr+Y0mjOBZcXQ7G5U+vgL22cI4T7MfvgtrM2jdopqWaw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.0.tgz", + "integrity": "sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==", "cpu": [ "x64" ], @@ -265,9 +267,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.4.tgz", - "integrity": "sha512-7Wv4PRiWIAWbm5XrGz3D8HUkCVDMMz9igffZG4NB1p4u1KoItwx9qjATHz88kwCEal/HXmbShucaslXCQXUM5w==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.0.tgz", + "integrity": "sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==", "cpu": [ "arm64" ], @@ -280,9 +282,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.4.tgz", - "integrity": "sha512-zLeNEAPULsl0phfGb4kdzF/cAVIfaC7hY+kt0/d+y9mzcZHsMS3hAS829WbJ31DkSlVKQeHEjZHIdhN+Pg7Gyg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.0.tgz", + "integrity": "sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==", "cpu": [ "ia32" ], @@ -295,9 +297,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.4.tgz", - "integrity": "sha512-yEh2+R8qDlDCjxVpzOTEpBLQTEFAcP2A8fUFLaWNap9GitYKkKv1//y2S6XY6zsR4rCOPRpU7plYDR+az2n30A==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.0.tgz", + "integrity": "sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==", "cpu": [ "x64" ], @@ -358,6 +360,37 @@ "tslib": "^2.4.0" } }, + "node_modules/@t3-oss/env-core": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@t3-oss/env-core/-/env-core-0.9.2.tgz", + "integrity": "sha512-KgWXljUTHgO3o7GMZQPAD5+P+HqpauMNNHowlm7V2b9IeMitSUpNKwG6xQrup/xARWHTdxRVIl0mSI4wCevQhQ==", + "peerDependencies": { + "typescript": ">=5.0.0", + "zod": "^3.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@t3-oss/env-nextjs": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@t3-oss/env-nextjs/-/env-nextjs-0.9.2.tgz", + "integrity": "sha512-dklHrgKLESStNVB67Jdbu6osxDYA+xNKaPBRerlnkEvzbCccSKMvZENx6EZebJuR4snqB3/yRykNMn/bdIAyiQ==", + "dependencies": { + "@t3-oss/env-core": "0.9.2" + }, + "peerDependencies": { + "typescript": ">=5.0.0", + "zod": "^3.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -852,9 +885,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001587", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", + "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", "funding": [ { "type": "opencollective", @@ -1852,11 +1885,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" - }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -2448,6 +2476,15 @@ "set-function-name": "^2.0.1" } }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2685,18 +2722,17 @@ "dev": true }, "node_modules/next": { - "version": "14.0.4", - "resolved": "https://registry.npmjs.org/next/-/next-14.0.4.tgz", - "integrity": "sha512-qbwypnM7327SadwFtxXnQdGiKpkuhaRLE2uq62/nRul9cj9KhQ5LhHmlziTNqUidZotw/Q1I9OjirBROdUJNgA==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/next/-/next-14.1.0.tgz", + "integrity": "sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==", "dependencies": { - "@next/env": "14.0.4", + "@next/env": "14.1.0", "@swc/helpers": "0.5.2", "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", + "caniuse-lite": "^1.0.30001579", "graceful-fs": "^4.2.11", "postcss": "8.4.31", - "styled-jsx": "5.1.1", - "watchpack": "2.4.0" + "styled-jsx": "5.1.1" }, "bin": { "next": "dist/bin/next" @@ -2705,15 +2741,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.0.4", - "@next/swc-darwin-x64": "14.0.4", - "@next/swc-linux-arm64-gnu": "14.0.4", - "@next/swc-linux-arm64-musl": "14.0.4", - "@next/swc-linux-x64-gnu": "14.0.4", - "@next/swc-linux-x64-musl": "14.0.4", - "@next/swc-win32-arm64-msvc": "14.0.4", - "@next/swc-win32-ia32-msvc": "14.0.4", - "@next/swc-win32-x64-msvc": "14.0.4" + "@next/swc-darwin-arm64": "14.1.0", + "@next/swc-darwin-x64": "14.1.0", + "@next/swc-linux-arm64-gnu": "14.1.0", + "@next/swc-linux-arm64-musl": "14.1.0", + "@next/swc-linux-x64-gnu": "14.1.0", + "@next/swc-linux-x64-musl": "14.1.0", + "@next/swc-win32-arm64-msvc": "14.1.0", + "@next/swc-win32-ia32-msvc": "14.1.0", + "@next/swc-win32-x64-msvc": "14.1.0" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -3672,7 +3708,7 @@ "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3719,18 +3755,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index edd6d2932..e23942259 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "web", "version": "0.1.0", "private": true, + "type": "module", "scripts": { "dev": "next dev", "build": "next build", @@ -9,12 +10,13 @@ "lint": "next lint && tsc" }, "dependencies": { - "class-variance-authority": "^0.7.0", "@contentstack/live-preview-utils": "^1.4.0", + "@t3-oss/env-nextjs": "0.9.2", + "class-variance-authority": "^0.7.0", "graphql": "16.8.1", "graphql-request": "6.1.0", "graphql-tag": "2.12.6", - "next": "14.0.4", + "next": "14.1.0", "react": "^18", "react-dom": "^18", "server-only": "0.0.1", @@ -26,9 +28,10 @@ "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.0.4", + "jiti": "1.21.0", "typescript": "^5" }, "engines": { "node": "18" } -} +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 72037177a..1f09de8db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,19 @@ { "compilerOptions": { - "target": "es5", + "target": "es2022", "lib": [ "dom", "dom.iterable", - "esnext" + "ES2022" ], "allowJs": true, + "checkJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", + "moduleDetection": "force", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true,