Skip to content

Commit 41b072f

Browse files
committed
fix: use tarxz based on file extention
1 parent 3389b10 commit 41b072f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/get-serve-d.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ const assetMap = {
1212
// function to download serve-d binaries from GitHub
1313
export async function getServeD() {
1414
const distFolder = join(dirname(__dirname), "dist")
15-
await remove(distFolder)
16-
await ensureDir(distFolder)
17-
1815
const platform = assetMap[process.platform]
16+
const downloadFolder = join(distFolder, platform)
1917

20-
const decompressPlugins = []
21-
if (process.platform !== "win32") {
22-
decompressPlugins.push(await import("decompress-tarxz"))
23-
}
18+
await remove(distFolder)
19+
await ensureDir(distFolder)
2420

2521
const assets = ((await downloadRelease(
2622
/* username */ "Pure-D",
@@ -33,11 +29,11 @@ export async function getServeD() {
3329

3430
const asset = assets[0] // Assume there is only one possibility
3531
if (extname(asset) === ".xz") {
36-
await decompress(asset, join(distFolder, platform), {
37-
plugins: decompressPlugins,
32+
await decompress(asset, downloadFolder, {
33+
plugins: [await import("decompress-tarxz")],
3834
})
3935
} else {
40-
await decompress(asset, join(distFolder, platform))
36+
await decompress(asset, downloadFolder)
4137
}
4238
remove(asset)
4339
}

0 commit comments

Comments
 (0)