File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change 22
22
import os .path
23
23
import signal
24
24
25
+
25
26
from .deploy import deploy
26
27
from .client import serve , logs
27
28
28
29
def check_and_deploy (change ):
29
- cur_dir_len = len (os .getcwd ())+ 1
30
30
change_type , path = change
31
+ path = os .path .abspath (path )
32
+ cur_dir_len = len (os .getcwd ())+ 1
31
33
src = path [cur_dir_len :]
32
- print (f"{ change_type } : { src } " )
33
34
# only modified
34
35
if change_type != watchfiles .Change .modified : return
35
36
# no directories
@@ -45,22 +46,21 @@ def check_and_deploy(change):
45
46
deploy (src )
46
47
47
48
async def redeploy ():
48
- print ("redeploy " )
49
+ print ("> Redeploy: " )
49
50
iterator = watchfiles .awatch ("packages" , recursive = True )
50
- try :
51
- async for changes in iterator :
52
- for change in changes :
51
+ async for changes in iterator :
52
+ for change in changes :
53
+ try :
54
+ #print(change)
53
55
check_and_deploy (change )
54
- except KeyboardInterrupt :
55
- print ("Keyboard Interrupt" )
56
- except :
57
- print ("Exception" )
56
+ except Exception as e :
57
+ print (e )
58
58
59
59
def watch ():
60
60
# start web server
61
- serve ()
61
+ # serve()
62
62
# show logs
63
- logs ()
63
+ # logs()
64
64
65
65
loop = asyncio .get_event_loop ()
66
66
task = loop .create_task (redeploy ())
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ tasks:
128
128
129
129
kill :
130
130
silent : true
131
- ignore : true
131
+ ignore_errors : true
132
132
cmds :
133
133
- |
134
134
if test -e ~/.nuv/tmp/deploy.pgrp
@@ -182,7 +182,7 @@ tasks:
182
182
183
183
devel :
184
184
interactive : true
185
- silent : false
185
+ silent : true
186
186
desc : start interactive development mode files
187
187
cmds :
188
188
- task : prereq
@@ -198,6 +198,9 @@ tasks:
198
198
then DRY="--dry-run" ; ECHO='echo'
199
199
else DRY="" ; ECHO=""
200
200
fi
201
+ if cat /proc/version | grep -i microsoft
202
+ then export WATCHFILES_FORCE_POLLING=1
203
+ fi
201
204
python3 -m deploy "$NUV_PWD" -w $DRY
202
205
#npm-run-all --parallel deploy serve
203
206
true
@@ -229,9 +232,10 @@ tasks:
229
232
done
230
233
231
234
clean :
235
+ silent : true
232
236
cmds :
233
237
- test -e "/.nuvolaris" || die "nuv ide commands must be run in the ghrc.io/nuvolaris/devcontainer with VSCode"
234
- - test -e ~/.wskprops || die "please 'nuv ide login' first"
238
+ - task : kill
235
239
- |
236
240
if test -d "$NUV_PWD/packages"
237
241
then
You can’t perform that action at this time.
0 commit comments