Skip to content

Commit

Permalink
Make development easier (ditch Makefile)
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadalm committed Jan 6, 2024
1 parent 21a4645 commit 71850db
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
- name: Build artifacts
run: |
clojure -Stree
make
yarn install
yarn release
- name: Deploy
uses: JamesIves/[email protected]
with:
Expand Down
29 changes: 0 additions & 29 deletions Makefile

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"release": "shadow-cljs release app",
"watch": "shadow-cljs watch app",
"test": "shadow-cljs compile test && node ./target/node-test.js",
"test:watch": "shadow-cljs --config-merge '{:autorun true}' watch test"
"test:all": "clojure -M:cljfmt check && clojure -M:clj-kondo && yarn test",
"test:watch": "shadow-cljs --config-merge '{:autorun true}' watch test",
"clean": "rm -rf resources/public/js resources/public/index.html resources/public/worker.js resources/public/manifest.json"
},
"devDependencies": {
"shadow-cljs": "^2.20.20"
Expand Down
1 change: 1 addition & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:dev {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}}
:release {:module-hash-names true}
:devtools {:preloads [day8.re-frame-10x.preload]}
:build-hooks [(build.hook/hook)]
:target :browser}
:test {:target :node-test
:output-to "target/node-test.js"
Expand Down
2 changes: 1 addition & 1 deletion src/build/create_index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(defn- app-version []
(sh "git" "rev-parse" "HEAD"))

(defn- render []
(defn render []
(str
"<!doctype html>
<html lang=\"en-US\">
Expand Down
2 changes: 1 addition & 1 deletion src/build/create_manifest.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[jsonista.core :as j]
[build.util :as u]))

(defn- render []
(defn render []
(j/write-value-as-string
{:name "Backgammon"
:icons [{:src (u/asset "img/icon.svg")
Expand Down
2 changes: 1 addition & 1 deletion src/build/create_worker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(u/asset "js/app.js")
(u/asset "css/styles.css")])

(defn- render []
(defn render []
(str/replace
(slurp "./resources/private/worker.js")
#".*prop:urlsToCache.*"
Expand Down
15 changes: 15 additions & 0 deletions src/build/hook.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(ns build.hook
(:require
[clojure.java.io :as io]
[build.create-manifest]
[build.create-index]
[build.create-worker]))

(defn hook
{:shadow.build/stage :flush}
[build-state & _args]
(when-not (.exists (io/file "resources/public/worker.js"))
(spit "resources/public/manifest.json" (build.create-manifest/render))
(spit "resources/public/index.html" (build.create-index/render))
(spit "resources/public/worker.js" (build.create-worker/render)))
build-state)

0 comments on commit 71850db

Please sign in to comment.