Fork me on GitHub
#shadow-cljs
<
2020-07-08
>
thheller09:07:10

@mel.collins I removed the forced override in master. will probably make a release later.

cfleming09:07:52

I’ve got my build into a state where whenever I restart it, I get a message: server pid exists but server appears to be dead, proceeding without server, and then my build hangs when compiling. Is there an easy way to just reset everything and force a clean build?

thheller09:07:39

@cfleming unlikely that fixes anything but you can delete .shadow-cljs/builds. does it actually hang completely? does it max out cpu?

thheller09:07:23

I've had weird reports of "hangs" when using incompatible core.async versions? did you maybe change versions?

cfleming09:07:20

No, I’m not using core.async (well, some of the machinery via promesa, but not directly)

thheller09:07:41

check for dependency conflicts in case you are using project.clj/deps.edn

cfleming09:07:13

Ok, I’ll do that. I’m using a project.clj but perhaps I should just switch to a pom.

thheller09:07:23

or maybe a macro going wild 😛

thheller09:07:37

doesn't really matter what you use if its not shadow-cljs.edn

cfleming09:07:41

Deleting that didn’t seem to help.

cfleming10:07:06

Where does it find the pid? Can I delete that?

thheller10:07:15

since only shadow-cljs.edn can somewhat ensure you get the correct deps

thheller10:07:36

pid doesn't matter. it is just telling you that the server probably did shut down cleanly

thheller10:07:46

.shadow-cljs/server.pid but that doesn't mean anything

cfleming10:07:52

So I should implement direct shadow importing, is what you’re saying 😛

cfleming10:07:17

Ok, I’ll look - I don’t think I’ve changed anything along those lines.

thheller10:07:44

hehe. its fine to use the others. just need to ensure you get the correct deps manually and dependency issues are the most common problem people run into

thheller10:07:56

since we must get the correct mix of dependencies or things break 😞

thheller10:07:20

usually they fail on start, sometimes they fail in weirder ways 😞

thheller10:07:53

also shadow-cljs compile app --verbose might help

thheller10:07:57

see where it gets stuck

cfleming10:07:34

~/d/c/lambda (licence-panel)> shadow-cljs compile local --verbose
shadow-cljs - server pid exists but server appears to be dead, proceeding without server.
shadow-cljs - config: /Users/colin/dev/cursive-site/lambda/shadow-cljs.edn  cli version: 2.8.77  node: v12.1.0
[:local] Compiling ...
-> build target: :node-script stage: :configure
<- build target: :node-script stage: :configure (5 ms)
-> Resolving Module: :main
<- Resolving Module: :main (43 ms)
-> build target: :node-script stage: :compile-prepare
<- build target: :node-script stage: :compile-prepare (0 ms)
-> Closure JS Cache read: 63 JS files
<- Closure JS Cache read: 63 JS files (87 ms)
-> Cache read: cljs/core.cljs
<- Cache read: cljs/core.cljs (73 ms)
-> Cache read: clojure/string.cljs
-> Cache read: cljs/tools/reader/impl/inspect.cljs
-> Cache read: applied_science/js_interop/impl.cljs
<- Cache read: cljs/tools/reader/impl/inspect.cljs (34 ms)
<- Cache read: applied_science/js_interop/impl.cljs (178 ms)
<- Cache read: clojure/string.cljs (178 ms)
-> Cache read: cljs/tools/reader/impl/utils.cljs
-> Cache read: applied_science/js_interop.cljs
<- Cache read: cljs/tools/reader/impl/utils.cljs (6 ms)
-> Cache read: cljs/nodejs.cljs
<- Cache read: applied_science/js_interop.cljs (9 ms)
-> Cache read: lambda/credentials.cljs
<- Cache read: cljs/nodejs.cljs (5 ms)
-> Cache read: promesa/protocols.cljc
-> Cache read: cljs/tools/reader/reader_types.cljs
<- Cache read: lambda/credentials.cljs (6 ms)
-> Cache read: promesa/util.cljc
<- Cache read: promesa/protocols.cljc (7 ms)
<- Cache read: cljs/tools/reader/reader_types.cljs (8 ms)
<- Cache read: promesa/util.cljc (6 ms)
-> Cache read: cljs/tools/reader/impl/errors.cljs
-> Cache read: promesa/exec.cljc
<- Cache read: promesa/exec.cljc (6 ms)
-> Cache read: cljs_bean/from/cljs/core.cljs
<- Cache read: cljs/tools/reader/impl/errors.cljs (8 ms)
-> Cache read: promesa/impl.cljc
-> Cache read: cljs/tools/reader/impl/commons.cljs
<- Cache read: cljs_bean/from/cljs/core.cljs (6 ms)
-> Cache read: cljs_bean/core.cljs
<- Cache read: promesa/impl.cljc (6 ms)
-> Cache read: lambda/licence.cljs
<- Cache read: cljs/tools/reader/impl/commons.cljs (6 ms)
-> Cache read: clojure/set.cljs
-> Cache read: promesa/core.cljc
<- Cache read: cljs_bean/core.cljs (7 ms)
-> Cache read: lambda/dynamo/util.cljs
<- Cache read: lambda/licence.cljs (6 ms)
-> Cache read: clojure/walk.cljs
-> Cache read: cljs/tools/reader.cljs
<- Cache read: clojure/set.cljs (6 ms)
<- Cache read: lambda/dynamo/util.cljs (7 ms)
<- Cache read: promesa/core.cljc (459 ms)
-> Cache read: lambda/util.cljs
<- Cache read: cljs/tools/reader.cljs (466 ms)
<- Cache read: clojure/walk.cljs (467 ms)
<- Cache read: lambda/util.cljs (7 ms)
-> Cache read: cljs/tools/reader/edn.cljs
-> Cache read: lambda/dynamo/expr.cljs
-> Cache read: lambda/dynamo/response.cljs
-> Cache read: lambda/pricing.cljs
<- Cache read: cljs/tools/reader/edn.cljs (10 ms)
<- Cache read: lambda/dynamo/expr.cljs (9 ms)
-> Cache read: cljs_time/internal/core.cljs
<- Cache read: lambda/pricing.cljs (8 ms)
<- Cache read: lambda/dynamo/response.cljs (10 ms)
-> Cache read: cljs/reader.cljs
-> Cache read: lambda/dynamo/request.cljs
<- Cache read: cljs_time/internal/core.cljs (7 ms)
-> Cache read: cljs_time/core.cljs
<- Cache read: cljs_time/core.cljs (15 ms)
<- Cache read: lambda/dynamo/request.cljs (21 ms)
<- Cache read: cljs/reader.cljs (23 ms)
-> Cache read: lambda/kms.cljs
-> Cache read: lambda/email.cljs
-> Cache read: lambda/dynamo.cljs
-> Cache read: cljs_time/format.cljs
<- Cache read: lambda/kms.cljs (7 ms)
-> Cache read: clojure/edn.cljs
<- Cache read: lambda/email.cljs (10 ms)
<- Cache read: lambda/dynamo.cljs (10 ms)
-> Cache read: hiccups/runtime.cljs
-> Cache read: lambda/buy.cljs
<- Cache read: clojure/edn.cljs (10 ms)
<- Cache read: hiccups/runtime.cljs (8 ms)
<- Cache read: cljs_time/format.cljs (15 ms)
-> Cache read: lambda/webhook.cljs
-> Cache read: lambda/renew.cljs
-> Cache read: lambda/quote_email.cljs
<- Cache read: lambda/buy.cljs (11 ms)
-> Cache read: lambda/tables.cljs
-> Compile CLJS: lambda/email_content.cljs
-> Cache read: cljs_time/coerce.cljs
<- Cache read: lambda/tables.cljs (13 ms)
<- Cache read: lambda/renew.cljs (183 ms)
<- Cache read: cljs_time/coerce.cljs (181 ms)
<- Cache read: lambda/webhook.cljs (185 ms)
<- Cache read: lambda/quote_email.cljs (184 ms)
-> Cache read: lambda/quote.cljs
<- Cache read: lambda/quote.cljs (13 ms)

cfleming10:07:49

quote.cljs hasn’t changed, I’d suspect email_content.cljs the most, but that seems to have compiled ok.

thheller10:07:23

-> Compile CLJS: lambda/email_content.cljs means it started doing something

thheller10:07:30

<- means it finished

thheller10:07:57

so that never seems to finish. does it abort after 30sec timeout?

thheller10:07:18

there is a guard on the thread pool. in case it makes no progress for 30sec it should abort

thheller10:07:27

quote was just loaded from cache and finished so thats not the issue

cfleming11:07:28

No, no timeout after 30 seconds, and it Activity Monitor is still showing the Java process using CPU.

cfleming11:07:35

At least I know where to look now, thanks!

cfleming11:07:09

Yeah, I have some problem with a macro there - I should be able to track that down, thanks!

pmooser15:07:16

If someone is using shadow-cljs + deps, what's the normal way to package something as a library?

pmooser15:07:24

I see the docs regarding leiningen ...

pmooser15:07:53

Trying to use something like depstar results in a jar that's 34mb. Heh.

dpsutton15:07:17

what's in the jar?

pmooser15:07:53

Everything you can imagine of every kind of dependency. It's just an uberjar. So it has compiled clj .class files etc.

pmooser15:07:35

I assume there must be common ways people do this stuff, but this deployment piece of the deps ecosystem sucks a little bit.

pmooser15:07:41

Maybe I'm answering the wrong question - I have the impression that the cljs library should just literally contain the .cljs files (or .cljc) as well as its dependency info.

slimslenderslacks15:07:18

Ya, like if you're packaging your cljs/cljc files for other shadow-cljs projects to use. I've been using pack.pack-alpha for that

slimslenderslacks15:07:49

;; jar creation from juxt
  :pack {:extra-deps {pack/pack.alpha {:git/url ""
                                       :sha "d9023b24c3d589ba6ebc66c5a25c0826ed28ead5"}}
         :main-opts ["-m" "mach.pack.alpha.skinny" "--no-libs" "--project-path" "api-cljs.jar"]}

slimslenderslacks15:07:28

(but this is not an uberjar)

slimslenderslacks15:07:25

and possibly you can share your .cljs/cljc files via :git/url and not use a jar at all.

pmooser15:07:56

@slimslenderslacks Thank you - I just happened to run across a cljs library packaged just like that. Awesome!

slimslenderslacks15:07:24

Ya, it's quite nice when you first realize that you might not need a jar at all - strange feeling

pmooser15:07:15

Yeah that is blowing my mind a little bit. I still can't quite wrap my head around it.

pmooser15:07:35

What exactly does --no-libs do?

slimslenderslacks15:07:21

I think it's kind of "don't make an uber jar"

pmooser15:07:58

I wonder what I'm doing wrong. Pack worked perfectly fine (I think) but when I run shadow-cljs and depend on these things directly (whereas before I was using them as local artifacts) I get a bunch of provide conflicts.

pmooser16:07:55

So I think the problem was, pack was including my old js build products. However, when I clean those up and make a new minimal jar, shadow-cljs can't find the classes in it, or says effectively "required namespace x.y.z is not available".

pmooser16:07:04

So something about how I'm packaging it with pack is wrong for shadow-cljs.

thheller17:07:33

@pmooser I don't know anything about pack or anything deps.edn packaging related for that matter. I just use lein since it is by far the easiest and straightforward.

thheller17:07:00

you .jar file should only contain the relevant sources. you can check via jar -tvf your.jar whats in it.

pmooser17:07:22

Yes, I understand, I don't use lein anymore, but what I'm a little more interested in is, how would you debug the issue of shadow-cljs saying something isn't available? I can unpack the jar and look in it ... what does shadow-cljs expect to see, for just a normal cljs library? What directory layout?

pmooser17:07:16

Yeah, my namespace hierarchy is basically foo.bar.baz/file.cljs and if unpack the jar, I see directories foo/bar/baz/file.cljs ...

pmooser17:07:30

I'm just not sure if there's something else or another level of structure that shadow-cljs expects to see, or what.

thheller17:07:18

please give concrete examples ... the filename must match the ns ... that is it. like any other clojure(script) lib or tool. nothing special regarding shadow-cljs.

thheller17:07:46

foo.bar.baz/file.cljs is not valid so please don't add confusing examples.

pmooser17:07:08

Hold on, let me find "real" names and replace proprietary components.

pmooser17:07:36

The error is like:

pmooser17:07:42

The required namespace "jett.hyperbase.client" is not available, it was required by "jett/hypercell/actions.cljs".

pmooser17:07:50

And if I unpack the jar of the library, it looks like:

thheller17:07:56

so there should be a jett/hyberbase/clients.cljs in the jar

thheller17:07:15

please use jar -tvf. I don't care about the unpacked result.

pmooser17:07:15

(yes, it's there)

thheller17:07:43

nothing ever unpacks the .jar during compilation

pmooser17:07:46

0 Wed Jul 08 18:49:46 CEST 2020 jett/hyperbase/
     0 Wed Jul 08 18:49:46 CEST 2020 jett/
 11489 Fri Jun 26 00:13:24 CEST 2020 jett/hyperbase/core.clj
   484 Mon May 04 11:56:40 CEST 2020 jett/hyperbase/transit.clj
   378 Mon May 18 19:47:00 CEST 2020 dev.clj
  5419 Fri Jun 05 11:57:08 CEST 2020 jett/hyperbase/order_util.cljc
  6375 Tue Jun 02 09:44:34 CEST 2020 jett/hyperbase/id_util.cljc
     0 Wed Jul 08 18:49:46 CEST 2020 jett/gavel/
  1612 Fri May 08 13:05:20 CEST 2020 jett/gavel/core.cljs
  5526 Thu Jun 11 13:06:34 CEST 2020 jett/gavel/message_center.cljs
 10888 Mon Jun 08 19:26:02 CEST 2020 jett/hyperbase/sample_application.cljs
   549 Mon Apr 20 10:26:56 CEST 2020 jett/hyperbase/diff.cljs
   403 Mon Jun 08 19:25:30 CEST 2020 jett/hyperbase/util.cljs
 21608 Mon Jul 06 15:47:08 CEST 2020 jett/hyperbase/itom.cljs
 16470 Fri Jun 26 14:36:42 CEST 2020 jett/hyperbase/client.cljs
   979 Wed Jun 17 12:20:18 CEST 2020 jett/hyperbase/ui.cljs
  5338 Tue Jun 09 13:00:06 CEST 2020 jett/hyperbase/core.cljs
   576 Wed May 13 12:14:12 CEST 2020 jett/hyperbase/user.cljs
     0 Wed Jul 08 18:49:46 CEST 2020 web/
   240 Tue Apr 07 17:34:08 CEST 2020 web/index.html
     0 Wed Jul 08 18:49:46 CEST 2020 web/css/
  7313 Mon May 18 12:06:08 CEST 2020 web/css/site.css

thheller17:07:21

ok the dev.clj and web/ files probably shouldn't be in there but otherwise the file seems to be present?

pmooser17:07:36

Yes, I knew the web and dev things aren't useful but I couldn't figure out how they would be harmful.

thheller17:07:48

and that jar is part of your dependencies?

thheller17:07:58

I mean it needs to be on the classpath to be found?

pmooser17:07:02

Yes, the jar is in my deps.edn.

thheller17:07:43

and you restarted shadow after adding it?

pmooser17:07:27

Yes, several times.

pmooser17:07:50

I can depend on this stuff if I use local coordinates or git coordinates (in deps)

pmooser17:07:03

It's just something about I'm packaging the library that must be messed up.

pmooser17:07:24

In any case, it sounds like from your point of view, it looks correctly structured, so I'm not sure we should take more of your time trying to figure it out.

thheller17:07:10

try shadow-cljs clj-repl and ( "jett/hyperbase/client.cljs")

thheller17:07:45

if thats not nil maybe the file is corrupted in some way?

pmooser17:07:06

Ok, let me try.

thheller17:07:22

try (slurp *1) and see if there are some funky chars in the beginning.

pmooser17:07:31

It returns nil. So presumably it doesn't find it.

thheller17:07:28

yeah but thats not shadow-cljs trying to find it. thats the JVM. so something is wrong with either your dependency on being on the classpath or the .jar itself

pmooser17:07:04

Ok, I'm sure it's the jar. I'll take a look. Thank you for your help!

thheller17:07:30

if jar -tvf works that the jar seems to be valid

pmooser17:07:06

I don't see any manifest information in the jar, but I'm not sure what exactly is supposed to be there.

pmooser17:07:08

I'm not doing anything especially weird with pack, but maybe there's another argument I'm supposed to use. And to be clear, I don't care about pack. I just am trying to figure out the right way to package a cljs library using deps. We used to do this with lein trivially all the time and deploy to an internal maven server. I just can't quite figure out how to build an artifact with deps that works along with shadow-cljs.

pmooser17:07:12

(or probably anything else)

thheller17:07:15

all I can say is ... just use lein. even if its just to bundle stuff. I cannot help you with anything deps.edn related since I have not used anything.

thheller17:07:36

shadow-cljs requires absolutely nothing special from the bundling and is not involved in it in any way

pmooser17:07:12

Sure, maybe I will go that route. Thank you again.

thheller17:07:33

whatever you are doing is also wrong with any other tool. it has nothing to do with shadow-cljs.

pmooser18:07:51

For packaging a library, there aren't even supposed to be any build products from shadow-cljs or anything in it right?

lilactown18:07:25

libraries just have cljs files in it, no compiled artifacts

lilactown18:07:36

for my libs, I do use lein just for that. I would reach out to whatever deps.edn script you’re using if you want help with releasing a CLJS lib

pmooser18:07:53

Ok, thanks.

slimslenderslacks18:07:29

hey @pmooser, did you deploy that jar to clojars or something? Or are you depending on it using something like {:local/root "/path/to/your.jar"}? Your setup sounds the same as mine so I'm also really wondering what's going wrong 🙂

slimslenderslacks18:07:31

certainly not a bad idea to switch to lein, but in my experience, what you're trying to do does work. There was no pom.xml in the unpacked jar. So it doesn't have any transitive dependencies?

pmooser05:07:48

Sorry it took me a bit to respond to this. So I got it working with lein - I'm deploying to an internal maven repository - and I don't quite understand why pack.alpha doesn't have any manifest information.

pmooser05:07:03

So that seems to be the fundamental problem - the code is all included, but nothing about about to find the code or map it to source directories, etc.

pmooser05:07:40

To be honest, I'm not very expert at maven or any build tools - I mostly haven't had to be, using leiningen for a decade - so I'm not quite sure what pack is doing. I'd like to figure it out, though, and if I do, I will certainly keep you updated.

slimslenderslacks21:07:05

@pmooser Ya, I looked a bit more at my configuration, and the pom.xml really is a key component of how this works - I should've mentioned this to you when we first started this thread. This link is useful: https://github.com/juxt/pack.alpha#uploading-to-clojars-or-maven Part of the process involves keeping a pom.xml up to date (including updating the version in the pom.xml).