File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ node_modules/
33** /node_modules /
44
55# Environment variables
6+ ** /.env
7+ ** /.env. *
8+ ! ** /.env * .example
69
710# Build outputs
811dist /
@@ -27,3 +30,4 @@ coverage/
2730# Misc
2831
2932# ETC
33+ local
Original file line number Diff line number Diff line change 1+ INSTALL_MODE=normal
2+ # INSTALL_MODE=bypass
Original file line number Diff line number Diff line change 44 "version" : " 0.0.0" ,
55 "main" : " dist/index.js" ,
66 "scripts" : {
7- "dev" : " tsx watch src/index.ts" ,
7+ "dev" : " NODE_ENV=development pnpm exec tsx watch src/index.ts" ,
8+ "dev:bypass" : " NODE_ENV=development INSTALL_MODE=bypass pnpm exec tsx watch src/index.ts" ,
89 "build" : " tsc" ,
910 "start" : " node dist/index.js" ,
1011 "test" : " vitest run" ,
1112 "typecheck" : " tsc --noEmit"
1213 },
1314 "devDependencies" : {
15+ "tsx" : " ^4.21.0" ,
1416 "vitest" : " ^2.1.9"
17+ },
18+ "dependencies" : {
19+ "dotenv" : " ^17.3.1"
1520 }
1621}
Original file line number Diff line number Diff line change 1+ import "dotenv/config" ;
2+
3+ type InstallMode = "normal" | "bypass" ;
4+
15const BOOTSTRAP_MESSAGE = "Fieldstack API bootstrap initialized" ;
26
7+ function resolveInstallMode ( env : NodeJS . ProcessEnv ) : InstallMode {
8+ const requestedMode = env . INSTALL_MODE ;
9+ const isDevelopment = env . NODE_ENV === "development" ;
10+
11+ if ( requestedMode === "bypass" ) {
12+ if ( isDevelopment ) {
13+ return "bypass" ;
14+ }
15+
16+ console . warn ( "[fieldstack][api] INSTALL_MODE=bypass ignored outside development" ) ;
17+ }
18+
19+ return "normal" ;
20+ }
21+
22+ const installMode = resolveInstallMode ( process . env ) ;
23+
324console . log ( BOOTSTRAP_MESSAGE ) ;
25+ console . log ( `[fieldstack][api] install mode: ${ installMode } ` ) ;
26+
27+ if ( installMode === "bypass" ) {
28+ console . warn ( "[fieldstack][api] DEV INSTALL BYPASS ACTIVE" ) ;
29+ }
Original file line number Diff line number Diff line change 1+ VITE_INSTALL_MODE=normal
2+ # VITE_INSTALL_MODE=bypass
Original file line number Diff line number Diff line change 44 "version" : " 0.0.0" ,
55 "scripts" : {
66 "dev" : " vite" ,
7+ "dev:bypass" : " VITE_INSTALL_MODE=bypass vite" ,
78 "build" : " tsc && vite build" ,
89 "preview" : " vite preview" ,
910 "test" : " vitest run --passWithNoTests" ,
Original file line number Diff line number Diff line change 1+ type InstallMode = "normal" | "bypass" ;
2+
3+ interface WebRuntimeEnv {
4+ MODE ?: string ;
5+ DEV ?: boolean ;
6+ VITE_INSTALL_MODE ?: string ;
7+ }
8+
19const WEB_BOOTSTRAP_MESSAGE = "Fieldstack Web bootstrap initialized" ;
210
11+ function resolveInstallMode ( runtimeEnv : WebRuntimeEnv ) : InstallMode {
12+ const requestedMode = runtimeEnv . VITE_INSTALL_MODE ;
13+ const isDevelopment = runtimeEnv . DEV === true || runtimeEnv . MODE === "development" ;
14+
15+ if ( requestedMode === "bypass" ) {
16+ if ( isDevelopment ) {
17+ return "bypass" ;
18+ }
19+
20+ console . warn ( "[fieldstack][web] VITE_INSTALL_MODE=bypass ignored outside development" ) ;
21+ }
22+
23+ return "normal" ;
24+ }
25+
26+ const runtimeEnv = ( import . meta as ImportMeta & { env ?: WebRuntimeEnv } ) . env ?? { } ;
27+ const installMode = resolveInstallMode ( runtimeEnv ) ;
28+
329console . log ( WEB_BOOTSTRAP_MESSAGE ) ;
30+ console . log ( `[fieldstack][web] install mode: ${ installMode } ` ) ;
31+
32+ if ( installMode === "bypass" ) {
33+ console . warn ( "[fieldstack][web] DEV INSTALL BYPASS ACTIVE" ) ;
34+ }
Original file line number Diff line number Diff line change 1010 },
1111 "scripts" : {
1212 "dev" : " pnpm --parallel dev" ,
13+ "dev:bypass" : " INSTALL_MODE=bypass pnpm --parallel dev" ,
1314 "dev:api" : " pnpm --filter api dev" ,
15+ "dev:api:bypass" : " pnpm --filter api dev:bypass" ,
1416 "dev:web" : " pnpm --filter web dev" ,
17+ "dev:web:bypass" : " pnpm --filter web dev:bypass" ,
1518 "build" : " pnpm build:web && pnpm build:api && pnpm postbuild" ,
1619 "build:web" : " pnpm --filter web build" ,
1720 "build:api" : " pnpm --filter api build" ,
You can’t perform that action at this time.
0 commit comments