Fork me on GitHub
#polylith
<
2022-02-25
>
dharrigan08:02:57

I'm revisiting this project after a year of last looking at it (29th March, if I recall 馃檪 )

dharrigan09:02:10

I'm about to start on a new project and I was going to see if I could use polylith and see how it works out for me. One thing I want to retouch again and is important, is the use of a "dependency" library (the one I prefer is juxt Clip). In that, I can "wire" together various things (like database connections, redis connections, and configuration for jetty/ring and so on and so forth). I was wondering then, would the idea be to have the -main that initialises juxt clip in a component? Does anyone have any prior insight/experience of using clip (or mount, or integrant) with Polylith and an approach I could learn from?

furkan3ayraktar09:02:31

Hi @U11EL3P9U! I haven鈥檛 heard Clip before so I can鈥檛 comment on that. I know some people uses Stuart Sierra鈥檚 Component with Polylith. We use mount in our project at work. We have states in several components that fetch configuration from AWS Systems manager when they get initialised, so we do not have config files around. Mount states depend on each other by just requiring a state from another namespace, which goes well with Polylith鈥檚 idea in my opinion. However, I haven鈥檛 actually used other options like Integrant or Component in a real project to say mount is better or worse. You can have a look at https://app.slack.com/client/T03RZGPFR/C013B7MQHJQ/thread/C013B7MQHJQ-1636972221.236800 and also check out @U04V70XH6鈥檚 https://github.com/seancorfield/usermanager-example/tree/polylith to see how you could use Component in a project.

馃憦 1
dharrigan09:02:25

Thank you. I'm currently experimenting with integrating Juxt Clip in a fresh example project to see how it might work. Let's see what happens!

馃憤 1
dharrigan09:02:26

I suppose (not related to clip per se), but a -main being a public API should go into base?

furkan3ayraktar09:02:54

Exactly, external/public API鈥檚 should go into bases

dharrigan09:02:07

I think I have the info I need 馃檪

furkan3ayraktar09:02:39

I think Component users initialise their state in the bases as well.

dharrigan11:02:24

Well, got it to work with Juxt Clip

dharrigan11:02:29

pretty straight-forward

furkan3ayraktar12:02:24

If you have a public repo, it would be nice to share with the rest of the world! 馃挭

dharrigan12:02:36

I could do 馃檪 I want to redo it, and tidy things up.

dharrigan12:02:56

Going to ask a question in the main channel...

dharrigan12:02:09

So, got a little example running that uses juxt cilp to inject certain things (like db connection etc). I've noticed, and this most likely already answered, there is duplication in the deps.edn. So, in my dev alias in the workspace, I had to relist all the reitit dependencies that are also listed in the bases/rest-api/deps.edn file. This seems also to be the case (which I used as a basis for reference) in (thanks @furkan3ayraktar). Is this just a given of how this all works?

furkan3ayraktar13:02:22

Duplication of dependencies only necessary in case you are using Cursive IDE (https://github.com/cursive-ide/cursive/issues/2554). It鈥檚 also mentioned https://polylith.gitbook.io/poly/workflow/testing#how-tests-are-executed in the documentation.

dharrigan13:02:51

Interesting. I don't use that (I use vim + conjure). Will read and digest.

dharrigan13:02:55

Ah right, so in my workspace deps.edn, I can reference, for example, {:extra-deps {bases/rest-api {local/root "bases/rest-api"}}}}

dharrigan13:02:01

and it will pull in those deps

imre16:02:39

Hey folks, is there any nicer way of getting a projects classpath (from the command line) than cd-ing to its subfolder and using the clojure cli?

furkan3ayraktar08:02:41

Hi! There is no command for that in the poly CLI at the moment. What is your use case for this? If we can justify it, we can add a new command for this. It wouldn鈥檛 be too hard to include it in the CLI tool since we have the code for calculating the classpath for the tests already in the workspace.

imre09:02:47

the main input to that is a classpath

imre09:02:23

I figured it wouldn't be too far from what's already available

imre09:02:21

Should I open a github issue?

imre09:02:15

Also, while I'm here asking questions, how difficult you think it would be to add a command to poly CLI that returns the commits that affect a project? We're trying to figure out how we could keep https://clojurians.slack.com/archives/C013B7MQHJQ/p1645449050736409 for our projects once they are migrated

furkan3ayraktar11:02:24

Yeah, you can open a Github issue.

furkan3ayraktar11:02:56

For the latter, I鈥檓 not sure but @U1G0HH87L could answer that better. If we have it somewhere in the code, maybe we can include it in the workspace map, so that you can extract from there. I think, a separate command for this could be to much for poly tool, however, that鈥檚 just my opinion. Also, @U1G0HH87L is playing with letting users of poly CLI to add their own commands to the tool. Once that happens, this could be something you can add easily, as long as it鈥檚 in the workspace map.

tengstrand12:02:09

While waiting for custom commands to be implemented, you can create an alias in your workspace and include the the polylith repo, see how :extra-deps is included https://github.com/polyfy/polylith/blob/4189a30782f1ed21aa1fb55e50355bd862e4b339/examples/doc-example/deps.edn#L27 + your own code that uses the poly code to read the workspace. The workspace contains which bricks a project contains, e.g. projects:poly:component-names:src. Based on that information and the bricks, you should be able to implement this yourself (with support from me, if needed) @U08BJGV6E.

imre12:02:13

Thank you both!