mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-02-23 10:40:10 +08:00
feat: clean version
This commit is contained in:
parent
705032ffe3
commit
ad6ee5950c
@ -17,7 +17,7 @@ const main = async() => {
|
||||
const release = await getGithubRelease(version, token);
|
||||
if (release?.message === 'Not Found') return exit('Invalid bun version.');
|
||||
|
||||
info(`Going to install release ${release.tag_name}`);
|
||||
info(`Going to install release ${release.version}`);
|
||||
|
||||
await install(release);
|
||||
|
||||
|
@ -13,20 +13,11 @@ export default (assets: Asset[]) => {
|
||||
throw new Error(`Unsupported architechture ${process.arch}.`);
|
||||
}
|
||||
|
||||
let platform;
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
platform = 'linux'
|
||||
break;
|
||||
case 'darwin':
|
||||
platform = 'darwin'
|
||||
break;
|
||||
default:
|
||||
if (!['linux', 'darwin'].some(platform => process.platform === platform))
|
||||
throw new Error(`Unsupported platform ${process.platform}.`);
|
||||
}
|
||||
|
||||
return {
|
||||
name: `bun-${platform}-${arch}.zip`,
|
||||
asset: assets.find(asset => asset.name === `bun-${platform}-${arch}.zip`),
|
||||
name: `bun-${process.platform}-${arch}.zip`,
|
||||
asset: assets.find(asset => asset.name === `bun-${process.platform}-${arch}.zip`),
|
||||
}
|
||||
}
|
@ -9,7 +9,8 @@ export interface Release {
|
||||
html_url: string;
|
||||
tag_name: string;
|
||||
message?: string;
|
||||
assets: Asset[]
|
||||
assets: Asset[];
|
||||
version: string;
|
||||
}
|
||||
|
||||
export default async(version: string, token: string): Promise<Release> => {
|
||||
@ -25,5 +26,8 @@ export default async(version: string, token: string): Promise<Release> => {
|
||||
}
|
||||
})).json();
|
||||
|
||||
return release;
|
||||
return {
|
||||
...release,
|
||||
version: release.tag_name.replace('bun-v', '')
|
||||
};
|
||||
}
|
@ -6,7 +6,8 @@ import getHomeDir from './getHomeDir.js';
|
||||
import { join } from 'path';
|
||||
|
||||
export default async(release: Release) => {
|
||||
const cache = find('bun', release.tag_name);
|
||||
const cache = find('bun', release.version);
|
||||
console.log(cache);
|
||||
if (cache) {
|
||||
info(`Using cached Bun installation from ${cache}.`);
|
||||
addPath(cache);
|
||||
@ -23,7 +24,7 @@ export default async(release: Release) => {
|
||||
const newCache = await cacheDir(
|
||||
extracted,
|
||||
'bun',
|
||||
release.tag_name
|
||||
release.version
|
||||
);
|
||||
|
||||
info(`Cached Bun to ${newCache}.`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user