Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(root): Nv 3846 consolidate env file behavior #5662

Merged
merged 6 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fabric.properties
# Module directory
.terraform/

.env
**/.env
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the removal in other .gitignore files are related to consolidation done here on the top level

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 nice one!

docker/.env
.vercel
nx-cloud.env
Expand Down
3 changes: 0 additions & 3 deletions apps/api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions apps/worker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down
4 changes: 0 additions & 4 deletions libs/dal/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down Expand Up @@ -112,4 +109,3 @@ fabric.properties

# Editor-based Rest Client
.idea/httpRequests

4 changes: 0 additions & 4 deletions libs/shared/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down Expand Up @@ -112,4 +109,3 @@ fabric.properties

# Editor-based Rest Client
.idea/httpRequests

3 changes: 0 additions & 3 deletions packages/cli-next/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down
3 changes: 0 additions & 3 deletions packages/cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
### JetBrains template
Expand Down
3 changes: 0 additions & 3 deletions packages/echo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ node_modules
*.log*
logs

# Environment
*.env*

# Misc
.DS_Store
5 changes: 1 addition & 4 deletions packages/notification-center-vue/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Produced build files
dist
dist
13 changes: 5 additions & 8 deletions scripts/setup-env-files.js
Original file line number Diff line number Diff line change
@@ -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`);
Expand All @@ -15,14 +16,10 @@ const prePopulateEnv = (folders, folderBasePath, exampleEnvFilePath = 'src/.exam
};

(async () => {
const apps = ['api', 'ws', 'worker'];
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');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web and widget don't have their .env files in /src but in the parent directory, so this adjustment is needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😮‍💨

console.log('Finished populating .env files');
console.log('----------------------------------------');
})();
Loading