polylith

https://polylith.gitbook.io/ and https://github.com/polyfy/polylith
tengstrand 2021-04-03T02:53:12.003200Z

The path “components/schema-fixture” is incorrect, should be “../../components/schema-fixture” in projects/usermanager/deps.edn (it should show a warning for non existing path, will fix that). After that change, it works for me.

tengstrand 2021-04-03T03:04:56.003400Z

Nice spotted. I have pushed version: 0.2.0-alpha10.issue66.02: 500c31e95f88a80036b74c9b20712122bbf25a34

seancorfield 2021-04-03T03:33:15.003700Z

Re: schema fixture -- I must have committed the wrong version, sorry. I was experimenting trying to get past another issue, going back and forth between my local version of Polylith, your latest version, and the earlier version on issue-66. Will update to that latest SHA and retest. Thank you!

👍 1
seancorfield 2021-04-03T04:15:18.004Z

Yup, confirmed: everything looks good at this point!

seancorfield 2021-04-03T04:15:40.004200Z

Very nice to see the src/test libs called out separately.

seancorfield 2021-04-03T04:16:24.004400Z

I've now tagged the usermanager as stable and a v1.0.0 release 🙂

tengstrand 2021-04-03T04:32:22.004600Z

Nice, well don!

tengstrand 2021-04-03T04:33:58.004800Z

If you want, you could also update the screenshot with the latest output from the libs command, to get the two columns per project (not super important maybe).

tengstrand 2021-04-03T04:34:37.005Z

But the info command output is also slightly wrong (for the schema-fixture component).

tengstrand 2021-04-03T04:42:56.005200Z

You can make another change in the doc also, from “`clojure -M:poly test` (optionally with `:dev`).” to “`clojure -M:poly test` (optionally with `:project`). By default, only the brick tests are executed, but :project will also include the project tests. We normally don’t run tests for the development project (by including :dev, except maybe in the beginning of a codebase before we have created our first project.

seancorfield 2021-04-03T04:43:53.005400Z

Ah, right.

seancorfield 2021-04-03T04:44:15.005600Z

And, yes, tomorrow I'll update the screenshot when I'm on my big desktop.

tengstrand 2021-04-03T04:46:55.005800Z

I guess you can replace what comes after “You can run all the tests via Polylith’s `poly` tool:” too, and change to

clojure -M:poly test :project
+ replace :dev to :projectin the text that follows.

seancorfield 2021-04-03T04:48:36.006200Z

It now says:

* You can run all the tests with `clojure -M:poly test :all :dev`, or just tests for things changed since the last stable tag with `clojure -M:poly test` (optionally with `:project`).

seancorfield 2021-04-03T04:50:09.006400Z

I like that :dev (or :all :dev) will run tests for components that are not yet used by projects, perhaps as folks extend the app or add their own.

seancorfield 2021-04-03T04:50:35.006600Z

They can always read all of your Polylith documentation for more details.

tengstrand 2021-04-03T04:54:03.007300Z

That will be a good change of the text.

tengstrand 2021-04-03T04:55:36.007500Z

The repository turned out really well by the way! 🙂

seancorfield 2021-04-03T04:55:40.007700Z

How about this:

* You can run tests for code that has changed since the last stable tag with `clojure -M:poly test` (optionally with `:project` to also run project tests). You can run the entire suite of tests with `clojure -M:poly test :all :dev`.

👍 1
seancorfield 2021-04-03T04:58:57.008Z

Yeah, I think that while the Polylith version may look a lot more complicated, all of the individual components are much simpler and easier to understand.

seancorfield 2021-04-03T05:43:38.008200Z

Screenshot updated too (back on my big desktop).

👍 1
tengstrand 2021-04-03T05:52:25.008700Z

I’m glad you say so. That’s my experience also, that it helps you reason about the code. Instead of having just src , test and resources at the top level for the whole codebase, each “concept” can have their own directories, which keeps things smaller and more cohesive.

seancorfield 2021-04-03T06:19:34.009900Z

The “top-level” of our monorepo at work:

activator		login			wsadmin-auth
affiliate		lowlevel		wsadmin-screening
api			migration		wsbilling-admin
auth			newrelic		wsbilling-core
build			presence		wsbilling-member
cfml			preview			wsbilling-rebill
cfml-admin		redis			wsbilling-sdk
cfml-affiliate		src			wsbilling-test
classes			system			wsmessaging
compile.clj		web			wsmessaging-core
crud-form		worldsingles		wsmessaging-sdk
datamapper		worldsingles-test	wsphotoqueue
deps.edn		worldsingles-web	wsseogeo
environment		wsadmin
🙂

seancorfield 2021-04-03T06:20:33.010100Z

Each of those has src, resources, and test and they each have their own deps.edn. There’s also the root deps.edn which is similar to Polylith’s.

seancorfield 2021-04-03T06:22:27.010300Z

We just don’t have a) the top-level separation into bases, components, and projects and b) we don’t distinguish between bases and projects. activator and api are both. So are auth, system, wsadmin, wsbilling-admin, and a few others.

seancorfield 2021-04-03T06:24:11.010600Z

And c) we don’t have a standardized namespace structure in each of those. Yet.

Jean 2021-04-03T16:29:27.023300Z

Hi! I take a look to polylith and I like it! I’m wondering if it’s possible to manage the UI too (with cljs of course) in the same `workspace` ?The Clojure(Script) ecosystem is awesome and typicaly we can share schema (spec, malli) between front and back. Is this possible?

▾ workspace
  ▾ components
    ▾ mycomponent
      ▾ src
          interface.clj
          core.clj
          ui.cljs
      ▸ test
      ▸ resources
And add a new entry in the projects folder.

1
1
1
2021-04-04T20:50:50.030Z

Here’s my example repo, including Clojure, ClojureScript and cljc code as the glue in between (I’ll also post a link to my blog post about it in the #news-and-articles channel) https://github.com/DavidVujic/polylith-experiments

🙌 2
tengstrand 2021-04-04T20:51:38.030400Z

Nice!

Jean 2021-04-05T13:26:42.031800Z

ooooh well done @david043 !

2021-04-05T13:37:47.033300Z

Thank you @jean.boudet11!

Jean 2021-04-05T13:43:31.033600Z

Juste a little note. When a component has Clojure (clj) code and ClojureScript (cljs) it’s maybe good to separate into a ui namespace (or another name) like this:

▾ workspace
  ▾ components
    ▾ mycomponent
      ▾ src
          interface.clj
          core.clj
          ▾ ui
            interface.cljs
      ▸ test
      ▸ resources
I don’t no if it’s a good or bad pattern but this allow to separate interface.clj and interface.cljs

2021-04-05T13:58:23.036300Z

Good idea!

2021-04-06T07:22:15.042500Z

I guess it depends, maybe they could be two separate components?

tengstrand 2021-04-06T14:09:57.054500Z

You are mixing languages within the same component here + that it contains two separate interfaces also. My gut feeling says that the two “components” should be separated and live in two separate src directories . The UI code could either live in its own src directory, or together with other ui code, optionally in a separate base which another team here did (we haven’t). But with that said, feel free to experiment @jean.boudet11!

2021-04-03T17:33:41.023900Z

Hi @jean.boudet11! I am currently working on a solution like that and am writing a blog post with an example code repo - but took a break for the easter holiday today 😄

2021-04-03T17:41:47.024600Z

I think I will have something to share tomorrow or maybe monday.

👍 2
Jean 2021-04-03T18:57:04.025200Z

Priority to the easter chase 😉

😄 1