diff --git a/.gitignore b/.gitignore index 203542e..11f8bbc 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ pom.xml.asc /out/ package-lock.json /cljs-test-runner-out/ +/.shadow-cljs/ diff --git a/README.md b/README.md index 3aff38c..668e690 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,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 diff --git a/deps.edn b/deps.edn index 2b147df..01b4729 100644 --- a/deps.edn +++ b/deps.edn @@ -8,7 +8,7 @@ io.github.inferenceql/inferenceql.inference {:git/sha "40e77dedf680b7936ce988b66186a86f5c4db6a5"} 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"} @@ -23,6 +23,7 @@ :aliases {:test {:extra-paths ["test"] :extra-deps {com.gfredericks/test.chuck {:mvn/version "0.2.13"} org.clojure/test.check {:mvn/version "1.1.1"}}} + :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 ["-m" "cognitect.test-runner"] :exec-fn cognitect.test-runner.api/test} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6dd124c --- /dev/null +++ b/package.json @@ -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": { + } + } diff --git a/shadow-cljs.edn b/shadow-cljs.edn new file mode 100644 index 0000000..92ac6c6 --- /dev/null +++ b/shadow-cljs.edn @@ -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}}}}