File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Local Environment Variables (Secrets)
2+ # Copy this file to .env and fill in your actual values
3+ # .env is gitignored and should NEVER be committed
4+
5+ # Discord Bot Token & Application ID (REQUIRED)
6+ # Get this from: https://discord.com/developers/applications
7+ DISCORD_TOKEN = your-bot-token-here
8+ CLIENT_ID = your-bot-application-id
9+
10+ # Override any public config values for local testing
11+
12+ # Discord Server ID (your dev server)
13+ SERVER_ID = your-server-id
14+
15+ # Channel IDs (from your dev server)
16+ GUIDES_CHANNEL_ID = your-guide-channel-id
17+ REPEL_LOG_CHANNEL_ID = your-repel-log-channel-id
18+
19+ # Role IDs (from your dev server)
20+ REPEL_ROLE_ID = your-repel-role-id
21+ MODERATORS_ROLE_IDS = your-moderator-role-id
22+
23+ # Other
24+ GUIDES_TRACKER_PATH = guides-tracker.json
Original file line number Diff line number Diff line change 3535 - name : Lint
3636 run : npm run lint
3737
38- - name : Build and test
39- run : npm run test:build
38+ - name : Build
39+ run : npm run build:ci
40+
41+ - name : Test
42+ run : npm run test:ci
4043
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ yarn-error.log*
1818# Public config (committed to repo)
1919! .env.production
2020! .env.example
21+ ! .env.test
2122
2223# tracker
2324guides-tracker.json
Original file line number Diff line number Diff line change 77 "build:ci" : " npm run build:ts && npm run build:copy" ,
88 "build:dev" : " pnpm run build:ts && pnpm run build:copy" ,
99 "build:ts" : " tsup" ,
10- "build:test" : " tsup --entry 'src/**/*.ts' --entry 'test/**/*.ts'" ,
1110 "build:copy" : " node scripts/copy-assets.js" ,
1211 "start" : " node dist/index.js" ,
1312 "dev" : " tsx watch src/index.ts" ,
2322 "check:fix" : " biome check --write ." ,
2423 "typecheck" : " tsc --noEmit" ,
2524 "test" : " tsx --test '**/*.test.ts'" ,
26- "test:ci" : " node --test $(find dist -name '*.test.js')" ,
27- "test:build" : " npm run build:test && npm run test:ci" ,
25+ "test:ci" : " NODE_ENV=test node --test dist/**/*.test.js" ,
2826 "prepare" : " husky" ,
2927 "pre-commit" : " lint-staged" ,
3028 "sync-guides" : " tsx scripts/sync-guides.js" ,
Original file line number Diff line number Diff line change @@ -36,13 +36,16 @@ function loadEnvFile(filePath: string) {
3636const nodeEnv = process . env . NODE_ENV || 'development' ;
3737console . log ( `🌍 Environment: ${ nodeEnv } ` ) ;
3838
39- // Load environment-specific config first (public values, production only)
40- if ( nodeEnv === 'production' ) {
41- const envFile = join ( process . cwd ( ) , '.env.production' ) ;
39+ const ENV_FILES = {
40+ test : join ( process . cwd ( ) , '.env.test' ) ,
41+ production : join ( process . cwd ( ) , '.env.production' ) ,
42+ development : join ( process . cwd ( ) , '.env' ) ,
43+ } ;
44+
45+ const envFile = ENV_FILES [ nodeEnv as keyof typeof ENV_FILES ] ;
46+ if ( envFile ) {
4247 loadEnvFile ( envFile ) ;
48+ } else {
49+ console . error ( `❌ Environment file ${ nodeEnv } not found` ) ;
50+ process . exit ( 1 ) ;
4351}
44-
45- // Load .env file with secrets and local config (overrides public config if any)
46- // Required for DISCORD_TOKEN and other secrets
47- const localEnvFile = join ( process . cwd ( ) , '.env' ) ;
48- loadEnvFile ( localEnvFile ) ;
File renamed without changes.
You can’t perform that action at this time.
0 commit comments