replace bun with pnpm and added dockerfile for web

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-11-02 11:29:28 +01:00
parent 4dde07704a
commit 9b329ef2f2
15 changed files with 5598 additions and 50 deletions

View File

@@ -34,7 +34,7 @@ class Fetcher {
post<Response extends unknown>(
path: string,
data: Record<string, any> = {},
options: FetchRequestInit = {}
options: RequestInit = {}
): Promise<Response | null> {
const url = `${this.url}${path}`
this.logger(`Mixan request: ${url}`, JSON.stringify(data, null, 2))
@@ -49,9 +49,7 @@ class Fetcher {
...options,
})
.then(async (res) => {
const response = await res.json<
MixanErrorResponse | Response
>()
const response = await res.json() as (MixanErrorResponse | Response)
if(!response) {
return null
@@ -78,7 +76,7 @@ class Fetcher {
class Batcher<T extends any> {
queue: T[] = []
timer?: Timer
timer?: NodeJS.Timeout
callback: (queue: T[]) => void
maxBatchSize: number
batchInterval: number

View File

@@ -8,7 +8,6 @@
},
"devDependencies": {
"@types/uuid": "^9.0.5",
"bun-types": "latest",
"tsup": "^7.2.0",
"typescript": "^5.0.0"
}

View File

@@ -17,9 +17,5 @@
"outDir": "dist",
"allowImportingTsExtensions": false,
"noEmit": false,
"types": [
"bun-types" // add Bun global
],
}
}

View File

@@ -3,13 +3,11 @@
To install dependencies:
```bash
bun install
pnpm install
```
To run:
```bash
bun run index.ts
pnpm run index.ts
```
This project was created using `bun init` in bun v1.0.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

View File

@@ -4,7 +4,6 @@
"type": "module",
"module": "index.ts",
"devDependencies": {
"bun-types": "latest",
"tsup": "^7.2.0",
"typescript": "^5.0.0"
}

View File

@@ -14,9 +14,6 @@
"jsx": "react-jsx",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"types": [
"bun-types" // add Bun global
]
"allowJs": true
}
}