Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

MR fixes; remove zod

Sara Vieira02c3cf4a39e3
diff --git a/app/shared/env/env-check.js b/app/shared/env/env-check.js
deleted file mode 100644
index 6d4ff966ed..0000000000
--- a/app/shared/env/env-check.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// @ts-check
-/**
- * This file is included in `/remix.config.js` which ensures the app isn't built with invalid env vars.
- * It has to be a `.js`-file to be imported there.
- */
-/* eslint-disable @typescript-eslint/no-var-requires */
-const { z } = require("zod");
-
-const envSchema = z.object({
- DATABASE_URL: z.string().url(),
- AUTH_SECRET: z.string().min(10),
-});
-
-const env = envSchema.safeParse(process.env);
-
-if (!env.success) {
- // eslint-disable-next-line no-console
- console.error(
- "❌ Invalid environment variables:",
- JSON.stringify(env.error.format(), null, 4)
- );
- process.exit(1);
-}
-module.exports.env = env.data;
diff --git a/env-check.js b/env-check.js
new file mode 100644
index 0000000000..9274dd1e8d
--- /dev/null
+++ b/env-check.js
@@ -0,0 +1,25 @@
+// @ts-check
+/**
+ * This file is included in `/remix.config.js` which ensures the app isn't built with invalid env vars.
+ * It has to be a `.js`-file to be imported there.
+ */
+/* eslint-disable @typescript-eslint/no-var-requires */
+
+if (process.env.NODE_ENV !== "production") {
+ const REQUIRED_ENVS = ["DATABASE_URL", "AUTH_SECRET"];
+
+ const errors = [];
+
+ REQUIRED_ENVS.map((env) => {
+ if (!process.env[env])
+ errors.push(`👉 The ${env} environment variable is required`);
+ });
+
+ if (errors.length) {
+ // eslint-disable-next-line no-console
+ console.error("❌ Invalid environment variables:");
+ // eslint-disable-next-line no-console
+ console.error(errors.join("\n"));
+ process.exit(1);
+ }
+}
diff --git a/package.json b/package.json
index be370051f7..8257c6b6b7 100644
--- a/package.json
+++ b/package.json
@@ -132,8 +132,7 @@
"prettier": "^2.6.2",
"prisma": "^3.14.0",
"relative-deps": "^1.0.7",
- "typescript": "4.6.4",
- "zod": "^3.17.3"
+ "typescript": "4.6.4"
},
"engines": {
"node": ">=14 <=16"
diff --git a/remix.config.js b/remix.config.js
index d65207f6af..d59b7f996a 100644
--- a/remix.config.js
+++ b/remix.config.js
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const { env } = require("./app/shared/env/env-check");
+require("./env-check");
/**
* @type {import('@remix-run/dev').AppConfig}
diff --git a/yarn.lock b/yarn.lock
index 28d3530356..c61b26d9b1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15898,11 +15898,6 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
-zod@^3.17.3:
- version "3.17.3"
- resolved "https://registry.yarnpkg.com/zod/-/zod-3.17.3.tgz#86abbc670ff0063a4588d85a4dcc917d6e4af2ba"
- integrity sha512-4oKP5zvG6GGbMlqBkI5FESOAweldEhSOZ6LI6cG+JzUT7ofj1ZOC0PJudpQOpT1iqOFpYYtX5Pw0+o403y4bcg==
-
zwitch@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920"