-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.nims
82 lines (71 loc) · 2.59 KB
/
task.nims
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import std/strformat , os, strutils, strformat
proc checkFileStuff(out_dir, input_file:string) =
let out_path = out_dir.split(r"/")[0..^2].join(r"/")
if not out_path.dirExists:
echo "out_dir at : " & "'" & out_path & "' " & "does not exist"
quit(1)
let out_file_name = out_dir.split(r"/")[^1]
if not(".js" in out_file_name):
echo "out_dir at : " & "'" & out_path & "' " & "does not end with .js"
quit(1)
if not(".nim" in input_file):
echo "input_file at : " & "'" & input_file & "' " & "does not end with .nim"
quit(1)
task dev, "Start server in dev mode":
exec "nim c -r -d:ic -d:ssl -d:last_open_chapter=0 app.nim"
task demo, "Run demo":
exec """nim c \
-r \
-d:demo \
--forceBuild:on \
--opt:speed \
--define:release \
--threads:on \
--mm:orc \
--deepcopy:on \
--define:lto \
--define:ssl \
--hints:off \
--outdir:"." \
app.nim
"""
task prod, "Start server in prod mode":
exec """nim c \
--forceBuild:on \
--opt:speed \
--define:release \
--threads:on \
--mm:orc \
--deepcopy:on \
--define:lto \
--define:ssl \
--hints:off \
--outdir:"." \
app.nim
"""
task prodr, "Start server in prod mode":
exec """nim c \
-r \
--forceBuild:on \
--opt:speed \
--define:release \
--threads:on \
--mm:orc \
--deepcopy:on \
--define:lto \
--define:ssl \
--hints:off \
--outdir:"." \
app.nim
"""
task mkfe, "builds chatgpt frontend":
proc buildExecCommand(input_file: string, out_dir: string): string =
checkFileStuff(out_dir, input_file)
return fmt"""nim js -b:js -d:ic -o:{out_dir} {input_file}"""
exec buildExecCommand("./cgpt_page_fe.nim" , fmt"./static/js/cgpt_page_fe.js" )
exec buildExecCommand("./nav_fe.nim" , fmt"./static/js/nav_fe.js" )
#exec buildExecCommand("./landing_page_fe.nim" , fmt"./static/js/landing_page_fe.js" )
#exec buildExecCommand("./contribute_page_fe.nim" , fmt"./static/js/contribute_page_fe.js" )
task build_tw, "Builds Thirdweb":
withDir "/root/wef/static/js/thirdweb":
exec "npm run build"