diff --git a/.gitignore b/.gitignore index 5e67719..fc6713d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ pom.xml.asc .cpcache/ .shadow-cljs/ node_modules/ -/public/js \ No newline at end of file +/public/js +/out \ No newline at end of file diff --git a/README.md b/README.md index c7d7812..0870522 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,12 @@ Embeds mastodon timline into a html page. Uses JS, no intermediate server requir # Setup -sudo npm i -g npx +sudo npm install -g npx +sudo npm install -g source-map-support +sudo npm install -g shadow-cljs # Development -npx shadow-cljs node-repl -npx shadow-cljs watch frontend \ No newline at end of file +shadow-cljs node-repl +shadow-cljs watch frontend +shadow-cljs compile test \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..869e401 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,30 @@ +{ + "name": "dda-masto-embed", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } +} diff --git a/package.json b/package.json index ccc67e9..ad0be88 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "0.0.1", "private": true, "devDependencies": { - "shadow-cljs": "2.8.100" + "shadow-cljs": "2.8.100", + "source-map-support": "^0.5.19" }, "dependencies": {} } diff --git a/shadow-cljs.edn b/shadow-cljs.edn index d643eb9..19e4f0f 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -8,6 +8,10 @@ [] :dev-http {8080 "public"} :builds - {:frontend + {:test + {:target :node-test + :output-to "out/node-tests.js" + :autorun true} + :frontend {:target :browser :modules {:main {:init-fn dda.masto-embed.app/init}}}}} diff --git a/src/main/dda/masto_embed/app.cljs b/src/main/dda/masto_embed/app.cljs index 31f4b2a..006b75a 100644 --- a/src/main/dda/masto_embed/app.cljs +++ b/src/main/dda/masto_embed/app.cljs @@ -1,5 +1,8 @@ (ns dda.masto-embed.app) +(defn add-one [a] + (+ a 1)) + (defn init "" [] diff --git a/src/test/dda/masto_embed/app_test.cljs b/src/test/dda/masto_embed/app_test.cljs new file mode 100644 index 0000000..dcd6033 --- /dev/null +++ b/src/test/dda/masto_embed/app_test.cljs @@ -0,0 +1,8 @@ +(ns dda.masto-embed.app-test + (:require + [cljs.test :refer (deftest is)] + [dda.masto-embed.app :as sut])) + +(deftest a-failing-test + (is (= 3 + (sut/add-one 2)))) \ No newline at end of file