poly
Search
K

Dependencies

If you are looking for library dependencies, then visit the Libraries section.
To explain dependencies, we will use the RealWorld example app.
Start by cloning the project by executing these commands from outside the example workspace, e.g. the parent folder of our example workspace:
clone-from-here
├── example
└── clojure-polylith-realworld-example-app
git clone [email protected]:furkan3ayraktar/clojure-polylith-realworld-example-app.git
cd clojure-polylith-realworld-example-app
Before we continue, it may be worth mentioning that most commands, except the test and create commands, can be executed from other workspaces by giving ws-dir, e.g.:
poly check ws-dir:../example
Another way of giving the ws-dir is to pass in :: which will set it to the first parent directory that contains a workspace.edn file, e.g.:
cd projects/realworld-backend
poly info ::
...which in this case is the same as:
poly info ws-dir:../..
Now, let's tag the RealWorld application as stable (which will only affect our local clone):
cd ../..
git tag -f stable-lisa
poly info
Now we have some bricks to play with!
Let's list all dependencies by executing the deps command:
poly deps
This lists all dependencies in the workspace. Notice the yellow color in the headers. They are yellow because components and bases only depend on interfaces. Each x is a src dependencies, while a t means it only exists in the test context.
If we read the diagram horizontally, we can see that the article component uses the database, profile and spec interfaces. If we read it vertically, we can see that the article is used by the comment and rest-api bricks.
This is also what is shown if we specify article as brick:
poly deps brick:article
To list the component dependencies, we need to specify a project:
poly deps project:rb
Now, all the headers are green, and that is because all the implementing components are known within the selected project. The + signs mark indirect dependencies, while - signs mark indirect test dependencies (not present here). An example is the article component that uses log indirectly: article > database > log.
Tip: If the headers and the "green rows" don't match, it may indicate that we have unused components that can be removed from the project.
If we have many libraries, they can be viewed in a more compact format:
poly deps project:rb :compact
This can be set permanently by setting :compact-views #{"deps"} in workspace.edn.
We can also show dependencies for a specific brick within a project:
poly deps project:rb brick:article