Skip to content

Commit

Permalink
feat: update Dart's deps.edn template to add :aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Mochamad Lucky Pradana committed Jan 3, 2023
1 parent 4006173 commit 6e65b3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.1.3
- Update Dart's deps.edn template to add :aliases

## 1.1.2
- Fix dart project generation, adding :kind on deps.edn

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cljds
description: ClojureDart project generation made using ClojureDart. Supports plain Dart and Flutter project.
version: 1.1.2
version: 1.1.3
homepage: https://github.com/ampersanda/clojuredart-cli

environment:
Expand Down
8 changes: 5 additions & 3 deletions src/cljds/generators/dart.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

;; initialize deps.edn
(let [edn-file (await (io/mkfile (str dir-name "/deps.edn")))
content (string/replace dart-edn-tpl #"CLJD_SHA" sha)]
content (-> dart-edn-tpl
(string/replace #"CLJD_SHA" sha)
(string/replace #"NAMESPACE" namespace))]
(await (.writeAsString edn-file content)))

;; add main file
Expand All @@ -23,10 +25,10 @@
(await (.writeAsString main-file content)))

;; clj -M -m cljd.build init --dart namespace
(>> (str "Running clj -M -m cljd.build init --dart " namespace))
(>> (str "Running clj -M:cljd init " namespace))

(let [result (await
(.run Process "clj" ["-M" "-m" "cljd.build" "init" "--dart" namespace] .workingDirectory dir-name))]
(.run Process "clj" ["-M:cljd" "init" namespace] .workingDirectory dir-name))]
(>> (.-stdout result))
(!! (.-stderr result)))

Expand Down
4 changes: 3 additions & 1 deletion src/cljds/templates.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
{:git/url \"[email protected]:tensegritics/ClojureDart.git\"
; or \"https://github.com/tensegritics/ClojureDart.git\"
:sha \"CLJD_SHA\"}}
:cljd/opts {:kind :dart}}")
:aliases {:cljd {:main-opts [\"-m\" \"cljd.build\"]}}
:cljd/opts {:kind :dart
:main NAMESPACE}}")

(def dart-main-tpl
"(ns NAMESPACE
Expand Down

0 comments on commit 6e65b3e

Please sign in to comment.