From a2ab3cb6419c4d830713e4ce28a30b85f5b5bd0e Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 7 Jan 2025 22:44:13 -0700 Subject: [PATCH] Remove package-lock.json and update Docker Compose commands for Redis integration - Deleted the `package-lock.json` file from the root directory. - Modified the `dev` target in the API Makefile to start Redis using Docker Compose from the parent directory, improving service orchestration. - Updated the `next.config.mjs` to load environment variables from the parent directory during development. - Added `dotenv` as a dependency in both `package.json` and `package-lock.json` to manage environment variables effectively. These changes streamline the development setup and enhance the management of environment variables. --- api/makefile | 2 +- package-lock.json | 6 ------ web/next.config.mjs | 5 +++++ web/package-lock.json | 15 ++++++++++++++- web/package.json | 1 + 5 files changed, 21 insertions(+), 8 deletions(-) delete mode 100644 package-lock.json diff --git a/api/makefile b/api/makefile index e8c453506..716de0608 100644 --- a/api/makefile +++ b/api/makefile @@ -1,5 +1,5 @@ dev: - docker compose up -d + cd .. && docker compose up -d redis && cd api && \ supabase start ollama serve & ollama pull mxbai-embed-large diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 46a528a6f..000000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "buster", - "lockfileVersion": 3, - "requires": true, - "packages": {} -} diff --git a/web/next.config.mjs b/web/next.config.mjs index adcb5474a..db747b773 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -7,6 +7,11 @@ import { dirname } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); +// Load env vars from parent directory in development +const envConfig = process.env.NODE_ENV === 'development' + ? dotenv.config({ path: '../.env' }).parsed + : {}; + const nextConfig = { reactStrictMode: false, sassOptions: { diff --git a/web/package-lock.json b/web/package-lock.json index 5658f8022..75c04891b 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -44,6 +44,7 @@ "cookies-next": "^4.2.1", "dayjs": "^1.11.13", "dom-to-image": "^2.6.0", + "dotenv": "^16.4.7", "echarts": "^5.6.0", "echarts-for-react": "^3.0.2", "echarts-simple-transform": "^1.0.0", @@ -119,7 +120,7 @@ "typescript": "^5" }, "engines": { - "node": ">=22.0.0" + "node": ">=20.0.0" } }, "node_modules/@alloc/quick-lru": { @@ -7343,6 +7344,18 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dt-sql-parser": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/dt-sql-parser/-/dt-sql-parser-4.0.2.tgz", diff --git a/web/package.json b/web/package.json index e944198ae..8ebe9b586 100644 --- a/web/package.json +++ b/web/package.json @@ -49,6 +49,7 @@ "cookies-next": "^4.2.1", "dayjs": "^1.11.13", "dom-to-image": "^2.6.0", + "dotenv": "^16.4.7", "echarts": "^5.6.0", "echarts-for-react": "^3.0.2", "echarts-simple-transform": "^1.0.0",