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

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


The following commit(s) were added to refs/heads/main by this push:
     new 11ebdb9  cleanup lib code
11ebdb9 is described below

commit 11ebdb9cd44fe7f3514302eaa35b37fbc741583b
Author: Michele Sciabarra <[email protected]>
AuthorDate: Sat Jul 19 20:19:59 2025 +0200

    cleanup lib code
---
 ide/nodejs/opsfile.yml | 31 +++++++++++--------------------
 ide/python/opsfile.yml | 34 ++++++++++------------------------
 ide/util/opsfile.yml   |  8 ++++----
 3 files changed, 25 insertions(+), 48 deletions(-)

diff --git a/ide/nodejs/opsfile.yml b/ide/nodejs/opsfile.yml
index 02106fd..87e0ef0 100644
--- a/ide/nodejs/opsfile.yml
+++ b/ide/nodejs/opsfile.yml
@@ -43,27 +43,18 @@ tasks:
     - "{{.DIR}}/node_modules/.package-lock.json"
   
   action:
-    silent: false
-    desc: build the action updating the zip
-    requires: {var: [DIR]}
+    silent: true
+    desc: build action
+    requires: {vars: [DIR]}
+    dir: "{{.DIR}}"
     cmds:
-      - test -d "{{.DIR}}" || die "{{.DIR}} not found or not a directory"
+      - test -d "{{.DIR}}" || die "dir '{{.DIR}}' not found or not a directory"
+      - zip  -q -x "node_modules" -x Dockerfile  -r "{{.DIR}}.zip" .
       - |
-        ZIP_PATH="{{.DIR}}.zip"
-        DIR_ABS=$(realpath "{{.DIR}}")
-        ROOT_DIR=$(dirname "$(dirname "$DIR_ABS")")
-        LIB_DIR=$(dirname "$ROOT_DIR")/lib/nodejs
-
-        cd "$DIR_ABS"
-        zip -r "$ZIP_PATH" . -x "node_modules/*" -x "$(basename "$ZIP_PATH")"
-
-        if [ -d "$LIB_DIR" ]; then
-          cd "$LIB_DIR"
-          zip -ur "$ZIP_PATH" .
-        else
-          echo "$LIB_DIR not found, skip add"
+        if test -d "$OPS_PWD/lib/nodejs"
+        then
+          cd "$OPS_PWD/lib/nodejs"
+          zip -q -u -r "{{.DIR}}.zip" . || true
         fi
 
-        if [ ! -f "$ZIP_PATH" ]; then
-          die "$ZIP_PATH not created"
-        fi
+
diff --git a/ide/python/opsfile.yml b/ide/python/opsfile.yml
index 573fc56..3b1654e 100644
--- a/ide/python/opsfile.yml
+++ b/ide/python/opsfile.yml
@@ -43,32 +43,18 @@ tasks:
     - "{{.DIR}}/virtualenv/date"
 
   action:
-    silent: false
-    desc: compile
-    requires: {var: [DIR]}
+    silent: true
+    desc: build action
+    requires: {vars: [DIR]}
+    dir: "{{.DIR}}"
     cmds:
-      - test -d "{{.DIR}}" || die "{{.DIR}} not found or not a directory"
+      - test -d "{{.DIR}}" || die "dir '{{.DIR}}' not found or not a directory"
+      - zip  -q -x "virtualenv" -x "requirements.txt" -x Dockerfile -r 
"{{.DIR}}.zip" .
       - |
-        ZIP_PATH="{{.DIR}}.zip"
-        DIR_ABS=$(realpath "{{.DIR}}")
-        ROOT_DIR=$(dirname "$(dirname "$DIR_ABS")")
-        LIB_DIR=$(dirname "$ROOT_DIR")/lib/python
-
-        echo "DIR_ABS=$DIR_ABS"
-        echo "LIB_DIR=$LIB_DIR"
-
-        cd "$DIR_ABS"
-        zip -r "$ZIP_PATH" . -x "virtualenv/*" -x "requirements.txt" -x 
"$(basename "$ZIP_PATH")"
-
-        if [ -d "$LIB_DIR" ]; then
-          cd "$LIB_DIR"
-          zip -ur "$ZIP_PATH" .
-        else
-          echo "$LIB_DIR not found, skip add"
-        fi
-
-        if [ ! -f "$ZIP_PATH" ]; then
-          die "$ZIP_PATH non created"
+        if test -d "$OPS_PWD/lib/python"
+        then 
+          cd "$OPS_PWD/lib/python"
+          zip -q -u -r "{{.DIR}}.zip" . || true
         fi
 
   cli:
diff --git a/ide/util/opsfile.yml b/ide/util/opsfile.yml
index 0d30e1b..4cc3fff 100644
--- a/ide/util/opsfile.yml
+++ b/ide/util/opsfile.yml
@@ -27,9 +27,9 @@ tasks:
     - |
       cd $OPS_PWD
       if test -e "packages/{{.A}}/requirements.txt"
-      then $OPS ide python zip DIR="$($OPS -opspath "packages/{{.A}}")"
+      then $OPS ide python zip DIR="$(opspath "packages/{{.A}}")"
       elif test -e "packages/{{.A}}/package.json"
-      then $OPS ide nodejs zip DIR="$($OPS -opspath "packages/{{.A}}")"
+      then $OPS ide nodejs zip DIR="$(opspath "packages/{{.A}}")"
       else echo "no zip environment"
       fi
 
@@ -41,9 +41,9 @@ tasks:
     - |
       cd $OPS_PWD
       if test -e "packages/{{.A}}/__main__.py"
-      then $OPS ide python action DIR="$($OPS -opspath "packages/{{.A}}")"
+      then echo $OPS ide python action DIR="$(opspath "packages/{{.A}}")"
       elif test -e "packages/{{.A}}/index.js"
-      then $OPS ide nodejs action DIR="$($OPS -opspath "packages/{{.A}}")"
+      then echo $OPS ide nodejs action DIR="$(opspath "packages/{{.A}}")"
       else die "*** unknown action type"
       fi
 

Reply via email to