Skip to content

Commit

Permalink
build: Added shadow-cljs
Browse files Browse the repository at this point in the history
  • Loading branch information
KingMob committed Mar 22, 2024
1 parent f271627 commit 66925b4
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ pom.xml.asc
package-lock.json
/cljs-test-runner-out/
/.direnv/
/.shadow-cljs/
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ The JavaScript interface currently only supports IQL-strict queries.

### Development

#### Shadow-cljs

To develop with a cljs environment, use shadow-cljs. The simplest way is to use a bare Node-based REPL.

From the command-line, run:

```shell
npx shadow-cljs server # start the shadow-cljs server
npx shadow-cljs node-repl # start the node repl
```

Alternatively, for an nREPL environment for your editor, after running `npx shadow-cljs server`, connect to the nREPL server in your editor with the standard .nrepl-port file. (This process will be editor-specific.)

This will get you a Clojure-based REPL. To convert it to Clojurescript, run:

```clojure
(shadow/node-repl) ; starts a bare node repl
```

To exit, enter `:cljs/quit`.

#### Testing

Make sure [babashka](https://github.com/babashka/babashka) is installed. Then
Expand Down
3 changes: 2 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
io.github.clojure/tools.build {:git/sha "8e78bccc35116f6b6fc0bf0c125dba8b8db8da6b"}
org.babashka/sci {:mvn/version "0.3.32"}
org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.60"}
org.clojure/clojurescript {:mvn/version "1.11.132"}
org.clojure/core.match {:mvn/version "1.0.0"}
org.clojure/data.csv {:mvn/version "1.0.1"}
org.clojure/math.combinatorics {:mvn/version "0.1.6"}
Expand All @@ -27,6 +27,7 @@
org.clojure/test.check {:mvn/version "1.1.1"}}}
:build {:deps {io.github.clojure/tools.build {:git/sha "8e78bccc35116f6b6fc0bf0c125dba8b8db8da6b"}}
:ns-default build}
:cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.27.5"}}}
:clj-test {:extra-deps {io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:main-opts ["--main" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}
Expand Down
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "inferenceql.query",
"version": "1.0.0",
"description": "![tests](https://github.com/OpenIQL/inferenceql.query/workflows/tests/badge.svg) ![linter](https://github.com/OpenIQL/inferenceql.query/workflows/linter/badge.svg)",
"main": "index.js",
"directories": {
"doc": "docs",
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/InferenceQL/inferenceql.query.git"
},
"keywords": [],
"author": "",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/InferenceQL/inferenceql.query/issues"
},
"homepage": "https://github.com/InferenceQL/inferenceql.query#readme",
"devDependencies": {
"shadow-cljs": "^2.27.5"
},
"dependencies": {
}
}
18 changes: 18 additions & 0 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
;; shadow-cljs configuration
{:deps {:aliases [:cljs :test]}

:builds
{:test
{:target :node-test
:output-to "target/main/node-tests.js"
:compiler-options {:infer-externs :auto}}

;; Continually build with `npx shadow-cljs watch query`
;; Test advanced compilation with `npx shadow-cljs release query`.
:query
{:target :browser
:output-dir "public/assets/query/js"
:asset-path "/assets/query/js"
:modules {:query {:entries [inferenceql.query.js]}}
:compiler-options {:infer-externs :auto
:optimizations :advanced}}}}

0 comments on commit 66925b4

Please sign in to comment.