From 44aaf4a156e94e4fc6539e1040ea227ef00119f5 Mon Sep 17 00:00:00 2001 From: skwak22 Date: Wed, 15 Jul 2020 21:19:38 +0900 Subject: [PATCH] introduce shadow-cljs as ClojureScript compiler --- .DS_Store | Bin 0 -> 6148 bytes README.md | 34 ++++++++++++++++++ assets/index.html | 11 ++++++ deps.edn | 1 - package.json | 21 +++++++++++ shadow-cljs.edn | 7 ++++ src/.DS_Store | Bin 6148 -> 6148 bytes src/propeller/.DS_Store | Bin 6148 -> 6148 bytes src/propeller/main.cljs | 8 +++++ src/propeller/problems/software/smallest.cljc | 6 ++-- src/propeller/push/.DS_Store | Bin 6148 -> 6148 bytes .../push/utils/{macros.clj => macros.cljc} | 0 12 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 .DS_Store create mode 100644 assets/index.html delete mode 100644 deps.edn create mode 100644 package.json create mode 100644 shadow-cljs.edn create mode 100644 src/propeller/main.cljs rename src/propeller/push/utils/{macros.clj => macros.cljc} (100%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9a874b5768f336915163bb88cd434575b859f936 GIT binary patch literal 6148 zcmeH~Jr2S!425ml0g0s}V-^m;4I%_5-~tF3k&vj^b9A16778<}(6eNJu~Vz<8=6`~ zboab&MFtUB!i}=AFfm2m$tVxGT*u4pe81nUlA49C} z?O@64YO)2RT{MRe%{!}2F))pG(Sih~)xkgosK7*lF7m<7{{#Hn{6A@7N(HFEpDCdI z{ + + + propeller shadow-cljs + + + +
See Console!
+ + + \ No newline at end of file diff --git a/deps.edn b/deps.edn deleted file mode 100644 index dedbbfa..0000000 --- a/deps.edn +++ /dev/null @@ -1 +0,0 @@ -{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0fd2e1d --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "propeller-cljs", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "watch": "shadow-cljs watch app", + "compile": "shadow-cljs compile app", + "release": "shadow-cljs release app", + "html": "mkdir -p target && cp assets/index.html target/", + "serve": "yarn html && http-server target/", + "del": "rm -r target/*", + "build": "yarn release && yarn html && yarn serve" + }, + "author": "", + "license": "MIT", + "devDependencies": { + "http-server": "^0.12.3", + "shadow-cljs": "^2.10.10" + } +} \ No newline at end of file diff --git a/shadow-cljs.edn b/shadow-cljs.edn new file mode 100644 index 0000000..5901c31 --- /dev/null +++ b/shadow-cljs.edn @@ -0,0 +1,7 @@ +{:source-paths ["src"] + :dependencies [] + :dev-http {8080 "target/"} + :builds {:app {:output-dir "target/" + :asset-path "." + :target :browser + :modules {:main {:init-fn propeller.main/main!}}}}} \ No newline at end of file diff --git a/src/.DS_Store b/src/.DS_Store index 70cf7220f114527fc0bf76e9298cdbbf64487b02..bf7db11ae7cdca67181c347f9cc33b772a663d38 100644 GIT binary patch delta 38 ucmZoMXfc@J&&a$nU^gQp^JE^T|C}ks$vH{+`8f=mzcPJh+04%ImmdK5e+_p4 delta 33 pcmZoMXfc@J&&aefU^nAr0}+}|GS;|n%kO9&G65N>R#Xi|Ugk>`~2M-5h+s4H2%#-;= a6h%QMDFAT-5Cg4ZH~_>9n;k{=GXnr2i6006 delta 110 zcmZoMXfc=|&Zs)EP}q!-fq{XAp@5;3p_m~fr8qe!DL+34BnSjd5Q+iB1!4gPxctV0 sZtN2;By48q5a3``-FWaj^JIPzMNW{y1dyi5COpcU6GWCUPi$ZT0QHa<1^@s6 diff --git a/src/propeller/main.cljs b/src/propeller/main.cljs new file mode 100644 index 0000000..6dd3792 --- /dev/null +++ b/src/propeller/main.cljs @@ -0,0 +1,8 @@ +(ns propeller.main + (:require [propeller.core :as propeller])) + +(defn main! [] + (println "Loading main...")) + +(defn ^:dev/after-load reload! [] + (propeller/-main)) diff --git a/src/propeller/problems/software/smallest.cljc b/src/propeller/problems/software/smallest.cljc index 7e8c3fb..e77c615 100755 --- a/src/propeller/problems/software/smallest.cljc +++ b/src/propeller/problems/software/smallest.cljc @@ -4,7 +4,8 @@ [propeller.push.state :as state] [propeller.push.utils.helpers :refer [get-stack-instructions]] [propeller.utils :as utils] - [propeller.push.state :as state])) + [propeller.push.state :as state] + #?(:cljs [cljs.reader :refer [read-string]]))) ;; ============================================================================= ;; Tom Helmuth, thelmuth@cs.umass.edu @@ -82,7 +83,8 @@ inputs) errors (map (fn [correct-output output] (let [parsed-output (try (read-string output) - (catch Exception e 1))] + #?(:clj (catch Exception e 1000.0) + :cljs (catch js/Error. e 1000.0)))] (if (= correct-output parsed-output) 0 1))) correct-outputs outputs)] diff --git a/src/propeller/push/.DS_Store b/src/propeller/push/.DS_Store index 8544a8f52b6bed10c3852173e96b82c09b2ebd14..49c1bfbfb5214f1f25808da623ceb5915c2d26f2 100644 GIT binary patch delta 18 acmZoMXfc>@eB(tk_K6K#o7p-3@&f=%HwS0{ delta 20 ccmZoMXfc>@oRM+kMKkt^4V;_VIsWnk08q>aX#fBK diff --git a/src/propeller/push/utils/macros.clj b/src/propeller/push/utils/macros.cljc similarity index 100% rename from src/propeller/push/utils/macros.clj rename to src/propeller/push/utils/macros.cljc