Skip to content

Commit

Permalink
use helix.core/*display-name-hook*
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Feb 3, 2020
1 parent e4a7c90 commit eb5b81d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
4 changes: 2 additions & 2 deletions examples/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:sha "e6b5f0b84b736481269a62beb4ce70f99a30f9a0"}

lilactown/helix {:git/url "https://github.com/darwin/helix.git"
:sha "2020508d53a06b2bd3d51038c08149963d8a9d34"}
:sha "e43f4b7d7354eb97b3d354c5f192623d287f2793"}

;lilactown/helix {:local/root "vendor/helix"}

Expand All @@ -34,6 +34,6 @@
:extra-paths ["vendor/shadow-cljs/src/main"
"vendor/shadow-cljs/src/repl"]}

:shadow-cljs {:main-opts ["-m" "shadow.cljs.devtools.cli"]}}
:shadow-cljs {:main-opts ["-m" "shadow.cljs.devtools.cli"]}}
}

59 changes: 30 additions & 29 deletions examples/shadow-cljs.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,34 @@
:dev-http {8080 "public"}
;:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5006"]
:builds {:app
{:target :browser
:output-dir "public/.compiled"
:asset-path "/.compiled"
:dev {:js-options {; this is needed to instruct closure compiler to NOT remove unused names of anonymous functions
; this is preferred, we want to see all component names in React Devtools
; https://github.com/react-spring/react-three-fiber/issues/282
:anon-fn-naming-policy :unmapped}
:devtools {; TODO: remove after https://github.com/thheller/shadow-cljs/issues/637
:loader-mode :script}}
:module-loader true
{:target :browser
:output-dir "public/.compiled"
:asset-path "/.compiled"
:dev {:js-options {; this is needed to instruct closure compiler to NOT remove unused names of anonymous functions
; this is preferred, we want to see all component names in React Devtools
; https://github.com/react-spring/react-three-fiber/issues/282
:anon-fn-naming-policy :unmapped}
:devtools {; TODO: remove after https://github.com/thheller/shadow-cljs/issues/637
:loader-mode :script
:preloads [react-three-fiber.examples.dev.preload]}}
:module-loader true
:module-loader-init false
:modules {:main {:entries [react-three-fiber.examples.index]
:init-fn react-three-fiber.examples.index/init!}
:demo-box {:entries [react-three-fiber.examples.demos.box]
:depends-on #{:main}}
:demo-refraction {:entries [react-three-fiber.examples.demos.refraction]
:depends-on #{:main}}
:demo-font {:entries [react-three-fiber.examples.demos.font]
:depends-on #{:main}}
:demo-mesh-line {:entries [react-three-fiber.examples.demos.mesh-line]
:depends-on #{:main}}
:demo-montage {:entries [react-three-fiber.examples.demos.montage]
:depends-on #{:main}}
:demo-svg-loader {:entries [react-three-fiber.examples.demos.svg-loader]
:depends-on #{:main}}
:demo-physics {:entries [react-three-fiber.examples.demos.physics]
:depends-on #{:main}}
:demo-gltf-planet {:entries [react-three-fiber.examples.demos.gltf-planet]
:depends-on #{:main}}
}}}}
:modules {:main {:entries [react-three-fiber.examples.index]
:init-fn react-three-fiber.examples.index/init!}
:demo-box {:entries [react-three-fiber.examples.demos.box]
:depends-on #{:main}}
:demo-refraction {:entries [react-three-fiber.examples.demos.refraction]
:depends-on #{:main}}
:demo-font {:entries [react-three-fiber.examples.demos.font]
:depends-on #{:main}}
:demo-mesh-line {:entries [react-three-fiber.examples.demos.mesh-line]
:depends-on #{:main}}
:demo-montage {:entries [react-three-fiber.examples.demos.montage]
:depends-on #{:main}}
:demo-svg-loader {:entries [react-three-fiber.examples.demos.svg-loader]
:depends-on #{:main}}
:demo-physics {:entries [react-three-fiber.examples.demos.physics]
:depends-on #{:main}}
:demo-gltf-planet {:entries [react-three-fiber.examples.demos.gltf-planet]
:depends-on #{:main}}
}}}}
10 changes: 10 additions & 0 deletions examples/src/app/react_three_fiber/examples/dev/preload.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns react-three-fiber.examples.dev.preload
(:require [helix.core]
[clojure.string :as string]))

(defn helix-display-name [name]
(let [[ns name] (string/split name #"/")
abbrev-ns (string/replace ns "react-three-fiber.examples." "~")]
(str name " " abbrev-ns)))

(set! helix.core/*display-name-hook* helix-display-name)

0 comments on commit eb5b81d

Please sign in to comment.