mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-21 06:54:08 -07:00
Finish axios migration via shared native HTTP helper
Replace all in-scope axios callsites with a new helpers/http.js wrapper over native fetch, including JSON/text GET, JSON POST, HEAD checks, and transient 5xx retry behavior; update all browser, build, script, and proxy API clients to use it; add focused unit tests; and remove axios from package dependencies. Constraint: Preserve API/build and deployment behavior while lowering transport surface area. Rejected: inline fetch replacements at each callsite | rejected to avoid inconsistent error/retry semantics. Confidence: high Scope-risk: moderate Directive: Keep helper in place as the transport boundary and update tests when changing request semantics. Tested: pnpm run -s typecheck, pnpm -s run test-prebuild, pnpm -s run test, pnpm -s run test:browser, pnpm -s run netlify-build, smoke GETs on /apple-silicon-app-test and /apple-silicon-app-test/?version=2 Not-tested: branch/netlify deployment health in CI pipeline after merge
This commit is contained in:
parent
d39a2a1d6c
commit
d45b587434
25 changed files with 824 additions and 267 deletions
|
|
@ -2,7 +2,6 @@
|
|||
// import { promises as fs } from 'fs'
|
||||
// import MarkdownIt from 'markdown-it'
|
||||
// import slugify from 'slugify'
|
||||
import axios from 'axios'
|
||||
|
||||
// import statuses from './statuses'
|
||||
// import parseDate from './parse-github-date'
|
||||
|
|
@ -11,6 +10,7 @@ const marked = require('marked')
|
|||
const HTMLParser = require(`node-html-parser`)
|
||||
|
||||
import { getAppEndpoint } from './app-derived'
|
||||
import { getJson } from './http.js'
|
||||
|
||||
|
||||
const statusesTranslations = {
|
||||
|
|
@ -117,13 +117,13 @@ class MakeHomebrewList {
|
|||
allFormulaeResponse
|
||||
] = await Promise.all([
|
||||
// Fetch Gihub Issue List
|
||||
axios.get(process.env.HOMEBREW_SOURCE),
|
||||
getJson( process.env.HOMEBREW_SOURCE ),
|
||||
// Fetch Official Homebrew Formulae List
|
||||
axios.get('https://formulae.brew.sh/api/formula.json')
|
||||
getJson( 'https://formulae.brew.sh/api/formula.json' )
|
||||
])
|
||||
|
||||
// Extract commit from response data
|
||||
const issueMarkdown = issueResponse.data.data.repository.issue.body
|
||||
const issueMarkdown = issueResponse.data.repository.issue.body
|
||||
|
||||
// Parse markdown
|
||||
const issueHTML = marked(issueMarkdown)
|
||||
|
|
@ -132,10 +132,10 @@ class MakeHomebrewList {
|
|||
const dom = HTMLParser.parse(issueHTML)
|
||||
|
||||
// Store the original array
|
||||
this.allFormulaeArray = allFormulaeResponse.data
|
||||
this.allFormulaeArray = allFormulaeResponse
|
||||
|
||||
// Extract list from allFormulaeResponse and map into an object for easy access
|
||||
this.allFormulae = Object.fromEntries(allFormulaeResponse.data.map(formula => {
|
||||
this.allFormulae = Object.fromEntries(allFormulaeResponse.map(formula => {
|
||||
return [
|
||||
formula.full_name,
|
||||
formula
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue