From f62baf0cd09bf5fc89e02a24410eeac4d78937b7 Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 18 Jun 2021 16:18:46 +0200 Subject: [PATCH] established cljs --- .gitlab-ci.yml | 20 ++++++++++++- package.json | 32 +++++++++++++++++++++ project.clj | 3 +- shadow-cljs.edn | 12 ++++++++ src/main/clj/dda/c4k_common/base64.clj | 2 +- src/main/clj/dda/c4k_common/yaml.clj | 2 +- src/main/cljc/dda/c4k_common/common.cljc | 2 +- src/main/cljs/dda/c4k_common/base64.cljs | 2 +- src/main/cljs/dda/c4k_common/browser.cljs | 3 +- src/main/cljs/dda/c4k_common/yaml.cljs | 2 +- src/test/cljc/dda/c4k_common/yaml_test.cljc | 4 +-- 11 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 package.json create mode 100644 shadow-cljs.edn diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f34fc51..bf4a269 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,19 @@ stages: - security - upload -.clj-uploadjob: &clj +.cljs-job: &cljs + image: domaindrivenarchitecture/shadow-cljs + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + - .shadow-cljs/ + - .m2 + before_script: + - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc + - npm install + +.clj-job: &clj image: domaindrivenarchitecture/lein cache: key: ${CI_COMMIT_REF_SLUG} @@ -20,6 +32,12 @@ test-clj: script: - lein test +test-cljs: + <<: *cljs + stage: build_and_test + script: + - shadow-cljs compile test + upload-clj-prerelease: <<: *clj stage: upload diff --git a/package.json b/package.json new file mode 100644 index 0000000..92c616a --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "c4k-common", + "description": "Contains predicates and tools for c4k", + "author": "meissa GmbH", + "version": "0.1.0-SNAPSHOT", + "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-common#readme", + "repository": "https://www.npmjs.com/package/c4k-common", + "license": "APACHE2", + "main": "c4k-common.js", + "bin": { + "c4k-common": "./c4k-common.js" + }, + "keywords": [ + "cljs", + "k8s", + "c4k", + "deployment", + "yaml", + "convention4kubernetes" + ], + "bugs": { + "url": "https://gitlab.com/domaindrivenarchitecture/c4k-common/issues" + }, + "dependencies": { + "js-base64": "^3.6.1", + "js-yaml": "^4.0.0" + }, + "devDependencies": { + "shadow-cljs": "^2.11.18", + "source-map-support": "^0.5.19" + } +} diff --git a/project.clj b/project.clj index 5a60c57..477e0ea 100644 --- a/project.clj +++ b/project.clj @@ -16,7 +16,8 @@ ["releases" :clojars]] :deploy-repositories [["snapshots" :clojars] ["releases" :clojars]] - :profiles {:test {:test-paths ["src/test/cljc"] + :profiles {:test {:test-paths ["src/test/clj" + "src/test/cljc"] :resource-paths ["src/test/resources"] :dependencies [[dda/data-test "0.1.1"]]} :dev {:plugins [[lein-shell "0.5.0"]]}} diff --git a/shadow-cljs.edn b/shadow-cljs.edn new file mode 100644 index 0000000..a4db323 --- /dev/null +++ b/shadow-cljs.edn @@ -0,0 +1,12 @@ +{:source-paths ["src/main/cljc" + "src/main/cljs" + "src/main/resources" + "src/test/cljc" + "src/test/resources"] + :dependencies [[aero "1.1.6"] + [orchestra "2021.01.01-1"] + [expound "0.8.9"]] + :builds {:test {:target :node-test + :output-to "target/node-tests.js" + :autorun true + :repl-pprint true}}} diff --git a/src/main/clj/dda/c4k_common/base64.clj b/src/main/clj/dda/c4k_common/base64.clj index 17998f1..8ad3e00 100644 --- a/src/main/clj/dda/c4k_common/base64.clj +++ b/src/main/clj/dda/c4k_common/base64.clj @@ -1,4 +1,4 @@ -(ns dda.c4k_common.base64 +(ns dda.c4k-common.base64 (:import (java.util Base64))) (defn encode diff --git a/src/main/clj/dda/c4k_common/yaml.clj b/src/main/clj/dda/c4k_common/yaml.clj index 19b26e7..56c01fe 100644 --- a/src/main/clj/dda/c4k_common/yaml.clj +++ b/src/main/clj/dda/c4k_common/yaml.clj @@ -1,4 +1,4 @@ -(ns dda.c4k_common.yaml +(ns dda.c4k-common.yaml (:require [clojure.java.io :as io] [clj-yaml.core :as yaml] diff --git a/src/main/cljc/dda/c4k_common/common.cljc b/src/main/cljc/dda/c4k_common/common.cljc index 9807845..d60ed4b 100644 --- a/src/main/cljc/dda/c4k_common/common.cljc +++ b/src/main/cljc/dda/c4k_common/common.cljc @@ -1,4 +1,4 @@ -(ns dda.c4k_common.common +(ns dda.c4k-common.common (:require [clojure.walk])) diff --git a/src/main/cljs/dda/c4k_common/base64.cljs b/src/main/cljs/dda/c4k_common/base64.cljs index 5319b7d..90bd2a7 100644 --- a/src/main/cljs/dda/c4k_common/base64.cljs +++ b/src/main/cljs/dda/c4k_common/base64.cljs @@ -1,4 +1,4 @@ -(ns dda.c4k_common.base64 +(ns dda.c4k-common.base64 (:require ["js-base64" :as b64])) diff --git a/src/main/cljs/dda/c4k_common/browser.cljs b/src/main/cljs/dda/c4k_common/browser.cljs index fb4f8bb..aedcc07 100644 --- a/src/main/cljs/dda/c4k_common/browser.cljs +++ b/src/main/cljs/dda/c4k_common/browser.cljs @@ -1,8 +1,7 @@ -(ns dda.c4k_common.browser +(ns dda.c4k-common.browser (:require [clojure.string :as st] [clojure.spec.alpha :as s] - [clojure.tools.reader.edn :as edn] [expound.alpha :as expound] [orchestra.core :refer-macros [defn-spec]])) diff --git a/src/main/cljs/dda/c4k_common/yaml.cljs b/src/main/cljs/dda/c4k_common/yaml.cljs index b25ceba..78c3f0d 100644 --- a/src/main/cljs/dda/c4k_common/yaml.cljs +++ b/src/main/cljs/dda/c4k_common/yaml.cljs @@ -1,4 +1,4 @@ -(ns dda.c4k_common.yaml +(ns dda.c4k-common.yaml (:require ["js-yaml" :as yaml] [shadow.resource :as rc])) diff --git a/src/test/cljc/dda/c4k_common/yaml_test.cljc b/src/test/cljc/dda/c4k_common/yaml_test.cljc index a9c80c4..2857070 100644 --- a/src/test/cljc/dda/c4k_common/yaml_test.cljc +++ b/src/test/cljc/dda/c4k_common/yaml_test.cljc @@ -1,8 +1,8 @@ -(ns dda.c4k_common.yaml-test +(ns dda.c4k-common.yaml-test (:require #?(:clj [clojure.test :refer [deftest is are testing run-tests]] :cljs [cljs.test :refer-macros [deftest is are testing run-tests]]) - [dda.c4k_common.yaml :as cut])) + [dda.c4k-common.yaml :as cut])) (deftest should-parse-yaml-string (is (= {:hallo "welt"}