Is polylith ready for purely clojurescript projects?
The tool currently only recognises .clj and .cljc source code files. But there is nothing stopping you from organising your frontend code in a Polylith way, which I know that e.g. @furkan3ayraktar has done in some of his previous projects, but without tooling support.
The nature and needs of the frontend projects are different than the backend. Especially, development experience in most of the frontend projects are pretty good. We did not have much experience to judge how Polylith would fit into that environment, so we did not work on supporting ClojureScript projects at the moment. However, I tend to keep the Polylith like project structure and exposing functionality with interface named namespaces. In any case it is a good practice to have clear separation between different parts of the codebase. I would recommend doing the same.
I have introduced a new “schema” component in our Polylith project, which has a beop.schema
namespace prefix, but it makes the poly check fail, because of every code that imports the prismatic lib with require [schema.core ...]
Error 101: Illegal dependency on namespace schema.core in data-api.config. Use schema.interface instead to fix the problem.
Does it mean that all the polylith components named like <vendor>.<name>.*
shouldn’t be used along libraries named like <name>.*
?
I have tried to rename the components/schema folder to components/beop-schema and the checker still doesn’t like (same error), I don’t understand how it detects usage :thinking_face:
I’ve packaged the minimal code to reproduce here https://github.com/cyppan/polylith-bug-check
@cyppan Is this using poly
master or issue-66 branch?
it’s master
Let me try your repo against the issue-66 branch...
I guess I’ll have to migrate at some point anyway 🙂
I just tested against the latest issue-66 version and it works fine:
(! 504)-> clojure -Sforce -M:poly info
stable since: 2e956be
projects: 1 interfaces: 1
bases: 1 components: 1
project alias status dev
---------------------------- ---
development * dev x-- x--
interface brick dev
----------------- ---
schema schema x--
- api * x--
(! 505)-> clojure -Sforce -M:poly check
OK
but you do have to make some changes: add workspace.edn
and add deps.edn
to each base and component.(! 506)-> cat workspace.edn
{:vcs {:name "git" :auto-add false}
:top-namespace "me.cyppan"
:interface-ns "interface"
:default-profile-name "default"
:compact-views #{}
:release-tag-pattern "v[0-9]*"
:stable-tag-pattern "stable-*"
:projects {"development" {:alias "dev"}}}
(! 507)-> cat bases/api/deps.edn
{:paths ["src"]
:deps {prismatic/schema {:mvn/version "1.1.12"}}}
(! 508)-> cat components/schema/deps.edn
{:paths ["src"]
:deps {}}
(that's just very roughly put together -- and :auto-add
is normally true
by default)ok thank you I’ll have a deeper look into the issue-66 branch then
It looks like you @cyppan have found a bug in the main
branch, because I could reproduce it in main
but not in issue-66
. In the issue-66
branch you also normally put deps.edn
files per component, where you specify its dependencies + that the polylith
key should be removed from the root deps.edn
. The tag patterns are stored like this: :tag-patterns {:stable "stable-*", :release "v[0-9]*"}
in workspace.edn
. You can get inspiration from the Polylith repository itself by looking in the https://github.com/polyfy/polylith/tree/issue-66 branch if you don’t have time to wait for the migration too that I’m working on (+ some minor fixes).
Thanks for the investigation, a migration tool would be great 👍 as a temporary fix I’ve renamed my component