clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
athomasoriginal 2020-09-14T02:40:28.474600Z

After reading the --watch argument for cljs.main/main it seems you can watch multiple directories if you separate them with a path-separator . As an example, this seems to work:

--watch "src:test"
Im not too familiar with pathSeparator , but it’s my understanding that the above path string separated using : would only work on mac and linux. iS this correct or would this work on windows as well?

Ed 2020-09-14T13:01:15.476200Z

it seems likely that you would need a ; on Windows, not a : . I would think it comes from the Java lib : https://docs.oracle.com/javase/8/docs/api/java/io/File.html#pathSeparatorChar

athomasoriginal 2020-09-14T14:11:46.476600Z

Yeah, that was my thought as well 😞

athomasoriginal 2020-09-14T14:12:29.476800Z

Anyone know the preferred way of specifying a system-independent path? or perhaps this is intended?

ghadi 2020-09-14T15:37:13.478Z

read about java.nio.Path

ghadi 2020-09-14T15:37:37.478200Z

lots of facilities in that

athomasoriginal 2020-09-14T19:04:21.483400Z

Sorry, I meant inside of a deps.edn file. Unless i’m missing your suggestion?

2020-09-14T22:08:14.483900Z

surely deps.edn is going to be using java to actually process the specified path

athomasoriginal 2020-09-14T22:25:19.484100Z

That sounds right, but I think my mental gap is I don’t know what that looks like to specify this in the deps.edn file. I will dig into this a bit.

2020-09-15T04:13:13.486400Z

It is not clear to me that there is a way to specify the command line args --watch "src:test" for Mac and Linux systems, but --watch "src;test" for Windows systems, from the same single deps.edn file.

2020-09-15T04:14:13.486600Z

Although if you use WSL on Windows, perhaps the : separator would work there as it does on Linux?

Ed 2020-09-16T08:45:30.498400Z

I guess you'd be able to use a different alias on windows vs *nix to set the command line args?

athomasoriginal 2020-09-16T12:31:03.004600Z

Yeah, looks like that might have to be the way. Upon re-reading the description again:

Specifies a system-dependent path-separated list of directories to watch
Sounds like it’s literally in the documentation that the path, should you choose this route, only works on specific systems.

2020-09-14T13:49:37.476500Z

Is there a tool or library (js or cljs) available which provides the MDN API so that it can be used interactively as when writing a web app? I would like to write this in cljs without having to wait until running the code inside the browser to get some feedback. Thanks for any comment.

victorvoid 2020-09-14T16:19:53.479600Z

Hello guys, I’m using lein fighwheel, but I have a config file with environment variables to dev and production, how can I setup my application to know when is DEV and get variables from dev ? in build time :thinking_face:

victorvoid 2020-09-14T16:22:59.479700Z

An autocomplete plugin for IDE to use (js/….) ?

valtteri 2020-09-14T16:32:15.480100Z

If your CLJS repl is connected to a browser you have all the API’s there behind js/...

valtteri 2020-09-14T16:35:04.480500Z

One way is to use :closure-defines compiler option https://cljs.github.io/api/compiler-options/closure-defines

valtteri 2020-09-14T16:37:07.480700Z

If I remember correctly lein can read your environment variables and pass them into :closure-defines

valtteri 2020-09-14T16:38:15.480900Z

Yeah, you something like this in project.clj :dbname ~(get (System/getenv) "DB_NAME")

victorvoid 2020-09-14T17:52:42.481700Z

Do you have an example project like this ? Because I tried to use clojure-defines but a have many variables in a file

valtteri 2020-09-14T18:12:02.482200Z

I think you have to name all the variables that you’re going to pass to :closure-defines . I’m sorry I don’t have any examples that reads closure-defines from env vars but I think you could achieve that by doing something like this https://github.com/lipas-liikuntapaikat/lipas/blob/master/webapp/project.clj#L165 but instead of hardcoding the value you put in something like this ~(get (System/getenv) "MY_ENV_VAR")

dpritchett 2020-09-14T18:49:11.483300Z

👋

2020-09-14T19:17:09.483700Z

Thanks @valtteri

mruzekw 2020-09-14T23:26:26.485500Z

Has anyone here worked with React Native and shadow-cljs and has successfully written platform-specific code? I wondering how it’s done since I don’t see a way to note which namespaces are for which platform

alidlorenzo 2020-09-14T23:56:55.485600Z

one way is to add custom reader conditionals: https://shadow-cljs.github.io/docs/UsersGuide.html#_conditional_reading though that only works with cljc files