From 763bd6cb7463853417c0989f01b6da8a65a6c37f Mon Sep 17 00:00:00 2001 From: xHyroM Date: Mon, 11 Jul 2022 10:13:50 +0200 Subject: [PATCH] aaaaaaaaa --- dist/utils/getAsset.js | 5 ++++- dist/utils/install.js | 6 +++--- src/utils/getAsset.ts | 5 ++++- src/utils/install.ts | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dist/utils/getAsset.js b/dist/utils/getAsset.js index 37f841a..e96ac4e 100644 --- a/dist/utils/getAsset.js +++ b/dist/utils/getAsset.js @@ -21,5 +21,8 @@ export default (assets) => { default: throw new Error(`Unsupported platform ${process.platform}.`); } - return assets.find(asset => asset.name === `bun-${platform}-${arch}.zip`); + return { + name: `bun-${platform}-${arch}.zip`, + asset: assets.find(asset => asset.name === `bun-${platform}-${arch}.zip`), + }; }; diff --git a/dist/utils/install.js b/dist/utils/install.js index ed81414..bd10233 100644 --- a/dist/utils/install.js +++ b/dist/utils/install.js @@ -12,14 +12,14 @@ export default async (release) => { return; } const asset = getAsset(release.assets); - info(`Downloading Bun from ${asset.browser_download_url}.`); - const zipPath = await downloadTool(asset.browser_download_url); + info(`Downloading Bun from ${asset.asset.browser_download_url}.`); + const zipPath = await downloadTool(asset.asset.browser_download_url); const extracted = await extractZip(zipPath, join(getHomeDir(), ".bun", "bin")); const newCache = await cacheDir(extracted, 'bun', release.tag_name); info(`Cached Bun to ${newCache}.`); addPath(newCache); console.log(extracted); - const bunPath = join(getHomeDir(), ".bun", "bin"); + const bunPath = join(getHomeDir(), ".bun", "bin", asset.name.replaceAll('.zip', '')); console.log(readdirSync(bunPath)); addPath(bunPath); }; diff --git a/src/utils/getAsset.ts b/src/utils/getAsset.ts index d3dc984..2ea159d 100644 --- a/src/utils/getAsset.ts +++ b/src/utils/getAsset.ts @@ -25,5 +25,8 @@ export default (assets: Asset[]) => { throw new Error(`Unsupported platform ${process.platform}.`); } - return assets.find(asset => asset.name === `bun-${platform}-${arch}.zip`); + return { + name: `bun-${platform}-${arch}.zip`, + asset: assets.find(asset => asset.name === `bun-${platform}-${arch}.zip`), + } } \ No newline at end of file diff --git a/src/utils/install.ts b/src/utils/install.ts index dc070df..c30c196 100644 --- a/src/utils/install.ts +++ b/src/utils/install.ts @@ -16,9 +16,9 @@ export default async(release: Release) => { const asset = getAsset(release.assets); - info(`Downloading Bun from ${asset.browser_download_url}.`); + info(`Downloading Bun from ${asset.asset.browser_download_url}.`); - const zipPath = await downloadTool(asset.browser_download_url); + const zipPath = await downloadTool(asset.asset.browser_download_url); const extracted = await extractZip(zipPath, join(getHomeDir(), ".bun", "bin")); const newCache = await cacheDir( @@ -31,7 +31,7 @@ export default async(release: Release) => { addPath(newCache); console.log(extracted); - const bunPath = join(getHomeDir(), ".bun", "bin"); + const bunPath = join(getHomeDir(), ".bun", "bin", asset.name.replaceAll('.zip', '')); console.log(readdirSync(bunPath)); addPath(bunPath); } \ No newline at end of file