From 52ec2a28476a34b324c5cdf5a0d01b4597a92204 Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sun, 12 Feb 2023 15:34:09 +0100
Subject: [PATCH] chore: update makefiles

---
 development/makefiles/bob.mk                  |  9 +-
 development/makefiles/jsdoc.mk                |  5 +-
 development/makefiles/target-bob.mk           | 32 ++++---
 .../makefiles/target-init-webcomponent.mk     | 86 ++++++++++++-------
 development/makefiles/target-jsdoc-build.mk   | 20 ++++-
 development/makefiles/target-node-build.mk    |  8 ++
 .../makefiles/target-node-playground.mk       | 13 +++
 development/makefiles/target-npm.mk           |  4 +-
 development/makefiles/target-phpunit.mk       |  2 +-
 9 files changed, 127 insertions(+), 52 deletions(-)
 create mode 100644 development/makefiles/target-node-playground.mk

diff --git a/development/makefiles/bob.mk b/development/makefiles/bob.mk
index 2382f7375..c779df317 100644
--- a/development/makefiles/bob.mk
+++ b/development/makefiles/bob.mk
@@ -8,12 +8,15 @@
 
 
 BOB_BIN             ?= $(VENDOR_PATH)bob
-#BOB_SNIPPED_CONFIG  ?= $(VENDOR_PATH)bob/snippet.yaml
+#BOB_SNIPPED_CONFIG ?= $(VENDOR_PATH)bob/snippet.yaml
 BOB_SYNC_CONFIG     ?= $(VENDOR_PATH)bob/sync.yaml
 
-BOB_BUILD_PATH	    ?= $(BUILD_PATH)bob/build/
-BOB_DIST_PATH	    ?= $(DIST_PATH)bob/dist/
+BOB_SOURCE_PATH     ?= $(SOURCE_PATH)
 
+BOB_DIST_PATH	           ?= $(DIST_PATH)bob/dist/
+BOB_HTML_TEMPLATES_PATH  ?=  $(BUILD_PATH)bob/build/
+
+BOB_DATA_FILE ?= data.yaml 
 
 define SYNCEXAMPLECONF
 sync:
diff --git a/development/makefiles/jsdoc.mk b/development/makefiles/jsdoc.mk
index f565f5330..b365b225c 100644
--- a/development/makefiles/jsdoc.mk
+++ b/development/makefiles/jsdoc.mk
@@ -9,4 +9,7 @@
 # path and binaries
 JSDOC         ?= $(NODE_MODULES_BIN_DIR)jsdoc
 
-EXECUTABLES = $(EXECUTABLES:-) $(JSDOC); 
\ No newline at end of file
+EXECUTABLES = $(EXECUTABLES:-) $(JSDOC);
+
+FIXBROKENPLANTUML       ?= $(NODE_MODULES_DIR)jsdoc-plantuml/fixBrokenNodeJS.js
+DOCUMENTATION_S3_PATH   ?= s3://doc.alvine.io/en/oss/$(COMPONENT_SLUG)/ 
\ No newline at end of file
diff --git a/development/makefiles/target-bob.mk b/development/makefiles/target-bob.mk
index 64c91afbe..072890b75 100644
--- a/development/makefiles/target-bob.mk
+++ b/development/makefiles/target-bob.mk
@@ -10,8 +10,8 @@ ifeq ($(BOB_BIN),)
   $(error $(ERRORMARKER) Bob is not defined, check your Makefile if bob.mk is included)
 endif
 
-ifndef BOB_BUILD_PATH
-  $(error $(ERRORMARKER) BOB_BUILD_PATH is not defined, check your Makefile if bob.mk is included)
+ifndef BOB_HTML_TEMPLATES_PATH
+  $(error $(ERRORMARKER) BOB_HTML_TEMPLATES_PATH is not defined, check your Makefile if bob.mk is included)
 endif
 
 ifndef BOB_DIST_PATH
@@ -37,26 +37,34 @@ endif
 	$(ECHOMARKER) "Sync structure of pages"
 	$(QUIET) $(BOB_BIN) html sync --specification $(BOB_SYNC_CONFIG)
 
-
-$(BOB_BUILD_PATH): 
-	$(ECHOMARKER) "Create build directory for bob"
-	$(QUIET) $(MKDIR) -p $(BOB_BUILD_PATH)
+$(BOB_HTML_TEMPLATES_PATH): 
+	$(ECHOMARKER) "Create template directory for bob"
+	$(QUIET) $(MKDIR) -p $(BOB_HTML_TEMPLATES_PATH)
 
 $(BOB_DIST_PATH): 
 	$(ECHOMARKER) "Create dist directory for bob"
 	$(QUIET) $(MKDIR) -p $(BOB_DIST_PATH)
 
 .PHONY: generate-html
-## Build the project
-generate-html: $(BOB_BIN) $(BOB_BUILD_PATH) $(BOB_DIST_PATH)
+## Build the project with Bob
+generate-html: $(BOB_BIN) $(BOB_HTML_TEMPLATES_PATH) $(BOB_DIST_PATH)
 	$(ECHOMARKER) "Generate html"
-	$(QUIET) $(BOB_BIN) html generate --input $(BOB_BUILD_PATH) --output $(BOB_DIST_PATH) 
+	$(QUIET) $(BOB_BIN) html generate --input $(BOB_HTML_TEMPLATES_PATH) --output $(BOB_DIST_PATH) 
 
 .PHONY: prepare-template
-## Prepare template
-prepare-template: $(BOB_BIN) $(BOB_BUILD_PATH)
+## Prepare template with Bob
+prepare-template: $(BOB_BIN) $(BOB_HTML_TEMPLATES_PATH)
+	$(ECHOMARKER) "Generate templates"
+	$(QUIET) $(BOB_BIN) template prepare --input $(BOB_SOURCE_PATH) --output $(BOB_HTML_TEMPLATES_PATH) --data-file=$(BOB_DATA_FILE)
+
+
+
+.PHONY: init-template
+## Init templates if not exist with Bob 
+init-template: $(BOB_BIN) $(BOB_HTML_TEMPLATES_PATH)
 	$(ECHOMARKER) "Generate templates"
-	$(QUIET) find $(SOURCE_PATH) -name "*.yaml" -exec $(BOB_BIN) template prepare --input $(SOURCE_PATH) --output $(BOB_BUILD_PATH) --data-file={} \;
+	$(QUIET) $(BOB_BIN) template prepare --input $(BOB_SOURCE_PATH) --output $(BOB_HTML_TEMPLATES_PATH) --data-file=en.yaml
+
 
 
 
diff --git a/development/makefiles/target-init-webcomponent.mk b/development/makefiles/target-init-webcomponent.mk
index 123b3f395..6460767f2 100644
--- a/development/makefiles/target-init-webcomponent.mk
+++ b/development/makefiles/target-init-webcomponent.mk
@@ -83,8 +83,9 @@ define WEBCOMPONENTS_PACKAGE_CONTENT
     "monster"
   ],
   "dependencies": {
-    "@popperjs/core": "^2.9.2",
-    "@schukai/monster": "^2.0.8"
+    "@popperjs/core": "^2.11.6",
+    "@schukai/component-style": "^0.27.1",
+    "@schukai/monster": "^3.10.1"
   },
   "main": "source/component.mjs",
   "module": "source/component.mjs",
@@ -123,40 +124,65 @@ define WEBCOMPONENTS_BUILD_PACKAGE_CONTENT
     "test": "npx mocha --recursive test/cases/",
     "web-test": "script/web-test.sh",
     "publish": "script/release-and-publish.sh",
-    "build-doc": "script/build-doc.sh"
+    "build-doc": "script/build-doc.sh",
+    "build-style": "node script/build-stylesheets.cjs ."
   },
   "type": "module",
   "author": "schukai GmbH",
   "license": "see LICENSE file",
   "dependencies": {
-    "@popperjs/core": "^2.11.2",
-    "@schukai/monster": "^2.0.8"
-  },
+      "@popperjs/core": "^2.11.6",
+      "@schukai/component-style": "^0.27.1",
+      "@schukai/monster": "^3.10.1"
+    },
   "devDependencies": {
-    "@peculiar/webcrypto": "^1.4.0",
-    "btoa": "^1.2.1",
-    "c8": "^7.12.0",
-    "chai": "^4.3.6",
-    "chai-dom": "^1.11.0",
-    "clean-jsdoc-theme": "^4.1.6",
-    "create-polyfill-service-url": "^2.2.6",
-    "crypt": "^0.0.2",
-    "esbuild": "^0.14.53",
-    "flow-bin": "^0.184.0",
-    "fs": "^0.0.1-security",
-    "graphviz": "^0.0.9",
-    "jsdoc": "^3.6.11",
-    "jsdoc-external-example": "github:volker-schukai/jsdoc-external-example",
-    "jsdoc-plantuml": "^1.0.2",
-    "jsdom": "^19.0.0",
-    "jsdom-global": "^3.0.2",
-    "mocha": "^10.0.0",
-    "node-plantuml": "^0.9.0",
-    "sinon": "^14.0.0",
-    "url": "^0.11.0",
-    "url-exist": "3.0.0",
-    "util": "^0.12.4"
-  }
+      "@oss/web-components-build-tools": "^1.2.8",
+      "@peculiar/webcrypto": "^1.4.1",
+      "autoprefixer": "^10.4.13",
+      "browserslist": "^4.21.5",
+      "btoa": "^1.2.1",
+      "c8": "^7.12.0",
+      "chai": "^4.3.7",
+      "chai-dom": "^1.11.0",
+      "clean-jsdoc-theme": "^4.2.3",
+      "create-polyfill-service-url": "^2.2.6",
+      "crypt": "^0.0.2",
+      "cssnano": "^5.1.14",
+      "esbuild": "^0.17.5",
+      "flow-bin": "^0.199.1",
+      "fs": "0.0.1-security",
+      "glob": "^8.1.0",
+      "graphviz": "^0.0.9",
+      "jsdoc": "^4.0.0",
+      "jsdoc-external-example": "github:volker-schukai/jsdoc-external-example",
+      "jsdoc-plantuml": "^1.0.2",
+      "jsdom": "^21.1.0",
+      "jsdom-global": "^3.0.2",
+      "mocha": "^10.2.0",
+      "node-plantuml": "^0.9.0",
+      "postcss": "^8.4.21",
+      "postcss-fluid": "^1.4.2",
+      "postcss-for": "^2.1.1",
+      "postcss-import": "^15.1.0",
+      "postcss-load-config": "^4.0.1",
+      "postcss-mixins": "^9.0.4",
+      "postcss-nested": "^6.0.0",
+      "postcss-nesting": "^11.1.0",
+      "postcss-normalize": "^10.0.1",
+      "postcss-responsive-type": "^1.0.0",
+      "postcss-rtlcss": "^4.0.1",
+      "postcss-strip-units": "^2.0.1",
+      "rome": "^11.0.0",
+      "sinon": "^15.0.1",
+      "url": "^0.11.0",
+      "url-exist": "3.0.1",
+      "util": "^0.12.5",
+      "vite": "^4.1.1",
+      "vite-plugin-banner": "^0.7.0",
+      "vite-plugin-list-directory-contents": "^1.4.5",
+      "vite-plugin-minify": "^1.5.2",
+      "vite-plugin-mkcert": "^1.12.0"
+    }
 }
 endef
 
diff --git a/development/makefiles/target-jsdoc-build.mk b/development/makefiles/target-jsdoc-build.mk
index 332815163..2581d8535 100644
--- a/development/makefiles/target-jsdoc-build.mk
+++ b/development/makefiles/target-jsdoc-build.mk
@@ -1,4 +1,3 @@
-
 #############################################################################################
 #############################################################################################
 ##
@@ -7,7 +6,13 @@
 #############################################################################################
 #############################################################################################
 
-FIXBROKENPLANTUML := $(NODE_MODULES_DIR)jsdoc-plantuml/fixBrokenNodeJS.js
+ifndef DOCUMENTATION_S3_PATH
+    $(error $(ERRORMARKER) DOCUMENTATION_S3_PATH is not defined, check your Makefile if jsdoc.mk is included)
+endif
+
+ifndef FIXBROKENPLANTUML
+    $(error $(ERRORMARKER) FIXBROKENPLANTUML is not defined, check your Makefile if jsdoc.mk is included)
+endif
 
 .PHONY: jsdoc-build
 ## generate js api docs
@@ -20,4 +25,13 @@ $(FIXBROKENPLANTUML).fixed:
 	$(ECHOMARKER) "fix broken plantuml"
 	$(QUIET) chmod u+x $(FIXBROKENPLANTUML) 
 	$(QUIET) $(NODE) $(FIXBROKENPLANTUML)
-	$(QUIET) $(TOUCH) $(FIXBROKENPLANTUML).fixed
\ No newline at end of file
+	$(QUIET) $(TOUCH) $(FIXBROKENPLANTUML).fixed
+
+
+
+.PHONY: jsdoc-to-s3
+## transfer doc to s3	
+jsdoc-to-s3: jsdoc-build
+	$(ECHOMARKER) "transfer doc to s3"
+	$(QUIET) $(AWS) s3 --recursive --only-show-errors cp $(BUILD_PATH)docs $(DOCUMENTATION_S3_PATH)
+
diff --git a/development/makefiles/target-node-build.mk b/development/makefiles/target-node-build.mk
index 0a0582178..529bc2255 100644
--- a/development/makefiles/target-node-build.mk
+++ b/development/makefiles/target-node-build.mk
@@ -10,6 +10,14 @@ SPONGE   ?=   sponge
 
 EXECUTABLES = $(EXECUTABLES:-) $(SPONGE);
 
+
+.PHONY: node-create-polyfill
+## create polyfill.io url
+node-create-polyfill: $(MJS_RELATIVE_SOURCE_FILES) $(NODE_PACKAGES)
+	$(ECHOMARKER) "create and replace polyfill"
+	$(QUIET) $(DEVELOPMENT_SCRIPTS_PATH)create-polyfill.sh $(MJS_RELATIVE_SOURCE_FILES)
+
+
 .PHONY: node-build
 ## Build Node Components
 node-build: $(NODE_MODULES_MODIFIED) $(NODE_PACKAGES)
diff --git a/development/makefiles/target-node-playground.mk b/development/makefiles/target-node-playground.mk
new file mode 100644
index 000000000..9ad098c4d
--- /dev/null
+++ b/development/makefiles/target-node-playground.mk
@@ -0,0 +1,13 @@
+#############################################################################################
+#############################################################################################
+##
+## RUN PLAYGROUND
+##
+#############################################################################################
+#############################################################################################
+
+.PHONY: node-run-playground
+## run playground (vite)
+node-run-playground: 
+	$(ECHOMARKER) "run playground"
+	$(QUIET) cd $(DEVELOPMENT_PATH)playground; npx vite; 
diff --git a/development/makefiles/target-npm.mk b/development/makefiles/target-npm.mk
index b009d43bb..29c8bcb3c 100644
--- a/development/makefiles/target-npm.mk
+++ b/development/makefiles/target-npm.mk
@@ -29,6 +29,6 @@ npm-preview:
 .PHONY: npm-update-all
 ## Update Node Components	
 npm-update-all:
-	$(ECHOMARKER) "Search and Update recursive all node_modules (npm and pnpm"
+	$(ECHOMARKER) "Search and Update recursive all node_modules (npm and pnpm)"
 	$(QUIET) $(FIND) . -type f ! -path '*node_modules*' -iname pnpm-lock.yaml -exec bash -c 'cd $$(dirname {} ) ; pwd;  pnpm update -Lr ; cd - ' \;
-	$(QUIET) $(FIND) . -type f ! -path '*node_modules*' -iname package-lock.json -exec bash -c 'cd $$(dirname {} ) ; pwd; npm install -g npm-check-updates; npx npm-check-updates; npm install ; cd -' \;
+	$(QUIET) $(FIND) . -type f ! -path '*node_modules*' -iname package-lock.json -exec bash -c 'cd $$(dirname {} ) ; pwd; npm install -D npm-check-updates; npx npm-check-updates -u; npm install ; cd -' \;
diff --git a/development/makefiles/target-phpunit.mk b/development/makefiles/target-phpunit.mk
index 0d27705e2..7120d7f08 100644
--- a/development/makefiles/target-phpunit.mk
+++ b/development/makefiles/target-phpunit.mk
@@ -57,7 +57,7 @@ $(PHPUNIT_SCRIPT_PATH)/unittests.sh:
 
 $(PHPUNIT_BIN):
 	$(MKDIR) -p $(PHPUNIT_PATH)
-	$(WGET) -O $(PHPUNIT_BIN) https://phar.phpunit.de/phpunit-9.phar
+	$(WGET) -O $(PHPUNIT_BIN) https://phar.phpunit.de/phpunit-10.phar
 	$(CHMOD) u+x $(PHPUNIT_BIN)
 	$(CHMOD) u+x $(PHPUNIT_SCRIPT_PATH)/unittests.sh
 
-- 
GitLab