re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
pcj 2020-08-17T00:42:13.388600Z

Adding on, I take the same approach as manutter51. Sometimes I will even create a some-page directory that splits the subs, events, views, etc. into separate files if the page has a lot going on... like a dashboard with lots of widgets. But generally, a certain “fragment” of the application in my experience can contain everything (and probably should).

Casey 2020-08-17T08:21:25.391Z

In my event-fx registration, is it possible to use subscriptions to query the db? I don't need the reactivity of subs, but I don't want to duplicate the code in the sub query handler.

Casey 2020-08-17T08:23:16.392400Z

In particular the sub query I want to use itself is a layer 3 (materialised view) subscription, so I can't simply refactor out the body of the sub into a standalone function

sandbags 2020-08-17T12:57:24.394100Z

For creating a "production" version of my re-frame app I'm not at all clear what to do. I couldn't see a section in the docs on this. Ideally I'd like it to be packed into the smallest possible vessel, maybe even using something like Electron. Am I missing some docs?

p-himik 2020-08-17T13:13:35.395100Z

What you describe sounds completely orthogonal to re-frame. Re-frame is just a state management library, that's it.

sandbags 2020-08-17T13:47:09.395300Z

Eh? You use re-frame to build an app. You might argue "Why are you asking this here?" there's nothing specific about packaging up a re-frame based application — which would be fair enough. But I don't think the question itself is unreasonable. I ask here because I'm building the app with re-frame and I assume others are likewise and might give me some pointers for how they've distributed the release versions of their app.

2020-08-17T13:49:08.395600Z

@sandbags You may want to look at template like re-frame-template. It will create a scaffold re-frame application for you. That scaffold will supply dev and prod builds (read the docs provided).

sandbags 2020-08-17T13:49:36.395800Z

Ah, @mikethompson thank you. In fact I am based on that template but I hadn't appreciated it handled a prod build. I will take another look, thanks.

2020-08-17T13:50:49.396Z

As @p-himik pointed out, this is not really a re-frame issue. This is a build tool issue. Look towards shadow-cljs etc.

sandbags 2020-08-17T13:51:19.396200Z

Yes my lack of any recent JS/CLJS/Reagent use/experience is catching me out here. I was just hoping to tap the wisdom of people building apps with re-frame.

2020-08-17T13:51:32.396400Z

👍

p-himik 2020-08-17T13:52:20.396700Z

Build tool, yes, but also packaging. And deployment, assuming we're talking about a web app (although you mentioned Electron above, which is for desktop apps).

sandbags 2020-08-17T13:56:06.396900Z

This is an app built with re-frame but it's intended as a desktop app, hence why ultimately I might prefer to use something like Electron. But I haven't done this kind of stuff in ages (if at all) and am a bit at sea with all the options/frameworks/etc…

alpox 2020-08-17T15:31:34.397200Z

Maybe looking at some template would help to get some ideas when talking specifically at electron https://github.com/chimez/shadow-electron-re-frame-starter

sandbags 2020-08-17T15:42:02.397500Z

Thanks alpox. I saw that was wondering if it was still good after 2 years (so much moves so fast). I'll definitely give it a look now, thank you.

alpox 2020-08-17T15:43:24.397700Z

I did not try it lately so chances are that things changed but I would guess not by much. It should still help to get an idea.

sandbags 2020-08-17T15:45:41.397900Z

Is the use of 'electorn' rather than 'electron' whimsy/mispelling? Or is there something I should be aware of there do you think?

alpox 2020-08-17T15:47:07.398100Z

Thats a simple miss-spell. You install electron globally under the name "electron" npm install electron -g which also provides you with the cli-tool named electron

sandbags 2020-08-17T15:48:30.398300Z

Okay I figured as much but thought it wise to check. I've not really any knowledge of JS eco-system/Electron beyond the general.

alpox 2020-08-17T15:51:32.398500Z

If you run into questions concerning the JS ecosystem you can write me a PM - I'm still doing more in the JS ecosystem than Clojure due to my job. (But with Electron I did only some hobby-testing)

sandbags 2020-08-17T15:51:45.398700Z

Thanks alpox, that's very kind of you.

sandbags 2020-08-17T16:23:44.402900Z

The re-frame-template says to use lein release for a production build. Is that https://github.com/technomancy/lein-release ? This appears to be 10yr old and superceded by https://github.com/technomancy/lein-tar but is, in any case, complaining about my lack of gpg and something about not being able to sign a tag. That seems to be lein vcs at work. Looking at the docs for that I've passed --no-sign as an argument which stopped it complaining about that but now it errors with "On branch master. nothing to commit, working tree clean. java.lang.Exception: Couldn't commit. git exit code: 1" but, when I tried it with something to commit it was complaining that my working tree wasn't clean! Neither lein release or lein tar seem to mention anything about git in their docs so I am wondering if I am looking at the wrong thing?

sandbags 2020-08-18T08:53:48.410Z

@superstructor in this case somehow I was missing the :release alias in my project.clj and so something was happening but it's not clear what — in this case I think it was confusing

sandbags 2020-08-18T08:56:59.410200Z

but it might be a very rare case

superstructor 2020-08-18T09:18:59.410400Z

Thanks for the feedback @sandbags :thumbsup: I'll have to think about how to best mitigate it.

sandbags 2020-08-17T16:27:55.403500Z

Ah, is lein release actually a kind of alias for lein shadow release?

lilactown 2020-08-17T16:27:58.403800Z

@sandbags I believe it means literally type lein release have you tried that?

sandbags 2020-08-17T16:28:11.403900Z

Yes, that's the command I am running.

lilactown 2020-08-17T16:28:52.404200Z

and what happens when you run lein release?

lilactown 2020-08-17T16:30:07.404400Z

it was unclear from your message, since you started talking about some other things

sandbags 2020-08-17T16:30:14.404600Z

sandbags 2020-08-17T16:30:36.405Z

If I don't use --no-sign I get errors about gpg being missing and not being able to sign a git tag.

sandbags 2020-08-17T16:31:48.405200Z

lilactown 2020-08-17T16:31:52.405600Z

it sounds like you’ve modified your project.clj to add the vcs plugin

sandbags 2020-08-17T16:32:10.405800Z

Not as far as I know.

sandbags 2020-08-17T16:32:38.406Z

I've just searched my project.clj for any sign of it and I can't see it. I certainly didn't add it myself as this is the first I've heard of it.

lilactown 2020-08-17T16:32:45.406200Z

I just did this:

$ lein new re-frame foo
$ cd foo
$ lein release
and it downloaded all of the needed dependencies, built the app successfully

p-himik 2020-08-17T16:33:06.406400Z

Was about to write the same exact thing. :)

lilactown 2020-08-17T16:33:32.406600Z

@sandbags could you paste your project.clj?

sandbags 2020-08-17T16:34:27.406800Z

I'm running the same test as lilactown a second

lilactown 2020-08-17T16:34:28.407Z

after you’ve done that, I would ensure that you don’t have any lein profiles that are interfering. You can check that by looking in ~/.lein/profiles.clj

sandbags 2020-08-17T16:35:46.407200Z

Okay your test works here also.

sandbags 2020-08-17T16:37:54.407400Z

lilactown 2020-08-17T16:38:34.407800Z

your :aliases is missing the release alias that is present in the template

lilactown 2020-08-17T16:38:57.408Z

:aliases {"dev"          ["do"
                            ["shell" "echo" "\"DEPRECATED: Please use lein watch instead.\""]
                            ["watch"]]
            "watch"        ["with-profile" "dev" "do"
                            ["shadow" "watch" "app" "browser-test" "karma-test"]]

            "prod"         ["do"
                            ["shell" "echo" "\"DEPRECATED: Please use lein release instead.\""]
                            ["release"]]

            "release"      ["with-profile" "prod" "do"
                            ["shadow" "release" "app"]]

            "build-report" ["with-profile" "prod" "do"
                            ["shadow" "run" "shadow.cljs.build-report" "app" "target/build-report.html"]
                            ["shell" "open" "target/build-report.html"]]

            "karma"        ["do"
                            ["shell" "echo" "\"DEPRECATED: Please use lein ci instead.\""]
                            ["ci"]]
            "ci"           ["with-profile" "prod" "do"
                            ["shadow" "compile" "karma-test"]
                            ["shell" "karma" "start" "--single-run" "--reporters" "junit,dots"]]}

sandbags 2020-08-17T16:39:13.408200Z

Okay that's werid, I can't think of any reason why I would delete it. Most of the lein template is magic gibberish to me.

sandbags 2020-08-17T16:39:30.408400Z

Thanks for catching that though. I would never have thought that could happen.

sandbags 2020-08-17T16:40:36.408600Z

In fact I am missing also watch and ci

lilactown 2020-08-17T16:41:59.408800Z

maybe you used an older version? who knows

sandbags 2020-08-17T16:44:18.409Z

Hard to say, but I think this project was only started about 3 weeks ago

sandbags 2020-08-17T16:44:50.409200Z

That did the trick though, thanks lilactown. In absense of that definition who knows what it was running.

superstructor 2020-08-17T22:21:36.409400Z

Yep its an alias for lein shadow release. @sandbags

superstructor 2020-08-17T22:21:46.409600Z

Prehaps unfortunate naming if it is going to cause confusion.