This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-28
Channels
- # aleph (4)
- # announcements (5)
- # babashka (28)
- # babashka-sci-dev (13)
- # beginners (63)
- # calva (76)
- # cider (113)
- # clara (7)
- # clj-kondo (42)
- # cljdoc (1)
- # clojure (170)
- # clojure-europe (20)
- # clojure-nl (17)
- # clojure-norway (3)
- # clojure-spec (12)
- # clojure-sweden (1)
- # clojure-uk (6)
- # clojurescript (55)
- # clojureverse-ops (1)
- # consulting (1)
- # core-async (9)
- # cursive (16)
- # data-science (1)
- # datascript (8)
- # datomic (27)
- # emacs (14)
- # events (1)
- # fulcro (10)
- # graphql (9)
- # gratitude (1)
- # jobs (6)
- # jobs-discuss (5)
- # leiningen (10)
- # lsp (35)
- # missionary (4)
- # nextjournal (9)
- # off-topic (46)
- # pathom (15)
- # pedestal (5)
- # polylith (37)
- # portal (15)
- # re-frame (22)
- # reagent (4)
- # reitit (5)
- # reveal (18)
- # shadow-cljs (20)
- # tools-deps (7)
- # xtdb (10)
I’ve been converting some projects to use polylith and am appreciating the approach. What’s the recommended way of running things like clj-kondo or cloverage?
I have the same question :) Another example: running outdated checks (antq) or known vulnerabilities scanning (nvd).
Here's the script we use to run antq
over our monorepo -- for both legacy subprojects and for the bases
, components
, and projects
in the migrated-to-Polylith piece:
#!/bin/sh
root=/var/www/worldsingles
cd ${root}/clojure
echo '| Dependency | Current | Latest |'
${root}/build/clojure/bin/clojure -Sdeps '{:deps {antq/antq {:mvn/version "0.11.1"}}}' -M -m antq.core \
--skip=pom \
--error-format="| {{name}} | {{version}} | {{latest-version}} |" \
--reporter=format -d .:`ls -d * bases/* components/* projects/* | tr '\n' ':'` 2> /dev/null | sort -u
# antq exits with 1 if any deps are outdated -- we want a 0 exit:
exit 0
For clj-kondo
, you can pass in the classpath, as I recall, so in addition to our :dev
and :test
aliases for Polylith, we have :everything
and :runner
for our legacy subprojects and tests respectively, so we do clojure -Spath -A:dev:test:everything:runner
It might be interesting if we could have something like the ‘poly test’ command that could invoke an arbitrary alias on all (or possibly just modified) bricks, especially if you could configure the alias in the dev deps.edn and use it everywhere. This might also allow using test runners such as kaocha.
The test running machinery in poly
is pretty sophisticated and includes pre/post-project test suite hooks. It replaces something like Kaocha to be honest.
You can get a list of changed bricks from the poly
tool -- so you could use that, via a script for example, to create a list of things that Kaocha should run tests for (assuming Kaocha's API allows you to specify that directly).
Under the hood, once poly test
has computed the classpath for the project context and created an isolated classloader, it just calls clojure.test
directly, for the bricks that need to be tested. Does Kaocha support independent classpaths for test execution?
I see an “api” project -is there an official api for polylith? could that be used to get a list of the changed bricks?
@tengstrand is be better placed to answer questions about that.
I would just run the poly tool in a subprocess and capture the output. That's what build.clj
does (in the Polylith project).
I'm just getting started with polylith after watching a few videos, I'm following the instructions in the gitbook, and am stuck at https://polylith.gitbook.io/poly/architecture/workspace Here's the issue when I run the create workspace command just as its given in the docs:
$ clojure -T:poly create workspace name:example top-ns:se.example
Key is missing value: top-ns:se.example
# or from
$ clojure -Tpoly create workspace name next-gen top-ns com.my-company
Key is missing value: com.my-company
Polylith’s way of passing arguments does not work well when using it as a Clojure CLI Tool. It’s explained here: https://polylith.gitbook.io/poly/workflow/clojure-cli-tool
Okay, thanks for reporting this. I will have a look.
You might need to quote the namespace
'"com.my-company"'
The docs are wrong.
clojure -Tpoly create w next-gen top-ns com.my-company
☝️:skin-tone-2: That should work but the full equivalent should be this
clojure -Tpoly create entity '"workspace"' name next-gen top-ns com.my-company
Two things to note: w sym
is short for entity workspace name sym
but entities need to be strings, not symbols, so '"workspace"'
is required there. I think the latter is a bug in the poly
tool code: the entity
argument should support symbols.I’m not sure if I got it right, but feel free to update the https://github.com/polyfy/polylith/issues/154 I created @U04V70XH6.
Sounds good. Did you update the docs or are you waiting until this issue is fixed too?
Feel free to update it for now @U04V70XH6. I guess we will change it again when the issue is fixed.
I'll try to remember when I'm next at a computer but that might be Tuesday. I'm in vacation.
I submitted a change request for that section of the docs (with a note about poly
allowing symbols instead of strings in the future).
@furkan3ayraktar @tengstrand May I fork the following https://github.com/furkan3ayraktar/clojure-polylith-realworld-example-app? I would like to provide a Real World example of AWS Lambda proxy for Ring, and show how easily it's to develop regular applications for it.
Ooh, I'd be interested in seeing that. The license is MIT, btw, so I think it's fair to say they've already blessed forking : )
That should be fine! It’s @furkan3ayraktar’s repo, but as @U028BUU1P3R says, the license allow you to fork it!
I’m looking forward to the result!
May I change the name of the repo as well? Thanks! 🙂
I think MIT's only restriction is that you keep the copyright attribution: > The above copyright notice and this permission notice shall be included in all > copies or substantial portions of the Software. (from the LICENSE file) Otherwise you can do whatever you want :thumbsup:
Right. But still it's better to ask the author if he would accept it 😄
Hahaha, thanks for being so kind! Go for it and use however you like it! The repo didn’t even have a license file until yesterday, someone actually emailed and asked me about that 😂
If you keep the same api, you should be able to submit it to be displayed here: https://codebase.show/projects/realworld
The docs are wrong.
clojure -Tpoly create w next-gen top-ns com.my-company
☝️:skin-tone-2: That should work but the full equivalent should be this
clojure -Tpoly create entity '"workspace"' name next-gen top-ns com.my-company
Two things to note: w sym
is short for entity workspace name sym
but entities need to be strings, not symbols, so '"workspace"'
is required there. I think the latter is a bug in the poly
tool code: the entity
argument should support symbols.