Skip to content

Commit 1f55df8

Browse files
authored
Merge pull request #5 from AztecProtocol/feat/sparse-path-overrides
fix: skip version tag for gregoswap
2 parents be08160 + 1f00c67 commit 1f55df8

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

src/repos/config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export interface RepoConfig {
2222
code?: string[];
2323
docs?: string[];
2424
};
25+
/** Skip applying the version tag to this repo (clone default branch instead) */
26+
skipVersionTag?: boolean;
2527
/** Override specific sparse paths to come from a different branch instead of the tag */
2628
sparsePathOverrides?: { paths: string[]; branch: string }[];
2729
}
@@ -37,7 +39,6 @@ const BASE_REPOS: Omit<RepoConfig, "tag">[] = [
3739
name: "aztec-packages",
3840
url: "https://github.com/AztecProtocol/aztec-packages",
3941
sparse: [
40-
"docs",
4142
"noir-projects/aztec-nr",
4243
"noir-projects/noir-contracts",
4344
"yarn-project",
@@ -116,6 +117,7 @@ const BASE_REPOS: Omit<RepoConfig, "tag">[] = [
116117
{
117118
name: "gregoswap",
118119
url: "https://github.com/AztecProtocol/gregoswap",
120+
skipVersionTag: true,
119121
description: "Gregoswap - token swap application built on Aztec",
120122
searchPatterns: {
121123
code: ["*.nr", "*.ts"],
@@ -133,8 +135,8 @@ export function getAztecRepos(version?: string): RepoConfig[] {
133135

134136
return BASE_REPOS.map((repo) => ({
135137
...repo,
136-
// Only apply version tag to Aztec repos, not Noir repos
137-
tag: repo.url.includes("AztecProtocol") ? tag : undefined,
138+
// Only apply version tag to Aztec repos that don't opt out
139+
tag: repo.url.includes("AztecProtocol") && !repo.skipVersionTag ? tag : undefined,
138140
// Resolve {version} placeholders in sparse path overrides
139141
sparsePathOverrides: repo.sparsePathOverrides?.map((override) => ({
140142
...override,

src/utils/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export async function cloneRepo(
6262
const git: SimpleGit = simpleGit();
6363

6464
// Determine ref to checkout: commit > tag > branch
65-
const ref = config.commit || config.tag || config.branch;
65+
const ref = config.commit || config.tag || config.branch || "default";
6666
const refType = config.commit ? "commit" : config.tag ? "tag" : "branch";
6767

6868
if (config.sparse && config.sparse.length > 0) {

tests/repos/config.test.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ describe("AZTEC_REPOS", () => {
2626
expect(noir!.sparse!.length).toBeGreaterThan(0);
2727
});
2828

29-
it("aztec-packages has sparsePathOverrides for docs/docs on next branch", () => {
29+
it("aztec-packages has sparsePathOverrides for versioned docs on next branch", () => {
3030
const ap = AZTEC_REPOS.find((r) => r.name === "aztec-packages");
31-
expect(ap?.sparse).toContain("docs");
31+
expect(ap?.sparse).not.toContain("docs");
3232
expect(ap?.sparsePathOverrides).toEqual([
3333
{
3434
paths: [
@@ -50,31 +50,22 @@ describe("AZTEC_REPOS", () => {
5050
});
5151

5252
describe("getAztecRepos", () => {
53-
it("applies version tag only to AztecProtocol repos", () => {
53+
it("applies version tag only to AztecProtocol repos without skipVersionTag", () => {
5454
const repos = getAztecRepos();
55-
const aztecProtocolRepos = repos.filter((r) =>
56-
r.url.includes("AztecProtocol")
57-
);
58-
const otherRepos = repos.filter(
59-
(r) => !r.url.includes("AztecProtocol")
60-
);
61-
62-
expect(aztecProtocolRepos).toHaveLength(5);
63-
for (const repo of aztecProtocolRepos) {
55+
const taggedRepos = repos.filter((r) => r.tag !== undefined);
56+
expect(taggedRepos).toHaveLength(4);
57+
for (const repo of taggedRepos) {
6458
expect(repo.tag).toBe(DEFAULT_AZTEC_VERSION);
6559
}
6660

67-
for (const repo of otherRepos) {
68-
expect(repo.tag).toBeUndefined();
69-
}
61+
const gregoswap = repos.find((r) => r.name === "gregoswap");
62+
expect(gregoswap?.tag).toBeUndefined();
7063
});
7164

7265
it("uses custom version when provided", () => {
7366
const repos = getAztecRepos("v2.0.0");
74-
const aztecProtocolRepos = repos.filter((r) =>
75-
r.url.includes("AztecProtocol")
76-
);
77-
for (const repo of aztecProtocolRepos) {
67+
const taggedRepos = repos.filter((r) => r.tag !== undefined);
68+
for (const repo of taggedRepos) {
7869
expect(repo.tag).toBe("v2.0.0");
7970
}
8071
});

0 commit comments

Comments
 (0)