diff --git a/package.json b/package.json index 70a0c8b6..e5ede2fe 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "homepage": "https://github.com/homebaseio/homebase-react", "repository": { "type": "git", - "url": "https://github.com/homebaseio/homebase-react.git" + "url": "git+https://github.com/homebaseio/homebase-react.git" }, "keywords": [ "react", @@ -15,6 +15,7 @@ "state", "graph" ], + "main": "./dist/homebase.react.js", "devDependencies": { "@babel/cli": "7.11.6", "@babel/core": "7.11.6", @@ -26,5 +27,12 @@ "react-dom": "16.13.0", "shadow-cljs": "2.11.4" }, - "dependencies": {} + "dependencies": {}, + "bugs": { + "url": "https://github.com/homebaseio/homebase-react/issues" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "" } diff --git a/shadow-cljs.edn b/shadow-cljs.edn index 46ccfd04..4f0b6f53 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -18,4 +18,10 @@ :output-feature-set :es6} :modules {:main {:init-fn example.core/init}} :js-options {:resolve {"devcards-marked" {:target :npm :require "marked"} - "devcards-syntax-highlighter" {:target :npm :require "highlight.js"}}}}}} + "devcards-syntax-highlighter" {:target :npm :require "highlight.js"}}}} + :npm-dist {:target :npm-module + :output-dir "dist" + :output-to "dist/lib.js" + :entries [homebase.react] + :compiler-options {:optimizations :advanced + :source-map false}}}} diff --git a/src/example/core.cljs b/src/example/core.cljs index e8e277ef..c1ced017 100644 --- a/src/example/core.cljs +++ b/src/example/core.cljs @@ -4,6 +4,7 @@ ["marked" :as marked] [cljsjs.react] [cljsjs.react.dom] + [reagent.core] [devcards.core :as dc] [example.counter] [example.todo])) @@ -14,4 +15,4 @@ (js/goog.exportSymbol "DevcardsSyntaxHighlighter" highlight) (defn init [] - (dc/start-devcard-ui!)) \ No newline at end of file + (dc/start-devcard-ui!)) diff --git a/src/homebase/react.cljs b/src/homebase/react.cljs index 3d907136..3adc4bc6 100644 --- a/src/homebase/react.cljs +++ b/src/homebase/react.cljs @@ -1,7 +1,6 @@ (ns homebase.react (:require ["react" :as react] - [reagent.core :as r] [homebase.js :as hbjs] [datascript.core :as d])) @@ -16,7 +15,7 @@ (merge (hbjs/js->schema (.-schema config)) base-schema) base-schema))] (when (.-initialData config) (hbjs/transact! conn (.-initialData config))) - (r/create-element + (react/createElement (.-Provider homebase-context) #js {:value conn} (.-children props)))) @@ -43,4 +42,4 @@ (defn ^:export useTransact [] (let [conn (react/useContext homebase-context) transact (fn transact [txs] (hbjs/transact! conn txs))] - [transact])) \ No newline at end of file + [transact]))