This is an automated email from the ASF dual-hosted git repository.

bsalzano pushed a commit to branch fix-deploy2
in repository https://gitbox.apache.org/repos/asf/openserverless-task.git

commit 89b52ff1e45553f4992971fcf92ede4584211aca
Author: Bruno Salzano <[email protected]>
AuthorDate: Sat Aug 9 23:55:48 2025 +0200

    chore: improved bun dependencies installation / update
    
    changed ops ide prereq to check for a lockfile with the hash of bun.lockb. 
Whenever dependencies are out of sync, a bun install will occur.
---
 .gitignore      |  3 ++-
 ide/opsfile.yml | 27 +++++++++++++++++++--------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index db0476d..462060d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,4 +27,5 @@ TODO.txt
 attic.txt
 **/venv/
 node_modules/
-.DS_Store
\ No newline at end of file
+.DS_Store
+ide/deploy/hash.lock
\ No newline at end of file
diff --git a/ide/opsfile.yml b/ide/opsfile.yml
index 6c12165..cfc417e 100644
--- a/ide/opsfile.yml
+++ b/ide/opsfile.yml
@@ -22,7 +22,21 @@ vars:
   API_HOST:
     sh: |
       echo "http://localhost:80";
+  
+  DEPLOY_CURRENT_HASH:
+    sh: |
+      if test -e "$OPS_ROOT/ide/deploy/bun.lockb"
+      then cd $OPS_ROOT/ide/deploy && bun $OPS_ROOT/ide/deploy/bun.lockb --hash
+      else echo "0"
+      fi
 
+  DEPLOY_PREVIOUS_HASH:
+    sh: |
+      if test -e "$OPS_ROOT/ide/deploy/hash.lock"
+      then cat $OPS_ROOT/ide/deploy/hash.lock
+      else echo "0"
+      fi
+      
 tasks:
 
   prereq:
@@ -37,21 +51,18 @@ tasks:
       - test -n "$OPSDEV_HOST" || die "please run 'ops ide login' first"
       - test "$(ops -wsk property get --namespace | awk '{ print $3 }')" = 
"$OPSDEV_USERNAME" || die "Repeat the login"
       - |
-        if ! test -d "$OPS_ROOT/ide/deploy/node_modules"
-          then cd $OPS_ROOT/ide/deploy && bun install
+        if ! test -d "$OPS_ROOT/ide/deploy/node_modules" || [ 
"{{.DEPLOY_CURRENT_HASH}}" != "{{.DEPLOY_PREVIOUS_HASH}}" ]
+          then 
+            cd $OPS_ROOT/ide/deploy && bun install && rm -f 
$OPS_ROOT/ide/deploy/hash.lock && bun $OPS_ROOT/ide/deploy/bun.lockb --hash > 
$OPS_ROOT/ide/deploy/hash.lock
         fi
       - |
         if test -e "$OPS_PWD/package.json"
         then if ! test -d "$OPS_PWD/node_modules"
              then cd $OPS_PWD ; bun install
              fi
-        fi
-      #- |
-      #  if ! which http-server >/dev/null 2>/dev/null
-      #  then npm install -g http-server
-      #  fi
+        fi      
       - task: kill
-
+  
   kill:
     silent: true
     ignore_errors: true

Reply via email to