Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions web/scripts/__tests__/static-pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,42 @@ describe('generateStaticPages', () => {
vi.resetModules();
}
});

it('derives colony-instance.json name from COLONY_GITHUB_URL', async () => {
const savedGithub = process.env.COLONY_GITHUB_URL;
process.env.COLONY_GITHUB_URL = 'https://github.com/acme/swarm';
vi.resetModules();

try {
const { generateStaticPages: generate } = await import('../static-pages');

writeFileSync(
join(TEST_OUT, 'data', 'activity.json'),
JSON.stringify(minimalActivityData())
);

generate(TEST_OUT);

const manifest = JSON.parse(
readFileSync(
join(TEST_OUT, '.well-known', 'colony-instance.json'),
'utf-8'
)
);

expect(manifest.name).toBe('acme/swarm');
expect(manifest.name).not.toBe('hivemoot/colony');
expect(manifest.sourceRepository).toBe('https://github.com/acme/swarm');
expect(manifest.sourceRepository).not.toBe('https://github.com/hivemoot/colony');
} finally {
if (savedGithub === undefined) {
delete process.env.COLONY_GITHUB_URL;
} else {
process.env.COLONY_GITHUB_URL = savedGithub;
}
vi.resetModules();
}
});
});

describe('generateAtomFeed', () => {
Expand Down
10 changes: 8 additions & 2 deletions web/scripts/static-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,16 +786,22 @@ export function generateStaticPages(outDir: string): void {
// own deployed URL rather than the upstream hivemoot/colony URL.
const wellKnownDir = join(outDir, '.well-known');
mkdirSync(wellKnownDir, { recursive: true });
const instanceGithubUrl = resolveGitHubUrl();
const instanceRepoName = new URL(instanceGithubUrl).pathname
.split('/')
.filter(Boolean)
.slice(-2)
.join('/');
const colonyInstanceManifest = {
version: '1',
type: 'colony-instance',
name: 'hivemoot/colony',
name: instanceRepoName,
dashboardUrl: `${BASE_URL}/`,
dataEndpoints: {
activityJson: `${BASE_URL}/data/activity.json`,
governanceHistoryJson: `${BASE_URL}/data/governance-history.json`,
},
sourceRepository: 'https://github.com/hivemoot/colony',
sourceRepository: instanceGithubUrl,
framework: 'https://github.com/hivemoot/hivemoot',
since: '2026-02',
};
Expand Down