Commit 16f21ec 1 parent d462aa3 commit 16f21ec Copy full SHA for 16f21ec
File tree 3 files changed +12
-5
lines changed
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
- import { runDevelopment , runServer } from './server' ;
1
+ import { runServerCodegen , runServer } from './server' ;
2
2
3
- const { WATCH } = process . env ;
3
+ const { CODE_GEN = 'false' } = process . env ;
4
4
5
- if ( WATCH === 'true' ) {
6
- runDevelopment ( ) ;
5
+ if ( CODE_GEN === 'true' ) {
6
+ runServerCodegen ( ) ;
7
7
} else {
8
8
runServer ( ) ;
9
9
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import app from '../server';
7
7
import { requireEnv } from '../utils/requireEnv' ;
8
8
9
9
const { SERVER_PORT = 4444 } = requireEnv ( [ 'SERVER_PORT' ] ) ;
10
+ const { WATCH = 'false' } = process . env ;
10
11
11
12
const server = createServer ( app ) ;
12
13
@@ -30,7 +31,7 @@ export async function closeServer() {
30
31
} ) ;
31
32
}
32
33
33
- export async function runDevelopment ( ) {
34
+ export async function runServerCodegen ( ) {
34
35
const cwd = resolve ( __dirname , '../' ) ;
35
36
const gqlWatcher = chokidar . watch ( [ 'src/**/*.graphql' ] , {
36
37
cwd,
@@ -58,6 +59,11 @@ export async function runDevelopment() {
58
59
gqlWatcher . close ( ) ;
59
60
}
60
61
62
+ if ( WATCH !== 'true' ) {
63
+ exitHandler ( ) ;
64
+ return ;
65
+ }
66
+
61
67
process . on ( 'exit' , exitHandler ) ;
62
68
process . on ( 'SIGTERM' , exitHandler ) ;
63
69
process . on ( 'SIGINT' , exitHandler ) ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export default defineConfig((options) => ({
24
24
cleanup : true ,
25
25
env : {
26
26
SERVER_PORT : port ,
27
+ CODE_GEN : true ,
27
28
WATCH : Boolean ( options . watch ) ,
28
29
FUEL_PROVIDER : process . env . FUEL_PROVIDER ,
29
30
} ,
You can’t perform that action at this time.
0 commit comments