Skip to content

Commit 57d871b

Browse files
authored
Merge pull request #43 from clj-commons/issue-42
Manage JVM vs. CLJS dependencies better
2 parents 0400e26 + 8efe10b commit 57d871b

File tree

6 files changed

+25
-50
lines changed

6 files changed

+25
-50
lines changed

.github/workflows/clojure.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v3.4.0
18+
uses: actions/checkout@v4
1919

2020
- name: Setup Java
21-
uses: actions/setup-java@v3.10.0
21+
uses: actions/setup-java@v4
2222
with:
2323
java-version: '11'
2424
distribution: 'corretto'
2525

2626
- name: Install clojure tools
27-
uses: DeLaGuardo/setup-clojure@10.2
27+
uses: DeLaGuardo/setup-clojure@12.6
2828
with:
29-
cli: 1.11.1.1165
29+
cli: 1.12.0.1479
3030

3131
- name: Cache clojure dependencies
32-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3333
with:
3434
path: |
3535
~/.m2/repository
@@ -48,8 +48,7 @@ jobs:
4848
run: clojure -X:test
4949

5050
- name: Run ClojureScript tests (Chrome)
51-
run: clojure -Mcljs-test -x chrome-headless
51+
run: clojure -M:cljs-test -x chrome-headless
5252

5353
- name: Run ClojureScript tests (Firefox)
54-
run: clojure -Mcljs-test -x firefox-headless
55-
54+
run: clojure -M:cljs-test -x firefox-headless

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ cljs-test-runner-out/
1414
.clj-kondo/.cache
1515
.lsp/.cache
1616
.portal/vs-code.edn
17+
.calva/repl.calva-repl

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Converts a large integer to a friendly text representation. Works best
6565
for numbers over 1 million. For example, 1000000 becomes '1.0
6666
million', 1200000 becomes '1.2 million' and '1200000000' becomes '1.2
6767
billion'. Supports up to decillion (33 digits) and googol (100
68-
digits).
68+
digits).
6969

7070
```clojure
7171
user> (h/intword 2000000000)
@@ -188,7 +188,7 @@ user> (i/pluralize-noun 6 "buzz")
188188
```
189189

190190
Other functions in the inflect namespace are used to extend the rules
191-
for how particular words, or particular letter patterns in words,
191+
for how particular words, or particular letter patterns in words,
192192
can be pluralized.
193193

194194
### datetime
@@ -197,19 +197,19 @@ Given a datetime or date, return a human-friendly representation
197197
of the amount of time difference, relative to the current time.
198198

199199
```clojure
200-
user> (require '[clj-time.core :as t])
201-
nil
200+
user> (import '(java.time LocalDateTime) '(java.time.temporal ChronoUnit))
201+
java.time.temporal.ChronoUnit
202202

203-
user> (h/datetime (t/plus (t/now) (t/seconds -30)))
203+
user> (h/datetime (.plusSeconds (LocalDateTime/now) -30))
204204
"30 seconds ago"
205205

206-
user> (h/datetime (t/plus (t/now) (t/seconds 30)))
206+
user> (h/datetime (.plusSeconds (LocalDateTime/now) 30))
207207
"in 30 seconds"
208208

209-
user> (h/datetime (t/plus (t/now) (t/years -20)))
209+
user> (h/datetime (.plus (LocalDateTime/now) -20 ChronoUnit/YEARS))
210210
"2 decades ago"
211211

212-
user> (h/datetime (t/plus (t/now) (t/years -7)))
212+
user> (h/datetime (.plus (LocalDateTime/now) -7 ChronoUnit/YEARS))
213213
"7 years ago"
214214

215215
```
@@ -277,7 +277,7 @@ clojure -T:build jar
277277
Deploy a snapshot:
278278

279279
```clj
280-
clojure -T:build deploy
280+
clojure -T:build deploy
281281
```
282282

283283
Set `:release` to `true` for a release version (make sure the version number in `build.clj` is correct first):

deps.edn

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
{:deps {org.clojure/clojure {:mvn/version "1.11.1"}
2-
clj-time/clj-time {:mvn/version "0.15.2"}
3-
com.widdindustries/cljc.java-time {:mvn/version "0.1.21"}
4-
henryw374/js-joda {:mvn/version "3.2.0-0"}}
1+
{:deps {org.clojure/clojure {:mvn/version "1.11.4"}
2+
com.widdindustries/cljc.java-time {:mvn/version "0.1.21"}}
53
:paths ["src"]
64

75
:net.lewisship.build/scm
@@ -14,12 +12,11 @@
1412
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}
1513
:exec-fn cognitect.test-runner.api/test}
1614
:cljs-test {:extra-paths ["test"]
17-
:extra-deps {kongeor/cljs-test-runner
18-
{:git/url "https://github.com/kongeor/cljs-test-runner"
19-
:git/sha "fa604e9e5f4e74a544958dfdf4c5ccc2a4b2c916"}}
15+
:extra-deps {olical/cljs-test-runner {:mvn/version "3.8.1"}
16+
henryw374/js-joda {:mvn/version "3.2.0-0"}}
2017
:main-opts ["-m" "cljs-test-runner.main"]}
2118
:clj-kondo {:replace-deps {clj-kondo/clj-kondo {:mvn/version "RELEASE"}}
2219
:main-opts ["-m" "clj-kondo.main"]}
2320
:build {:deps {io.github.hlship/build-tools
24-
{:git/tag "0.9" :git/sha "4efa3c9"}}
21+
{:git/tag "0.10.2" :git/sha "3c446e4"}}
2522
:ns-default build}}}

test/clj_commons/cljc_test.cljc

-21
This file was deleted.

test/clj_commons/humanize_test.cljc

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
filesize truncate oxford datetime
66
duration]
77
:as h]
8-
#?@(:clj [[clojure.math :as math]])
8+
[clojure.math :as math]
99
[cljc.java-time.local-date-time :as jt.ldt]))
1010

11-
#?(:clj (def ^:private expt math/pow)
12-
:cljs (def ^:private expt (.-pow js/Math)))
11+
(def ^:private expt math/pow)
1312

1413
(deftest intcomma-test
1514
(are [input expected] (= expected (intcomma input))
@@ -228,7 +227,7 @@
228227
(is (= "10 minutes ago"
229228
(datetime (jt.ldt/now)
230229
:now-dt (jt.ldt/plus-minutes (jt.ldt/now) 10)))))
231-
#?@(:cljs
230+
#?(:cljs
232231
(testing "datetime accepts js/Date"
233232
(is (= "a moment ago" (datetime (js/Date.))))
234233
(is (= "10 minutes ago"

0 commit comments

Comments
 (0)