@@ -416,7 +416,6 @@ info "arg_n: ${arg_n}"
416
416
# woo.sh
417
417
echo " Now ready for GrahpQL server generation!"
418
418
419
- input_dir=${arg_i}
420
419
config_file=" $( cd " $( dirname " ${arg_c} " ) " && pwd) /$( basename " ${arg_c} " ) "
421
420
422
421
# Check if driver exists
@@ -434,7 +433,7 @@ output_dir=$(cd ${arg_o}; pwd)
434
433
if [[ -n " ${arg_s} " ]]; then
435
434
custom_schema=${arg_s}
436
435
else
437
- custom_schema=${__dir} /graphql-server/empty_custom_schema .graphql
436
+ custom_schema=${__dir} /graphql-server/empty_custom_api_schema .graphql
438
437
fi
439
438
440
439
# custom API resolvers
@@ -444,9 +443,34 @@ else
444
443
custom_resolvers=${__dir} /graphql-server/empty_custom_resolvers.js
445
444
fi
446
445
447
- echo ${input_dir }
446
+ echo ${arg_i }
448
447
echo ${config_file}
449
448
echo ${driver_dir}
450
449
echo ${output_dir}
451
450
echo ${custom_schema}
452
- echo ${custom_resolvers}
451
+ echo ${custom_resolvers}
452
+
453
+ # copy server files
454
+ cp ./graphql-server/server.js ${output_dir}
455
+ cp ${driver_dir} /* ${output_dir}
456
+ (cd ${output_dir} ; npm install)
457
+ # Hack: Modify executeFieldsSerially(...) in /node_modules/graphql/execution/execute.js
458
+ # The mod is required to support nested transactions.
459
+ cp ./graphql-server/graphql/execution/execution.js ${output_dir} /node_modules/graphql/execution/execute.js
460
+ cp ${custom_schema} ${output_dir} /api-schema/custom-api-schema.graphql
461
+ cp ${custom_resolvers} ${output_dir} /custom-resolvers.js
462
+
463
+ # generate GraphQL API schema (for now, assume that arg_i is a relative path/file)
464
+ cd ./graphql-api-generator
465
+ python3 generator.py \
466
+ --input ../${arg_i} \
467
+ --output ${output_dir} /api-schema/api-schema.graphql \
468
+ --config ${config_file}
469
+ cd ..
470
+
471
+ # generate resolvers
472
+ cd ./graphql-resolver-generator
473
+ python3 generator.py \
474
+ --input ${output_dir} /api-schema/api-schema.graphql \
475
+ --output ${output_dir}
476
+ cd ..
0 commit comments