Skip to content

Commit 8e5c964

Browse files
fengmk2claude
andauthored
refactor: remove bun support (not yet implemented) (#1)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e4b2a52 commit 8e5c964

6 files changed

Lines changed: 64 additions & 109 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ This is a GitHub Action with main and post execution phases (defined in `action.
5959

6060
### Lock File Detection
6161

62-
Auto-detects package manager from lock files: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`
62+
Auto-detects package manager from lock files: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`
6363

6464
## Testing
6565

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`@vo
88
- Support both npm Registry and GitHub Package Registry
99
- Cache project dependencies with auto-detection of lock files
1010
- Optionally run `vite install` after setup
11-
- Support for all major package managers (npm, pnpm, yarn, bun)
11+
- Support for all major package managers (npm, pnpm, yarn)
1212

1313
## Requirements
1414

@@ -113,7 +113,6 @@ When `cache: true` is set, the action automatically detects your lock file and c
113113
| `pnpm-lock.yaml` | pnpm | pnpm store |
114114
| `package-lock.json` | npm | npm cache |
115115
| `yarn.lock` | yarn | yarn cache |
116-
| `bun.lockb` | bun | bun cache |
117116

118117
The cache key format is: `vite-plus-{OS}-{arch}-{pm}-{lockfile-hash}`
119118

dist/index.mjs

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export enum LockFileType {
3434
Npm = "npm",
3535
Pnpm = "pnpm",
3636
Yarn = "yarn",
37-
Bun = "bun",
3837
}
3938

4039
export interface LockFileInfo {

src/utils.test.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,6 @@ describe("detectLockFile", () => {
6363
});
6464
});
6565

66-
it("should return lock file info for bun.lockb", () => {
67-
vi.mocked(existsSync).mockReturnValue(true);
68-
69-
const result = detectLockFile("bun.lockb");
70-
71-
expect(result).toEqual({
72-
type: LockFileType.Bun,
73-
path: join(mockWorkspace, "bun.lockb"),
74-
filename: "bun.lockb",
75-
});
76-
});
77-
7866
it("should return undefined if explicit file does not exist", () => {
7967
vi.mocked(existsSync).mockReturnValue(false);
8068

@@ -144,7 +132,7 @@ describe("detectLockFile", () => {
144132
});
145133

146134
it("should detect yarn.lock when higher priority files are absent", () => {
147-
vi.mocked(readdirSync).mockReturnValue(["yarn.lock", "bun.lockb"] as unknown as ReturnType<
135+
vi.mocked(readdirSync).mockReturnValue(["yarn.lock"] as unknown as ReturnType<
148136
typeof readdirSync
149137
>);
150138

@@ -157,20 +145,6 @@ describe("detectLockFile", () => {
157145
});
158146
});
159147

160-
it("should detect bun.lockb when no other lock files present", () => {
161-
vi.mocked(readdirSync).mockReturnValue(["bun.lockb"] as unknown as ReturnType<
162-
typeof readdirSync
163-
>);
164-
165-
const result = detectLockFile();
166-
167-
expect(result).toEqual({
168-
type: LockFileType.Bun,
169-
path: join(mockWorkspace, "bun.lockb"),
170-
filename: "bun.lockb",
171-
});
172-
});
173-
174148
it("should return undefined when no lock files found", () => {
175149
vi.mocked(readdirSync).mockReturnValue([
176150
"package.json",

src/utils.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { info, warning, debug } from "@actions/core";
22
import { getExecOutput } from "@actions/exec";
33
import { existsSync, readdirSync } from "node:fs";
44
import { isAbsolute, join, basename } from "node:path";
5-
import { homedir } from "node:os";
65
import { LockFileType } from "./types.js";
76
import type { LockFileInfo } from "./types.js";
87

@@ -12,7 +11,6 @@ const LOCK_FILES: Array<{ filename: string; type: LockFileType }> = [
1211
{ filename: "package-lock.json", type: LockFileType.Npm },
1312
{ filename: "npm-shrinkwrap.json", type: LockFileType.Npm },
1413
{ filename: "yarn.lock", type: LockFileType.Yarn },
15-
{ filename: "bun.lockb", type: LockFileType.Bun },
1614
];
1715

1816
/**
@@ -67,9 +65,6 @@ function inferLockFileType(fullPath: string, filename: string): LockFileInfo {
6765
if (filename.includes("yarn")) {
6866
return { type: LockFileType.Yarn, path: fullPath, filename };
6967
}
70-
if (filename.includes("bun")) {
71-
return { type: LockFileType.Bun, path: fullPath, filename };
72-
}
7368
// Default to npm
7469
return { type: LockFileType.Npm, path: fullPath, filename };
7570
}
@@ -83,8 +78,6 @@ export async function getCacheDirectories(lockType: LockFileType): Promise<strin
8378
case LockFileType.Pnpm:
8479
case LockFileType.Yarn:
8580
return getViteCacheDir();
86-
case LockFileType.Bun:
87-
return getBunCacheDir();
8881
default:
8982
return [];
9083
}
@@ -112,13 +105,3 @@ async function getViteCacheDir(): Promise<string[]> {
112105
const cacheDir = await getCommandOutput("vite", ["pm", "cache", "dir"]);
113106
return cacheDir ? [cacheDir] : [];
114107
}
115-
116-
async function getBunCacheDir(): Promise<string[]> {
117-
const cacheDir = await getCommandOutput("bun", ["pm", "cache"]);
118-
if (cacheDir) return [cacheDir];
119-
120-
// Fallback to default location
121-
const home = homedir();
122-
const defaultCache = join(home, ".bun", "install", "cache");
123-
return existsSync(defaultCache) ? [defaultCache] : [];
124-
}

0 commit comments

Comments
 (0)