Skip to content

Commit 3a252da

Browse files
author
Lukas Domagala
committed
initial version
1 parent 0fc0d07 commit 3a252da

File tree

14 files changed

+1121
-0
lines changed

14 files changed

+1121
-0
lines changed

.gitignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/target
2+
/classes
3+
/checkouts
4+
/node_modules
5+
*.jar
6+
*.class
7+
/.calva/output-window/
8+
/.cpcache
9+
/.lein-*
10+
/.lsp/sqlite*.db
11+
/.nrepl-history
12+
/.nrepl-port
13+
/.rebel_readline_history
14+
/.socket-repl-port
15+
.shadow-cljs/
16+
.cljs_node_repl/
17+
.clj-kondo/.cache/
18+
.hgignore
19+
.hg/
20+
resources/public/js/
21+
22+
# vscode
23+
*.calva/
24+
.lsp/
25+
.portal/

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# cljs-macroexpand
2+
3+
clojurescript macroexpand-all macro with meta support.
4+
5+
```clojure
6+
(cljs-macroexpand-all '(when (let [a 5] a) "false"))
7+
;; (if (let* [a 5] a) (do "false"))
8+
(macroexpand '(when (let [a 5] a) "false"))
9+
;; (if (let [a 5] a) (do "false"))
10+
```
11+
12+
Basically clojure.walk.macroexpand-all for clojurescript.
13+
14+
Its mostly lifted from [flow-storm](https://github.com/jpmonettas/flow-storm/blob/master/src/flow_storm/instrument.clj) who came up with a way to macroexpand inside clojurescript. The expansion itself is mostly from [orchard](https://github.com/clojure-emacs/orchard/blob/master/src/orchard/meta.clj#L313).
15+
16+
17+
## Usage
18+
19+
FIXME: write usage documentation!
20+
21+
Run the project's tests (they'll fail until you edit them):
22+
23+
$ clojure -X:test
24+
25+
Run the project's tests (they'll fail until you edit them):
26+
27+
$ clojure -T:build test
28+
29+
Run the project's CI pipeline and build a JAR (this will fail until you edit the tests to pass):
30+
31+
$ clojure -T:build ci
32+
33+
This will produce an updated `pom.xml` file with synchronized dependencies inside the `META-INF`
34+
directory inside `target/classes` and the JAR in `target`. You can update the version (and SCM tag)
35+
information in generated `pom.xml` by updating `build.clj`.
36+
37+
Install it locally (requires the `ci` task be run first):
38+
39+
$ clojure -T:build install
40+
41+
Deploy it to Clojars -- needs `CLOJARS_USERNAME` and `CLOJARS_PASSWORD` environment
42+
variables (requires the `ci` task be run first):
43+
44+
$ clojure -T:build deploy
45+
46+
## License
47+
48+
Distributed under the Eclipse Public License version 1.0.

build.clj

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
(ns build
2+
(:require [clojure.tools.build.api :as b]
3+
[org.corfield.build :as bb]))
4+
5+
(def lib 'net.clojars.cyrik/cljs-macroexpand)
6+
;; if you want a version of MAJOR.MINOR.COMMITS:
7+
(def version (format "0.1.%s" (b/git-count-revs nil)))
8+
9+
(defn test "Run the tests." [opts]
10+
(bb/run-tests opts))
11+
12+
(defn clean "clean" [opts]
13+
(-> opts
14+
(assoc :lib lib :version version)
15+
(bb/clean)))
16+
17+
(defn install "Install the JAR locally." [opts]
18+
(-> opts
19+
(assoc :lib lib :version version)
20+
(bb/install)))
21+
22+
(defn ci "Run the CI pipeline of tests (and build the JAR)." [opts]
23+
(-> opts
24+
(assoc :lib lib :version version)
25+
(bb/run-tests)
26+
(bb/clean)
27+
(bb/jar)))
28+
29+
(defn deploy "Deploy the JAR to Clojars." [opts]
30+
(-> opts
31+
(assoc :lib lib :version version)
32+
(bb/deploy)))

deps.edn

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{:paths ["src" "resources"]
2+
:deps {org.clojure/clojure {:mvn/version "1.10.3"}
3+
org.clojure/clojurescript {:mvn/version "1.10.879"}}
4+
:aliases
5+
{:shadow-cljs
6+
{:extra-deps {thheller/shadow-cljs {:mvn/version "2.15.5"}}}
7+
:test
8+
{:extra-paths ["test"]
9+
:extra-deps {org.clojure/test.check {:mvn/version "1.1.0"}
10+
io.github.cognitect-labs/test-runner
11+
{:git/url "https://github.com/cognitect-labs/test-runner"
12+
:sha "62ef1de18e076903374306060ac0e8a752e57c86"}}
13+
:exec-fn cognitect.test-runner.api/test}
14+
:build
15+
{:deps {io.github.seancorfield/build-clj
16+
{:git/tag "v0.5.4" :git/sha "bc9c0cc"}}
17+
:ns-default build}}}

doc/intro.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Introduction to cljs-macroexpand
2+
3+
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)

0 commit comments

Comments
 (0)