Consolidate env at repo root

- Move all application env vars to repository-root .env (with .env.example
  as the committed template) and drop the per-app .env.example files.
- Add @code/env subpaths (agent, convex) and consume validated exports
  everywhere instead of reading process.env directly.
- Wire every dev/build/start script to load ../../.env via bun --env-file
  and point vite.config.ts envDir at the repo root.
This commit is contained in:
-Puter
2026-07-19 17:29:11 +05:30
parent 87ddc2b73a
commit 6de7c3065e
15 changed files with 100 additions and 40 deletions

View File

@@ -1,7 +0,0 @@
CONVEX_URL=https://example.convex.cloud
DAEMON_ID=local-macbook
DAEMON_NAME=Local MacBook
DAEMON_VERSION=0.0.0
DAEMON_HEARTBEAT_MS=15000
DAEMON_COMMAND_LEASE_MS=60000
# RIVET_ENDPOINT=http://localhost:6420

View File

@@ -5,9 +5,9 @@
"type": "module",
"module": "src/index.ts",
"scripts": {
"dev": "bun run --watch src/index.ts",
"build": "bun build src/index.ts --compile --outfile dist/code-daemon",
"start": "./dist/code-daemon",
"dev": "bun --env-file=../../.env run --watch src/index.ts",
"build": "bun --env-file=../../.env build src/index.ts --compile --outfile dist/code-daemon",
"start": "bun --env-file=../../.env ./dist/code-daemon",
"check-types": "tsc --noEmit"
},
"dependencies": {

View File

@@ -4,12 +4,12 @@
"private": true,
"main": "expo-router/entry",
"scripts": {
"start": "expo start",
"dev": "expo start --clear",
"android": "expo run:android",
"ios": "expo run:ios",
"prebuild": "expo prebuild",
"web": "expo start --web"
"start": "bun --env-file=../../.env expo start",
"dev": "bun --env-file=../../.env expo start --clear",
"android": "bun --env-file=../../.env expo run:android",
"ios": "bun --env-file=../../.env expo run:ios",
"prebuild": "bun --env-file=../../.env expo prebuild",
"web": "bun --env-file=../../.env expo start --web"
},
"dependencies": {
"@better-auth/expo": "catalog:",
@@ -22,7 +22,6 @@
"@tanstack/react-form": "catalog:",
"better-auth": "catalog:",
"convex": "catalog:",
"dotenv": "catalog:",
"expo": "~57.0.1",
"expo-constants": "~57.0.2",
"expo-font": "~57.0.0",

View File

@@ -19,7 +19,6 @@
"@tanstack/react-form": "catalog:",
"better-auth": "catalog:",
"convex": "catalog:",
"dotenv": "catalog:",
"isbot": "^5.1.44",
"lucide-react": "catalog:",
"next-themes": "catalog:",

View File

@@ -1,8 +1,11 @@
import path from "node:path";
import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite-plus";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
envDir: path.resolve(import.meta.dirname, "../.."),
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
});