From 104dd9fee4b66ceff59932d074cc7ad26d5d9258 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Sat, 18 Apr 2026 08:36:59 -0700 Subject: [PATCH] chore(installer): drop unused fetchJson and fetchGitHubJson Neither method has any callers. Also drop the corresponding test. --- test/test-registry-client.js | 14 ------------ tools/installer/modules/registry-client.js | 25 ---------------------- 2 files changed, 39 deletions(-) diff --git a/test/test-registry-client.js b/test/test-registry-client.js index 1c502ed60..ca310c61b 100644 --- a/test/test-registry-client.js +++ b/test/test-registry-client.js @@ -163,19 +163,6 @@ async function testFetchGitHubYamlParsesCorrectly() { assert(result.modules[0].name === 'test', 'fetchGitHubYaml preserves YAML values'); } -async function testFetchGitHubJsonParsesCorrectly() { - const jsonContent = '{"name": "test", "version": "1.0.0"}'; - const { client } = createStubbedClient({ - apiResult: jsonContent, - rawResult: jsonContent, - }); - - const result = await client.fetchGitHubJson('owner', 'repo', 'file.json', 'main'); - - assert(result.name === 'test', 'fetchGitHubJson parses JSON correctly'); - assert(result.version === '1.0.0', 'fetchGitHubJson preserves JSON values'); -} - // ─── Runner ──────────────────────────────────────────────────────────────── async function runTests() { @@ -189,7 +176,6 @@ async function runTests() { await testUrlConstruction(); await testRawUrlConstruction(); await testFetchGitHubYamlParsesCorrectly(); - await testFetchGitHubJsonParsesCorrectly(); console.log(`\n${colors.cyan}========================================`); console.log('Test Results:'); diff --git a/tools/installer/modules/registry-client.js b/tools/installer/modules/registry-client.js index 3ad6bd93b..bf891de07 100644 --- a/tools/installer/modules/registry-client.js +++ b/tools/installer/modules/registry-client.js @@ -55,17 +55,6 @@ class RegistryClient { return yaml.parse(content); } - /** - * Fetch a URL and parse the response as JSON. - * @param {string} url - URL to fetch - * @param {number} [timeout] - Timeout in ms - * @returns {Promise} Parsed JSON content - */ - async fetchJson(url, timeout) { - const content = await this.fetch(url, timeout); - return JSON.parse(content); - } - /** * Fetch a file from a GitHub repo using the Contents API first, * falling back to raw.githubusercontent.com if the API fails. @@ -112,20 +101,6 @@ class RegistryClient { return yaml.parse(content); } - /** - * Fetch a file from GitHub and parse as JSON. - * @param {string} owner - Repository owner - * @param {string} repo - Repository name - * @param {string} filePath - Path within the repo - * @param {string} ref - Git ref - * @param {number} [timeout] - Timeout in ms - * @returns {Promise} Parsed JSON content - */ - async fetchGitHubJson(owner, repo, filePath, ref, timeout) { - const content = await this.fetchGitHubFile(owner, repo, filePath, ref, timeout); - return JSON.parse(content); - } - /** * Fetch a URL with custom headers. Used for GitHub API requests. * Follows up to 3 redirects.