chore(installer): drop unused fetchJson and fetchGitHubJson

Neither method has any callers. Also drop the corresponding test.
This commit is contained in:
Alex Verkhovsky 2026-04-18 08:36:59 -07:00
parent 8133e57d57
commit 104dd9fee4
2 changed files with 0 additions and 39 deletions

View File

@ -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:');

View File

@ -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<Object>} 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<Object>} 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.