From 67d132a9d3373ae2676fbb0db5e73d600a6a4497 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Wed, 1 Nov 2023 20:18:52 +0100
Subject: [PATCH] chore: documentation

---
 Taskfile.yml |  8 ++++++++
 devenv.nix   | 28 ++++++++++------------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/Taskfile.yml b/Taskfile.yml
index 1451d5746..f575e6815 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -25,6 +25,14 @@ tasks:
     cmds:
       - build-doc
       
+  publish-doc:
+    silent: true
+    desc: Publish the documentation to dist/doc
+    aliases:
+      - bpd
+    cmds:
+      - publish-doc
+      
   run-tests:
     silent: true
     desc: Run the tests
diff --git a/devenv.nix b/devenv.nix
index 2bb30bf96..8fbc0bea6 100644
--- a/devenv.nix
+++ b/devenv.nix
@@ -201,7 +201,7 @@ ${pkgs.gnused}/bin/sed -i -E "s_(\"[0-9]+\.[0-9]+\.[0-9]+\")_\"''${VERSION}\"_g"
     
   
 '';  
-  scripts.create-polifill.exec = ''
+  scripts.create-polyfill.exec = ''
 
 TMPFILE=${config.devenv.root}/.devenv/monster.js
 touch $TMPFILE
@@ -239,7 +239,7 @@ VERSION=$(cat "${config.devenv.root}/package.json" | jq -r '.version')
 
 update-versions
 build-monster-mjs
-create-polifill
+create-polyfill
 
 
 find ''${TEST_CASES_PATH} -type f | sed "s|^$TEST_CASES_PATH||" > ''${TEST_PATH}web/import.js
@@ -281,24 +281,11 @@ if [ "$profileExists" -eq "0" ]; then
   exit 1
 fi    
 
-if [ -d ${config.devenv.root}/dist/doc ]; then
-  rm -rf ${config.devenv.root}/dist/doc
-fi
-
-build-doc
-code=$?
-if [ "$code" -ne "0" ]; then
-    echo -e "''${RED}✖ Generate doc failed.''${RESET}"
-    exit 1  
-fi
-echo -e "''${GREEN}✔ Generate doc successful.''${RESET}"
-
 if [ ! -d ${config.devenv.root}/dist/doc ]; then
-  echo -e "''${RED}✖ No doc found.''${RESET}"
-  exit 1  
+    echo -e "''${RED}✖ No doc found.''${RESET}"
+    exit 1  
 fi
 
-
 ${pkgs.awscli2}/bin/aws --profile=shopcloud s3 --recursive --only-show-errors cp ${config.devenv.root}/dist/doc/ s3://monsterjs.org/en/api/
 code=$?
 
@@ -314,7 +301,12 @@ echo -e "''${GREEN}✔ Upload successful.''${RESET}"
 rm -rf ${config.devenv.root}/dist/doc
 
 update-versions
-create-polifill
+create-polyfill
+
+if [ -d ${config.devenv.root}/dist/doc ]; then
+    rm -rf ${config.devenv.root}/dist/doc
+    mkdir -p ${config.devenv.root}/dist/doc
+fi
   
 ${config.devenv.root}/node_modules/.bin/jsdoc -c ${config.devenv.root}/doc/jsdoc.json  
 ${pkgs.nodejs_20}/bin/node ${config.devenv.root}/opt/scripts/replace-skypack.cjs  ${config.devenv.root}  
-- 
GitLab