Fork me on GitHub
#clojurescript
<
2022-12-01
>
lread18:12:04

I've no clue, trying the #C1DV21X9P channel might be worth a shot

Per Nissilä17:12:24

Hi! I’m trying to convert javascript-objects to cljs objects with js->clj but it does not seem to work. In my ns-declaration i have the following

(:require ["@smooth-ui/core-sc" :refer [theme]])
Then i’m trying to convert it to clj with
(js->clj theme)
but all i get back is #object[Object] and i cannot use it as a clojure map. I also tried adding :keywordize-keys true to js->clj. What am i doing wrong? 🙂

p-himik17:12:05

The theme object is probably not just a plain JS object but rather of some custom type. By default, custom types are ignored by js->clj.

p-himik17:12:47

If you need to simply get a few fields from that object, you should use JS interop. If you really need to convert the whole object into a map, you can always iterate over its keys and do it manually.

skylize17:12:30

Did you notice this? > Warning This project is deprecated and no longer maintained. > -- https://github.com/smooth-code/smooth-ui I was going to compare what you are doing to how it is intended to be used in JS. But the readme offers no hints, and the documentation (https://smooth-ui.smooth-code.com/open-source/smooth-ui/docs/) is a 404.

Olaleye Blessing19:12:36

I have a phoenix-cljs project. I get this error from app_name\assets\node_modules\.bin\shadow-cljs:2 each time I start my phoenix server:

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
I'm on windows 10

thheller19:12:41

that file is create by npm not shadow-cljs

Olaleye Blessing19:12:42

Yea. Do you know how I can fix it?

thheller19:12:29

how are you using it in the first place?

thheller19:12:48

I'm guessing you installed the npm packages via wsl? but run via windows?

Olaleye Blessing19:12:10

No, I installed the packages on windows and ran via windows

thheller19:12:09

how are you using it? how do you run shadow-cljs? normally this file isn't used

Olaleye Blessing04:12:59

This is my folder structure.

Olaleye Blessing04:12:07

shadow-cljs.edn file

{:source-paths
 ["src"]

 :dependencies
 []

 :builds
 {:app {:output-dir "../priv/static/js"
        :asset-path "/js",
        :target :browser
        :modules {:app {:init-fn app.main/init!}}
        :devtools {:before-load app.main/stop!
                   :after-load app.main/reload!}}
  :test {:target :karma
         :output-to "../priv/static/test.js"
         :ns-regexp "-test$"
         :autorun true}}}
config/dev.exs
node: [
      "node_modules/.bin/shadow-cljs",
      "watch",
      "app",
      cd: Path.expand("../assets", __DIR__)
    ],

thheller06:12:50

so why are you calling that file when you know it doesn't work?

thheller06:12:04

the normal command you are supposed to run is npx shadow-cljs watch app

thheller06:12:19

I can't tell you how to translate that to that config

thheller06:12:27

but its not that

thheller06:12:26

if you must call node directly you can also just use node_modules/shadow-cljs/cli/runner.js since that is the main script

thheller06:12:52

node: [
      "node_modules/shadow-cljs/cli/runner.js",
      "watch",
      "app",
      cd: Path.expand("../assets", __DIR__)
    ],
I guess

Olaleye Blessing07:12:30

Thanks very much, I'll try out your advice when I'm with my PC. Thanks

Olaleye Blessing22:12:25

node_modules/shadow-cljs/cli/runner.js solves my issue, thank you.