Avo in monorepos

2 minute read

Avo supports monorepos out of the box. A single avo.json file in the root directory keeps track of all configured Avo sources for the repo, where the code for each source is located and when it was last updated.

To use Avo in a monorepo, initialize the Avo CLI by running avo init in the root of your repository. This will create a single avo.json file in the root of your monorepo. When you run avo pull [--branch my-branch] [SourceName] you pass in for which source you want to pull code for (e.g. avo pull Web). When you run avo pull for a new source for the first time, the CLI will prompt you to pick a location for the generated code (Avo Codegen file) for that source. The avo.json file in the root keeps track of which sources are configured in the repo, where Avo Codegen file for each one lives, when the tracking for that source was last updated, and what Avo branch that update was based on.

Here's an example of how an avo.json could look like in a monorepo containing a web app, microservice, iOS app, Android app and docs page:

json
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
"avo": {
"version": 1
},
"schema": {
"id": "<WORKSPACE_ID>",
"name": "My Tracking Plan"
},
"branch": {
"id": "main",
"name": "main"
},
"sources": [
{
"id": "SOURCE_ID",
"name": "Docs",
"path": "projects/docs/Avo.ts",
"actionId": "<LAST_UPDATED_ID>",
"branchId": "<LAST_UPDATED_BRANCH_ID>",
"updatedAt": "<LAST_UPDATED_TIMESTAMP>"
},
{
"id": "SOURCE_ID",
"name": "Web App",
"path": "projects/web/Avo.ts",
"actionId": "<LAST_UPDATED_ID>",
"branchId": "<LAST_UPDATED_BRANCH_ID>",
"updatedAt": "<LAST_UPDATED_TIMESTAMP>"
},
{
"id": "SOURCE_ID",
"name": "Transactions Microservice",
"path": "projects/transactions/Avo.ts",
"actionId": "<LAST_UPDATED_ID>",
"branchId": "<LAST_UPDATED_BRANCH_ID>",
"updatedAt": "<LAST_UPDATED_TIMESTAMP>"
},
{
"id": "SOURCE_ID",
"name": "iOS",
"path": "projects/iOS/Avo.swift",
"actionId": "<LAST_UPDATED_ID>",
"branchId": "<LAST_UPDATED_BRANCH_ID>",
"updatedAt": "<LAST_UPDATED_TIMESTAMP>"
},
{
"id": "SOURCE_ID",
"name": "Android",
"path": "projects/Android/Avo.kt",
"actionId": "<LAST_UPDATED_ID>",
"branchId": "<LAST_UPDATED_BRANCH_ID>",
"updatedAt": "<LAST_UPDATED_TIMESTAMP>"
}
]
}