fix node-fetch dependencie errors

This commit is contained in:
Domai 2023-07-29 13:29:45 +02:00
parent a3a6821776
commit 06b592df11
No known key found for this signature in database
GPG key ID: 2FBD8C921EB5B019
7 changed files with 200 additions and 3570 deletions

View file

@ -95,7 +95,7 @@ docker run your-tag
## NPM
```shell
npm ci
npm install
npm run build
npm run start
```

View file

@ -1,5 +1,4 @@
import express from 'express'
import api from './api/profile'
import history from './api/history'
import topLangs from './api/top-langs'
import profile from './api/profile'

3723
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,23 @@
{
"name": "github-readme-stats",
"name": "codestats-readme",
"version": "1.0.0",
"description": "Dynamically generate stats for your github readmes",
"description": "Dynamically generated Code::Stats SVGs for your GitHub Readmes",
"author": {
"name": "Anurag Hazra",
"url": "https://github.com/Aviortheking"
},
"contributors": [
{
"name": ":Domai",
"email": "coding@domai-tb.com",
"url": "https://github.com/domai-tb"
}
],
"license": "MIT",
"homepage": "https://github.com/domai-tb/codestats-readme",
"bugs": {
"url": "https://github.com/domai-tb/codestats-readme/issues"
},
"main": "index.js",
"scripts": {
"dev": "ts-node ./index.ts",
@ -9,25 +25,23 @@
"start": "node dist/index.js",
"theme-readme-gen": "ts-node scripts/generate-theme-doc"
},
"author": "Anurag Hazra",
"license": "MIT",
"devDependencies": {
"@types/express": "^4",
"@types/node-fetch": "^2",
"@types/react": "^18",
"@types/react-dom": "^18",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^5",
"@typescript-eslint/parser": "^6",
"eslint": "^8",
"ts-node": "^10"
},
"dependencies": {
"@dzeio/config": "^1.1.12",
"@dzeio/config": "^1",
"express": "^4",
"node-fetch": "^3",
"node-fetch": "^2",
"react": "^18",
"react-dom": "^18",
"typescript": "^4",
"typescript": "^5",
"word-wrap": "^1"
}
}

View file

@ -8,12 +8,10 @@ export default async function retryer<T = Promise<CodeStatsResponse>>(
err?: any
): Promise<T> {
if (retries > 7) {
throw new CustomError('Maximum retries exceeded' + err, 'MAX_RETRY')
throw new CustomError('Maximum retries exceeded. ' + err, 'MAX_RETRY')
}
try {
return await fetcher(
data
)
return await fetcher(data)
} catch (err) {
return retryer(fetcher, data, ++retries, err)
}

View file

@ -45,7 +45,7 @@ export async function request(username: string): Promise<CodeStatsResponse> {
const resp = await fetch(
`https://codestats.net/api/users/${username}`
)
return resp.json()
return resp.json() as Promise<CodeStatsResponse>;
}
export async function profileGraphRequest<T>(body: string): Promise<T> {
@ -56,7 +56,7 @@ export async function profileGraphRequest<T>(body: string): Promise<T> {
method: 'POST'
}
)
return resp.json()
return resp.json() as Promise<T>;
}
export function getColor(

View file

@ -14,7 +14,7 @@ export default class Error extends React.Component<{
.gray { fill: #858585 }
`}</style>
<rect x="0.5" y="0.5" width="494" height="99%" rx="4.5" fill="#FFFEFE" stroke="#E4E2E2"/>
<text x="25" y="45" className="text">Something went wrong! file an issue at https://dze.io/3nL29</text>
<text x="25" y="45" className="text">Something went wrong!</text>
<text data-testid="message" x="25" y="55" className="text small">
<tspan x="25" dy="18">{encodeHTML(this.props.message)}</tspan>
<tspan x="25" dy="18" className="gray">{this.props.secondaryMessage}</tspan>