Fork me on GitHub
#clojurescript
<
2020-09-14
>
athomasoriginal02:09:28

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?

Ed13:09:15

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

athomasoriginal14:09:46

Yeah, that was my thought as well 😞

athomasoriginal14:09:29

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

ghadi15:09:13

read about java.nio.Path

ghadi15:09:37

lots of facilities in that

athomasoriginal19:09:21

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

noisesmith22:09:14

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

athomasoriginal22:09:19

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.

andy.fingerhut04:09:13

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.

andy.fingerhut04:09:13

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

Ed08:09:30

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

athomasoriginal12:09:03

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.

kingcode13:09:37

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.

victorvoid16:09:59

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

valtteri16:09:15

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

victorvoid16:09:53

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:

valtteri16:09:04

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

valtteri16:09:07

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

valtteri16:09:15

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

victorvoid17:09:42

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

valtteri18:09:02

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")

mruzekw23:09:26

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

Aleed23:09:55

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

thheller06:09:41

is another way