This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-25
Channels
- # announcements (9)
- # asami (69)
- # babashka (151)
- # babashka-sci-dev (34)
- # beginners (90)
- # cider (21)
- # clj-on-windows (17)
- # clj-otel (4)
- # cljsrn (5)
- # clojure (27)
- # clojure-austin (3)
- # clojure-europe (87)
- # clojure-gamedev (1)
- # clojure-nl (3)
- # clojure-norway (8)
- # clojure-poland (2)
- # clojure-uk (3)
- # clojured (10)
- # clojurescript (50)
- # core-async (73)
- # cursive (28)
- # data-science (2)
- # datomic (17)
- # etaoin (1)
- # honeysql (6)
- # introduce-yourself (3)
- # jobs (1)
- # joyride (12)
- # malli (5)
- # nbb (14)
- # off-topic (18)
- # pathom (4)
- # podcasts-discuss (2)
- # polylith (30)
- # project-updates (3)
- # re-frame (33)
- # reitit (1)
- # remote-jobs (13)
- # shadow-cljs (59)
- # sql (12)
- # tools-build (7)
- # xtdb (36)
I’ve multiple node scripts file. Is it possible to define one build target instead for all of them? https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-script
My use case I don’t care about the final output of the script files. I just want to play with the scripts in a repl. And I’d like to define only one build target for all of the scripts.
Hmm :thinking_face: unless I’m misunderstanding, does specifying multiple build profiles to shadow-cljs not work for you?
e.g. npx shadow-cljs watch :lib/dev :test
👆 this allows me to connect to a repl that allows me to play around in namespaces in both builds
Though, my builds are of node-library
targets and I’m using Calva to automate the repl-jack-in process
https://github.com/sansarip/owlbear/blob/main/shadow-cljs.edn
It would be desired that I am able to not specify the cljs file names in the build target.
Just specify your :source-paths
e.g. ["dev" "src/cljc" "src/cljs"]
and then you should be able to just specify a build with either :node-library
or :node-script
as the target. Doesn’t really matter, because you don’t care about the output file.
Then, npx shadow-cljs watch :<your build name>
which will start an nrepl you’ll be able to remotely connect to.
Once your cljs files have finished compiling, you’ll also [probably need] to run node -e "require('<path to your output file>')"
which will give your repl a Node environment to execute in
For example, for taget :node-script
, I have to specify the :main
key, which points to a single script. Thus, for every script, I have to have a build target separately.
Hi @U022T96EFV3 Where you are developing your vscode extension, do you get any code completion support (assume you are using calva)?
@UGC0NEP4Y npx shadow-cljs node-repl
just gives you a node REPL. not tied to any build, you can load any namespace you want in there?
> Hi @U022T96EFV3 Where you are developing your vscode extension, do you get any code completion support (assume you are using calva)? Yup, I do get code completion support from Calva!
Hi. I'm trying to build a cljs app targeting expo wrapped react-native with shadow-cljs. I was able to follow the instructions in the guide to stand up an app scaffold that renders a basic view on the phone using cljs and the Rum react wrapper, but I'm having trouble accessing some js dependencies I have installed. I added the "react-native-vision-camera" library with the expo install react-native-vision-camera
command, and I've verified that the library was both added to the package.json and yarn.lock, and that there is a directory corresponding to that library within node_modules. I can't seem to require this library at all from cljs land though. I get null pointer errors during app startup when I try to add the dependency to the ns :require
clause.
When I also try to require it from the repl like this (require '["react-native-vision-camera" :as vision])
, the vision object is nil
always. I have also tried to install another dependency, "react-native-gifted-chat", in the same way to verify it wasn't something wrong with that particular dependency, and that also doesn't seem to work.
I can require dependencies that were already in package.json after generating the app scaffold like "react" and "react-native" however, so I can load things in node_modules; it just doesn't seem like shadow has access to js/expo dependencies I have added after the fact. There must be something I'm missing about the dependency install process, and that there's more to do besides expo install react-native-vision-camera
or yarn add react-native-vision-camera
from the shell, but I can't seem to pinpoint what I've done wrong or what I'm missing from the guides.
Does anyone have any hints on how to add an external js/react-native/expo dependency to a shadow app targeting react-native so that it can be accessed from cljs code?
@zonotope JS dependencies in a react-native REPL cannot be required dynamically in the REPL if they haven't been included in the build otherwise before. JS dependencies are processed by metro which only sees the regular build output not the REPL.
Thanks for your help, and sorry for the late reply, but I was focused on my day job for a bit there 😉. I think this has something to do with errors from the camera library that prevented the rest of the app from loading. Those errors are because this library must be natively built.
It looks like the only native compilation option here is expo's eas build tool. I'm running into another configuration issue there because eas generates an android working directory to compile for that platform with gradle, and it isn't copying over my app directory or app/index js where it should be relative to the android working directory.
error The resource `/tmp/zonotope/eas-build-local-nodejs/5e63e06b-13cb-49a3-a597-aa44d97d5090/build/android/app/index.js` was not found.
`and i think i figured out that error at least. my app/
directory was in my .gitignore, and eas doesn't transfer any files in .gitignore. i'll bet there's a build hook i can add in to eas to generate the app directory with shadow instead of copying it, but i'll figure that out later since this works for now.
how did you require it in your code? and do you have an example of how you are supposed to include it in JS?
------------------------------------------------------------------------------
WARNING: shadow-cljs not installed in project.
See
------------------------------------------------------------------------------
any way to get rid of this warning?I just want the warning to go away
there's really no need in my use case
(multiple projects in a mono-repo with pnpm)
because shadow-cljs is installed in the parent project
doesn't need to be installed in the sub-project
pnpm works differently
it reuses node_module
the reason it is warning is that the shadow-cljs dependency also brings in other stay that may be required. eg. for node builds ws
or for browser build node-libs-browser
anyhow
is there a way to shut the warning?
too many people didn't install it in the project and kept asking questions why things fail 😛
ok haha
it's not a problem per se, just a bit annoying in my case
still don't understand what your setup is though. where do you control which shadow-cljs version is used?
all it is looking for is shadow-cljs installed in the package.json in the dir shadow-cljs is run in
I installed it in the sub-project too
no more warning 🙂
thanks for your generosity
I pulled the example todo https://github.com/markokocic/rn-native-base-example-todo and have the shadow dev build running. It seems currently like I make changes, shadow updates it instant and then react native automatically refresh the app afterwards - and this auto refreshing I want to disable obviously
sorry I don't use react-native. don't know how you turn it off, but it needs to be turned off on the react-native/metro side. nothing in shadow-cljs can control this.