poly
Search…
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:
1
clone-from-here
2
├── example
3
└── clojure-polylith-realworld-example-app
Copied!
1
git clone [email protected]:furkan3ayraktar/clojure-polylith-realworld-example-app.git
2
cd clojure-polylith-realworld-example-app
Copied!
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.:
1
poly check ws-dir:../example
Copied!
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.:
1
cd projects/realworld-backend
2
poly info ::
Copied!
...which in this case is the same as:
1
poly info ws-dir:../..
Copied!
Now, let's tag the RealWorld application as stable (which will only affect our local clone):
1
cd ../..
2
git tag -f stable-lisa
Copied!
1
poly info
Copied!
Now we have some bricks to play with!
Let's list all dependencies by executing the deps command:
1
poly deps
Copied!
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:
1
poly deps brick:article
Copied!
To list the component dependencies, we need to specify a project:
1
poly deps project:rb
Copied!
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:
1
poly deps project:rb :compact
Copied!
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:
1
poly deps project:rb brick:article
Copied!
Last modified 1mo ago
Copy link