From 932c862486f7cd2a2088048d4cc3b0bd857c5bc2 Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 09:59:19 +0200 Subject: [PATCH 1/6] refactor: consolidate .env use Add env example files to web and widget --- apps/web/.env.example | 18 ++++++++++++++++++ apps/widget/.env.example | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 apps/web/.env.example create mode 100644 apps/widget/.env.example diff --git a/apps/web/.env.example b/apps/web/.env.example new file mode 100644 index 00000000000..43302930232 --- /dev/null +++ b/apps/web/.env.example @@ -0,0 +1,18 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_ENVIRONMENT=dev +REACT_APP_VERSION=$npm_package_version +REACT_APP_API_URL= +REACT_APP_WS_URL= +REACT_APP_WEBHOOK_URL= +REACT_APP_NOVU_APP_ID= +REACT_APP_WIDGET_EMBED_PATH= +REACT_APP_DOCKER_HOSTED_ENV= +REACT_APP_INTERCOM_APP_ID= +REACT_APP_SEGMENT_KEY= +REACT_APP_SENTRY_DSN= +REACT_APP_BLUEPRINTS_API_URL= +REACT_APP_MAIL_SERVER_DOMAIN= +REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID= +IS_TEMPLATE_STORE_ENABLED= +IS_MULTI_PROVIDER_CONFIGURATION_ENABLED= +REACT_APP_NOVU_GTM_ID= diff --git a/apps/widget/.env.example b/apps/widget/.env.example new file mode 100644 index 00000000000..978677690ac --- /dev/null +++ b/apps/widget/.env.example @@ -0,0 +1,8 @@ +SKIP_PREFLIGHT_CHECK=true +REACT_APP_API_URL=http://127.0.0.1:3000 +REACT_APP_WS_URL=http://127.0.0.1:3002 +GLOBAL_CONTEXT_PATH= +WIDGET_CONTEXT_PATH= + +REACT_APP_ENVIRONMENT=dev +BROWSER=none From e43f1d1bf335144d2594a470739b231dbee75ebd Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 10:00:46 +0200 Subject: [PATCH 2/6] refactor: consolidate .env use Add web and widget to list of projects requiring .env file setup in setup script --- scripts/setup-env-files.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup-env-files.js b/scripts/setup-env-files.js index c33791e889e..f1c1a858391 100644 --- a/scripts/setup-env-files.js +++ b/scripts/setup-env-files.js @@ -15,7 +15,7 @@ const prePopulateEnv = (folders, folderBasePath, exampleEnvFilePath = 'src/.exam }; (async () => { - const apps = ['api', 'ws', 'worker']; + const apps = ['api', 'ws', 'worker', 'web', 'widget']; const appsBasePath = `${__dirname}/../apps`; console.log('----------------------------------------'); From a0d5ac73c13cbac8b4c3d7615f66c6a73bc1047d Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 10:02:58 +0200 Subject: [PATCH 3/6] refactor: consolidate .env use Rename files to align with expectations --- apps/web/{.env.example => .example.env} | 0 apps/widget/{.env.example => .example.env} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename apps/web/{.env.example => .example.env} (100%) rename apps/widget/{.env.example => .example.env} (100%) diff --git a/apps/web/.env.example b/apps/web/.example.env similarity index 100% rename from apps/web/.env.example rename to apps/web/.example.env diff --git a/apps/widget/.env.example b/apps/widget/.example.env similarity index 100% rename from apps/widget/.env.example rename to apps/widget/.example.env From 025ff86a73533d4350701b404109fa16d3272f8f Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 10:09:35 +0200 Subject: [PATCH 4/6] refactor: consolidate .env use Fix bug in script assuming same .env paths for new apps --- scripts/setup-env-files.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/setup-env-files.js b/scripts/setup-env-files.js index f1c1a858391..7acbe4d8731 100644 --- a/scripts/setup-env-files.js +++ b/scripts/setup-env-files.js @@ -1,8 +1,9 @@ const fs = require('fs'); const path = require('path'); -const prePopulateEnv = (folders, folderBasePath, exampleEnvFilePath = 'src/.example.env', envFilePath = 'src/.env') => { - for (const folder of folders) { +const prePopulateEnv = (apps, folderBasePath, exampleEnvFilePath = 'src/.example.env', envFilePath = 'src/.env') => { + console.log(`Pre-populating .env files from .example.env for [${apps.join(',')}]`); + for (const folder of apps) { const exists = fs.existsSync(path.resolve(`${folderBasePath}/${folder}/${envFilePath}`)); if (!exists) { console.log(`Populating ${folderBasePath}/${folder} with .env file`); @@ -15,14 +16,10 @@ const prePopulateEnv = (folders, folderBasePath, exampleEnvFilePath = 'src/.exam }; (async () => { - const apps = ['api', 'ws', 'worker', 'web', 'widget']; const appsBasePath = `${__dirname}/../apps`; - console.log('----------------------------------------'); - console.log('Pre-populating .env files from .example.env'); - - prePopulateEnv(apps, appsBasePath); - + prePopulateEnv(['api', 'ws', 'worker'], appsBasePath); + prePopulateEnv(['web', 'widget'], appsBasePath, '.example.env', '.env'); console.log('Finished populating .env files'); console.log('----------------------------------------'); })(); From 8185a67764d4cfd167d182956018ef0d223f5ee6 Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 10:11:59 +0200 Subject: [PATCH 5/6] refactor: consolidate .env use Remove .env from repo for web and widget --- apps/web/.env | 18 ------------------ apps/widget/.env | 8 -------- 2 files changed, 26 deletions(-) delete mode 100644 apps/web/.env delete mode 100644 apps/widget/.env diff --git a/apps/web/.env b/apps/web/.env deleted file mode 100644 index 43302930232..00000000000 --- a/apps/web/.env +++ /dev/null @@ -1,18 +0,0 @@ -SKIP_PREFLIGHT_CHECK=true -REACT_APP_ENVIRONMENT=dev -REACT_APP_VERSION=$npm_package_version -REACT_APP_API_URL= -REACT_APP_WS_URL= -REACT_APP_WEBHOOK_URL= -REACT_APP_NOVU_APP_ID= -REACT_APP_WIDGET_EMBED_PATH= -REACT_APP_DOCKER_HOSTED_ENV= -REACT_APP_INTERCOM_APP_ID= -REACT_APP_SEGMENT_KEY= -REACT_APP_SENTRY_DSN= -REACT_APP_BLUEPRINTS_API_URL= -REACT_APP_MAIL_SERVER_DOMAIN= -REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID= -IS_TEMPLATE_STORE_ENABLED= -IS_MULTI_PROVIDER_CONFIGURATION_ENABLED= -REACT_APP_NOVU_GTM_ID= diff --git a/apps/widget/.env b/apps/widget/.env deleted file mode 100644 index 978677690ac..00000000000 --- a/apps/widget/.env +++ /dev/null @@ -1,8 +0,0 @@ -SKIP_PREFLIGHT_CHECK=true -REACT_APP_API_URL=http://127.0.0.1:3000 -REACT_APP_WS_URL=http://127.0.0.1:3002 -GLOBAL_CONTEXT_PATH= -WIDGET_CONTEXT_PATH= - -REACT_APP_ENVIRONMENT=dev -BROWSER=none From a6827f066f6d1ac3b8ad40b64fef25d355b9998e Mon Sep 17 00:00:00 2001 From: Denis Kralj Date: Sun, 2 Jun 2024 10:17:07 +0200 Subject: [PATCH 6/6] refactor: consolidate .env use Consolidate .gitignore config --- .gitignore | 2 +- apps/api/.gitignore | 3 --- apps/worker/.gitignore | 3 --- libs/dal/.gitignore | 4 ---- libs/shared/.gitignore | 4 ---- packages/cli-next/.gitignore | 3 --- packages/cli/.gitignore | 3 --- packages/echo/.gitignore | 3 --- packages/notification-center-vue/.gitignore | 5 +---- 9 files changed, 2 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index dcac0b322f0..b2cd8ee0190 100644 --- a/.gitignore +++ b/.gitignore @@ -97,7 +97,7 @@ fabric.properties # Module directory .terraform/ -.env +**/.env docker/.env .vercel nx-cloud.env diff --git a/apps/api/.gitignore b/apps/api/.gitignore index 246e01248c6..1320bf3a507 100644 --- a/apps/api/.gitignore +++ b/apps/api/.gitignore @@ -58,9 +58,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template diff --git a/apps/worker/.gitignore b/apps/worker/.gitignore index 5413794eb2f..0fed9f967c8 100644 --- a/apps/worker/.gitignore +++ b/apps/worker/.gitignore @@ -59,9 +59,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template diff --git a/libs/dal/.gitignore b/libs/dal/.gitignore index 3c08c98c443..775569ce170 100644 --- a/libs/dal/.gitignore +++ b/libs/dal/.gitignore @@ -56,9 +56,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template @@ -112,4 +109,3 @@ fabric.properties # Editor-based Rest Client .idea/httpRequests - diff --git a/libs/shared/.gitignore b/libs/shared/.gitignore index 3c08c98c443..775569ce170 100644 --- a/libs/shared/.gitignore +++ b/libs/shared/.gitignore @@ -56,9 +56,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template @@ -112,4 +109,3 @@ fabric.properties # Editor-based Rest Client .idea/httpRequests - diff --git a/packages/cli-next/.gitignore b/packages/cli-next/.gitignore index 78bd28b805f..5388abc87db 100644 --- a/packages/cli-next/.gitignore +++ b/packages/cli-next/.gitignore @@ -57,9 +57,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template diff --git a/packages/cli/.gitignore b/packages/cli/.gitignore index 78bd28b805f..5388abc87db 100644 --- a/packages/cli/.gitignore +++ b/packages/cli/.gitignore @@ -57,9 +57,6 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next ### JetBrains template diff --git a/packages/echo/.gitignore b/packages/echo/.gitignore index f0eef6453d7..d0a9ec4bf44 100644 --- a/packages/echo/.gitignore +++ b/packages/echo/.gitignore @@ -8,8 +8,5 @@ node_modules *.log* logs -# Environment -*.env* - # Misc .DS_Store diff --git a/packages/notification-center-vue/.gitignore b/packages/notification-center-vue/.gitignore index 63f94bf6890..02637bde856 100644 --- a/packages/notification-center-vue/.gitignore +++ b/packages/notification-center-vue/.gitignore @@ -54,11 +54,8 @@ typings/ # Yarn Integrity file .yarn-integrity -# dotenv environment variables file -.env - # next.js build output .next # Produced build files -dist \ No newline at end of file +dist