Skip to content

Commit ed238fa

Browse files
committed
refactor: more conventional env file namings
.local for files that is ignored
1 parent 4b94b84 commit ed238fa

11 files changed

Lines changed: 16 additions & 12 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ yarn-error.log*
3939
.pnpm-debug.log*
4040

4141
# local env files
42-
.env.*.ignored
42+
.env.local
43+
.env.*.local
4344

4445
# turbo
4546
.turbo

INIT_PROMPT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Welcome! Use this template to configure your new project based on the `starter-m
4343
3. **SST removal (optional):** If `REMOVE_SST` is true, SST files, scripts, dependencies, and references will be removed.
4444
<!-- + Context for Agent: when doing SST Removal, these are SST's files: (`sst.config.ts`, `.env.sst`), also remove the `pathe` and `@types/aws-lambda` dependency, they are only used by SST -->
4545
4. **Project context update & renaming:** The agent will update all related documents like `README.md` and Memory Bank with your (revised) goals and descriptions, as well as replace `starter-monorepo` with `MONOREPO_ROOT_NAME` throughout project/Memory Bank.
46-
5. **Initialize local secret env files:** Scan the project for `.env.local` files and duplicate them as `.env.local.ignored` for each that exists.
46+
5. **Initialize local secret env files:** Scan the project for `.env.dev` files and duplicate them as `.env.dev.local` for each that exists.
4747
3. **Finalizing steps**:
4848
<!-- + Context for Agent: ONLY START THIS STEP IF PRIOR STEPS IS DONE -->
4949
1. **INIT_PROMPT cleanup:** `INIT_PROMPT.md` and its related files (`INIT_PROMPT-EXAMPLES.md`) will be removed.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ To build all apps and packages, run the following command:
9999
To develop all apps and packages, run the following command:
100100
`pnpm run dev`
101101

102-
To define local development environment variables of each app, either use `git update-index --skip-worktree .env.local` and use it directly, or create a copy of or rename `.env.local` to `.env.local.ignored`.
103-
- AI Agent will help you creating the `.env.local.ignored` files if you use the AI initialization prompt.
102+
For local development environment variables / secrets, create a copy of `.env.dev` to `.env.dev.local`.
103+
- AI Agent will help you creating the `.env.dev.local` files if you use the AI initialization prompt.
104104

105105
### Deploy
106106

apps/backend-convex/.env.dev

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Deployment used by `npx convex dev`
2+
CONVEX_DEPLOYMENT=dev:dazzling-panther-382 # team: namesmt, project: starter-monorepo
3+
4+
CONVEX_URL=https://dazzling-panther-382.convex.cloud

apps/backend-convex/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/backend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"test:types": "tsc --noEmit --skipLibCheck",
1313
"quickcheck": "pnpm run lint && pnpm run test:types",
1414
"check": "pnpm lint && pnpm test:types && vitest run --coverage",
15-
"dev": "dotenvx run -f .env.local.ignored -f .env.local -f .env -- tsx watch src/dev.ts",
15+
"dev": "dotenvx run -f .env.dev.local -f .env.dev -f .env -- tsx watch src/dev.ts",
1616
"stub": "unbuild --stub",
17-
"build": "dotenvx run -f .env.prod.ignored -f .env.prod -f .env -- unbuild",
18-
"deploy": "dotenvx run -f .env.prod.ignored -f .env.prod -f .env -- sh scripts/deploy.sh"
17+
"build": "dotenvx run -f .env.prod.local -f .env.prod -f .env -- unbuild",
18+
"deploy": "dotenvx run -f .env.prod.local -f .env.prod -f .env -- sh scripts/deploy.sh"
1919
},
2020
"dependencies": {
2121
"srvx": "^0.8.0"

apps/frontend/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# You can refer to /turbo.json for the explanation of the variables
22

33
# For the frontend, please don't use the main `.env` file,
4-
# Instead, use `.env.local` and `.env.prod`, etc...
4+
# Instead, use `.env.dev` and `.env.prod`, etc...
55
# Reason: it's hard to do complex priority control when loading multiple envs file (We can't control the loading of `.env`) and a weird resolve bug with `runtimeConfig` upon `generate`.
66

77
# NUXT_PUBLIC_FRONTEND_URL=<YOUR_FRONTEND_URL>

apps/frontend/nuxt.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import { config } from 'dotenv'
55
import optimizeExclude from 'vite-plugin-optimize-exclude'
66

77
if (import.meta.env.NODE_ENV === 'development') {
8-
config({ path: ['.env.local.ignored', '.env.local'] })
8+
config({ path: ['.env.dev.local', '.env.dev'] })
99
import.meta.env.NUXT_PUBLIC_CONVEX_URL ||= (await getConvexEnvs()).CONVEX_URL || ''
1010
}
1111
else {
12-
config({ path: ['.env.prod.ignored', '.env.prod'] })
12+
config({ path: ['.env.prod.local', '.env.prod'] })
1313
}
1414

1515
const siteConfig = {

0 commit comments

Comments
 (0)