@@ -74,7 +74,17 @@ tasks:
74
74
desc : local web server
75
75
ignore_error : true
76
76
cmds :
77
- - bash http-serve.sh "$NUV_PWD/web"
77
+ - >
78
+ http-server
79
+ -a 127.0.0.1 "$NUV_PWD/web"
80
+ -c-1 --mimetypes mime.types
81
+ -P $NUVDEV_HOST
82
+
83
+ poll :
84
+ silent : true
85
+ desc : poll activation logs
86
+ cmds :
87
+ - nuv activation poll
78
88
79
89
_info :
80
90
silent : true
@@ -83,34 +93,62 @@ tasks:
83
93
- config -d | grep OPENAI_
84
94
- config -d | grep NUVDEV_
85
95
86
- _venv :
87
- cmds :
88
- - python3 -V || die "I need python3 in the path"
89
- - python3 -m venv venv
90
- - |
91
- source venv/bin/activate
92
- pip install watchdog
93
- status :
94
- - test -d venv
95
-
96
- deploy :
96
+ prereq :
97
97
silent : true
98
- desc : deploy a project or a single action (with _action_=<dir-or-file>)
99
98
cmds :
100
- - test -e "/.nuvolaris" || test -n "$NUVDEV_FORCE" || die "nuv ide commands must be run in the ghrc.io/nuvolaris/devcontainer with VSCode"
99
+ - test "$(python3 -V | awk -F. '{print $2}')" -ge 10 || die "python 3.10 or greater not available"
100
+ - test "$(node -v | awk -F. '{print substr($1,2) }')" -ge 18 || die "nodejs 18 or greater not available"
101
101
- test -d "$NUV_PWD/packages" || die "no packages in current directory"
102
102
- test -e ~/.wskprops || die "please run 'nuv ide login' first"
103
103
- test -n "$NUVDEV_HOST" || die "please run 'nuv ide login' first"
104
- - |
105
- if test -e ~/.nuv/tmp/deploy.pid
106
- then kill "$(cat ~/.nuv/tmp/deploy.pid)" 2>/dev/null || true
107
- fi
108
104
- |
109
105
if test -e "$NUV_PWD/package.json"
110
106
then if ! test -d "$NUV_PWD/node_modules"
111
107
then cd $NUV_PWD ; npm install
112
108
fi
113
- fi
109
+ fi
110
+ - |
111
+ if ! python3 -m pip list | grep watchfiles >/dev/null 2>/dev/null
112
+ then python3 -m pip install --user watchfiles asyncio
113
+ fi
114
+ - |
115
+ if ! which http-server >/dev/null 2>/dev/null
116
+ then npm install -g http-server
117
+ fi
118
+ - task : kill
119
+
120
+ kill :
121
+ silent : false
122
+ ignore : true
123
+ cmds :
124
+ - |
125
+ if test -e ~/.nuv/tmp/deploy.pgrp
126
+ then
127
+ PGRP="$(cat ~/.nuv/tmp/deploy.pgrp)"
128
+ #pstree $PID
129
+ LOOP=true
130
+ while $LOOP
131
+ do
132
+ LOOP=false
133
+ ps -a -o pgid,pid | while read GRP PID
134
+ do
135
+ echo $GRP $PID
136
+ if test "$GRP" = "$PGRP"
137
+ then kill -9 "$PID"
138
+ LOOP=true
139
+ fi
140
+ done
141
+ sleep 2
142
+ done
143
+ rm ~/.nuv/tmp/deploy.pgrp
144
+ fi
145
+
146
+ deploy :
147
+ silent : true
148
+ interactive : true
149
+ desc : deploy a project or a single action (with _action_=<dir-or-file>)
150
+ cmds :
151
+ - task : prereq
114
152
- |
115
153
set -a
116
154
if test -e $NUV_PWD/.env
@@ -132,25 +170,12 @@ tasks:
132
170
python3 -m deploy "$NUV_PWD" -s "{{._action_}}" $DRY
133
171
fi
134
172
135
-
136
173
devel :
137
- silent : true
174
+ interactive : true
175
+ silent : false
138
176
desc : start interactive development mode files
139
177
cmds :
140
- - test -e "/.nuvolaris" || test -n "$NUVDEV_FORCE" || die "nuv ide commands must be run in the ghrc.io/nuvolaris/devcontainer with VSCode"
141
- - test -d "$NUV_PWD/packages" || die "no packages in current directory"
142
- - test -e ~/.wskprops || die "please run 'nuv ide login' first"
143
- - test -n "$NUVDEV_HOST" || die "please run 'nuv ide login' first"
144
- - |
145
- if test -e ~/.nuv/tmp/deploy.pid
146
- then kill "$(cat ~/.nuv/tmp/deploy.pid)" 2>/dev/null|| true
147
- fi
148
- - |
149
- if test -e "$NUV_PWD/package.json"
150
- then if ! test -d "$NUV_PWD/node_modules"
151
- then cd $NUV_PWD ; npm install
152
- fi
153
- fi
178
+ - task : prereq
154
179
- |
155
180
set -a
156
181
if test -e $NUV_PWD/.env
@@ -163,10 +188,8 @@ tasks:
163
188
then DRY="--dry-run" ; ECHO='echo'
164
189
else DRY="" ; ECHO=""
165
190
fi
166
- if ! pip list | grep watchfiles >/dev/null
167
- then pip install watchfiles asyncio
168
- fi
169
191
python3 -m deploy "$NUV_PWD" -w $DRY
192
+ #npm-run-all --parallel deploy serve
170
193
true
171
194
172
195
undeploy :
0 commit comments