Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shadow-cljs + deps.edn for building this app #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

9 changes: 9 additions & 0 deletions .expo copy/packager-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"devToolsPort": 19002,
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
}
8 changes: 8 additions & 0 deletions .expo copy/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"hostType": "lan",
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": "nd-ff2",
"https": false
}
20 changes: 4 additions & 16 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
node_modules/**/*
.expo/*
npm-debug.*
/target
/classes
/checkouts
.shadow-cljs/
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
.hgignore
.hg/
figwheel_server.log
main.js
.js-modules.edn
/env/dev/env/expo/dev.cljs
/env/dev/env/expo/index.cljs
.idea/
.projectile
*.iml
app/
.cpcache
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Start Expo",
"type": "npm",
"script": "start",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "CLJS Release Build",
"type": "npm",
"script": "release",
"problemMatcher": []
}
]
}
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
8 changes: 7 additions & 1 deletion app.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "reagent-app-demo",
"description": "No description",
"slug": "reagent-app-demo",
"sdkVersion": "34.0.0",
"sdkVersion": "35.0.0",
"version": "1.0.0",
"orientation": "portrait",
"primaryColor": "#cccccc",
Expand All @@ -14,6 +14,12 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
Expand Down
60 changes: 0 additions & 60 deletions build.boot

This file was deleted.

27 changes: 7 additions & 20 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
{:deps
{org.clojure/clojure {:mvn/version "1.9.0"}
org.clojure/clojurescript {:mvn/version "1.10.238"}
reagent {:mvn/version "0.7.1" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server cljsjs/create-react-class]}
react-native-externs {:mvn/version "0.1.0"}}
{:paths ["src/main"]

:paths
["target"]
:deps {reagent {:mvn/version "0.9.0-rc3"}
re-frame {:mvn/version "0.11.0-rc3"}
orchestra {:mvn/version "2018.12.06-2"}
react-native-externs {:mvn/version "0.1.0"}}

:aliases
{:repl
{:extra-paths ["env/dev"]
:main-opts ["-m" "user" "--figwheel"]
:extra-deps
{com.cemerick/piggieback {:mvn/version "0.2.2"
:exclusions [com.google.javascript/closure-compiler]}
figwheel-sidecar {:mvn/version "0.5.14"
:exclusions [com.google.javascript/closure-compiler]}}}

:prod
{:extra-paths ["env/prod"]
:main-opts ["-m" "user"]}}}
:aliases {:dev {:extra-paths ["src/test" "src/dev"]
:extra-deps [thheller/shadow-cljs {:mvn/version "2.8.93"}]}}}
2 changes: 0 additions & 2 deletions dev.cljs.edn

This file was deleted.

12 changes: 12 additions & 0 deletions etc/metro-bundler.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- worker.js 2018-11-21 14:46:01.271844624 -0700
+++ worker.js 2018-11-21 14:45:52.517615272 -0700
@@ -218,7 +218,7 @@
}

if (!options.transformOptions.dev) {
- plugins.push([constantFoldingPlugin, opts]);
+ // plugins.push([constantFoldingPlugin, opts]);
plugins.push([inlinePlugin, opts]);
}var _transformFromAstSync = transformFromAstSync(ast, "", {
ast: true,
babelrc: false,
117 changes: 117 additions & 0 deletions etc/toolchain-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/Usr/bin/env joker

;; Usage: toolchain-report
;;
;; This tool queries a set of defined packages in your "toolchain" and
;; reports the versions of those packages in a map. There are no
;; command line flags or options for this script.

(ns main
(:require [joker.os :as os]))


;; The "toolchain" is defined as a vector of maps that define how to
;; query for version. We expect every tool has some command line flag
;; that writes the version info to stdout or stderr, but each tool
;; might format that output in some unique way. Therefore we specify a
;; regular expression pattern that will be used to extract the version
;; from the output.
;;
;; Easiest to show an example:
;;
;; {
;; :key :yarn ; each tool has a unique key
;; :cmd ["yarn" "-v"] ; executing this prints the version
;; :pattern #"(.*)\n" ; this regexp extracts the version #
;; :output :out ; :out = stdout, :err = stderr
;; }
;;
;; The default is to grab everything from stdout up to the first
;; newline '\n', so our example can be shortened:
;;
;; {:key :yarn :cmd ["yarn" "-v"]}
;;

(def toolchain
[
;; operating system
{:key :os-name
:cmd ["clojure" "-e" "(System/getProperty \"os.name\")"]
:pattern #"\"(.*)\""}
{:key :os-version
:cmd ["clojure" "-e" "(System/getProperty \"os.version\")"]
:pattern #"\"(.*)\""}
{:key :todays-date
:cmd ["clojure" "-e" "(.toString (java.time.LocalDate/now))"]}

;; clojure/clojurescript tools
{:key :clojure
:cmd ["clj" "-Stree"]
:pattern #"org.clojure/clojure\s+(.*)\n"}
{:key :clojurescript
:cmd ["clj" "-Stree"]
:pattern #"org.clojure/clojurescript\s+(.*)\n"}
{:key :shadow-cljs-jar
:cmd ["shadow-cljs" "info"]
:pattern #"jar:\s+(.*)\n"}
{:key :shadow-cljs-cli
:cmd ["shadow-cljs" "info"]
:pattern #"cli:\s+(.*)\n"}

;; react native toolchain
{:key :expo-cli :cmd ["expo-cli" "-V"]}

;; javascript tools
{:key :node :cmd ["node" "-v"]}
{:key :yarn :cmd ["yarn" "-v"]}

;; libraries / packages
{:key :expo-js
:cmd ["yarn" "list"]
:pattern #"\s+expo@(.*)\n"}
{:key :react
:cmd ["yarn" "list"]
:pattern #"\s+react@(.*)\n"}
{:key :react-native
:cmd ["yarn" "list"]
:pattern #"\s+react-native@(.*)\n"}
{:key :reagent
:cmd ["clj" "-Stree"]
:pattern #"reagent/reagent\s+(.*)\n"}
{:key :re-frame
:cmd ["clj" "-Stree"]
:pattern #"re-frame/re-frame\s+(.*)\n"}

;; java jdk
{:key :jdk-vendor
:cmd ["java" "-version"]
:output :err
:pattern #"(.*)\s+version"}
{:key :jdk-version
:cmd ["java" "-version"]
:output :err
:pattern #"version\s+\"(.*)\"\n"}
])

(def sh-memoized (memoize #(apply os/sh %)))

(defn check [{:keys [key cmd output pattern]
:or {output :out pattern #"(.*)\n"}}]
(let [result (try (sh-memoized cmd)
(catch Error e {:success nil}))]
(if (:success result)
{key (-> (re-find pattern (output result))
(get 1))}
{key nil})))

(defn print-sorted-keys [m]
;; hack because joker doesn't provide sorted-map
(println "{")
(doseq [k (sort (keys m))]
(printf " %s \"%s\"\n" k (k m)))
(println "}"))

;; run all queries and print the result
(print-sorted-keys (->> (map check toolchain)
(apply merge)))

5 changes: 5 additions & 0 deletions externs/app.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# fulcro doesn't properly type hint these since they are usually covered
# by react externs. we are not processing any JS however so those are missing
render
props
state
Loading