Skip to content

Commit 40ce4f1

Browse files
committed
fix(deps): remove mine
1 parent 8b5c473 commit 40ce4f1

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"esbuild": "^0.24.0",
8484
"fs-extra": "^11.2.0",
8585
"hookable": "^5.5.3",
86-
"mime": "^4.0.4",
8786
"octokit": "^4.0.2",
8887
"std-env": "^3.8.0",
8988
"tiny-update-notifier": "^2.0.0",

pnpm-lock.yaml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/releaser/github.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import type { Context } from "../../types/index.js";
22
import { readFile, stat } from "node:fs/promises";
33
import { basename, join } from "node:path";
44
import process from "node:process";
5-
import mime from "mime";
65
import { Octokit } from "octokit";
76
import { glob } from "tinyglobby";
7+
import { getMimeTypeByFileName } from "../../utils/mime.js";
88
import { ReleaseBase } from "./base.js";
99

1010
export default class GitHub extends ReleaseBase {
@@ -94,7 +94,7 @@ export default class GitHub extends ReleaseBase {
9494
release_id: releaseID,
9595
data: await readFile(asset) as unknown as string,
9696
headers: {
97-
"content-type": mime.getType(asset) || "application/octet-stream",
97+
"content-type": getMimeTypeByFileName(asset) || "application/octet-stream",
9898
"content-length": (await stat(asset)).size,
9999
},
100100
name: basename(asset),

src/utils/mime.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { extname } from "node:path";
2+
3+
const mimeTypes: { [key: string]: string[] } = {
4+
"application/json": ["json"],
5+
"application/x-xpinstall": ["xpi"],
6+
};
7+
8+
export function getMimeTypeByFileName(filename: string) {
9+
const ext = extname(filename);
10+
11+
for (const type in mimeTypes) {
12+
if (mimeTypes[type].includes(ext))
13+
return type;
14+
}
15+
16+
return undefined;
17+
}

0 commit comments

Comments
 (0)