Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 0.3.1 - Unreleased

- Fixed Express route mapping for aliased Router imports that follow block comment banners, thanks @rohitjavvadi.
- Fixed Bun package-manager detection to recognize the text `bun.lock` lockfile, thanks @austinm911.

## 0.3.0 - 2026-05-18

Expand Down
1 change: 1 addition & 0 deletions src/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ async function detectPackageManagers(root: string): Promise<string[]> {
["pnpm", "pnpm-lock.yaml"],
["npm", "package-lock.json"],
["yarn", "yarn.lock"],
["bun", "bun.lock"],
["bun", "bun.lockb"],
];
for (const [name, file] of nodeChecks) {
Expand Down
49 changes: 48 additions & 1 deletion src/mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,53 @@ describe("mapFeatures", () => {
]);
});

it("uses bun workspace commands when the root has a text bun lockfile", async () => {
const root = await fixtureRoot("clawpatch-task-graph-bun-lock-");
await writeFixture(
root,
"package.json",
JSON.stringify(
{
name: "workspace-root",
packageManager: "bun@1.3.3",
workspaces: ["apps/*"],
},
null,
2,
),
);
await writeFixture(root, "bun.lock", "");
await writeFixture(
root,
"apps/web/package.json",
JSON.stringify(
{
name: "web",
scripts: { test: "vitest run", build: "next build" },
dependencies: { next: "1.0.0" },
},
null,
2,
),
);
await writeFixture(
root,
"apps/web/app/page.tsx",
"export default function Page() { return null; }\n",
);
await writeFixture(root, "apps/web/app/page.test.tsx", "test('page', () => {});\n");

const project = await detectProject(root);
const result = await mapFeatures(root, project, []);
const route = result.features.find((feature) => feature.title === "web route /");

expect(project.detected.packageManagers).toContain("bun");
expect(project.detected.commands.test).toBeNull();
expect(route?.tests).toEqual([
{ path: "apps/web/app/page.test.tsx", command: "bun --cwd apps/web run test" },
]);
});

it("keeps Nx target commands on the workspace package manager", async () => {
const root = await fixtureRoot("clawpatch-map-nx-root-package-manager-");
await writeFixture(
Expand Down Expand Up @@ -3236,7 +3283,7 @@ describe("mapFeatures", () => {

it("uses bun run for root React package scripts", async () => {
const root = await fixtureRoot("clawpatch-react-root-bun-");
await writeFixture(root, "bun.lockb", "");
await writeFixture(root, "bun.lock", "");
await writeFixture(
root,
"package.json",
Expand Down
3 changes: 2 additions & 1 deletion src/mappers/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ async function nodePackageManagerForPackage(
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
"yarn.lock",
"bun.lock",
"bun.lockb",
"package-lock.json",
]) {
Expand Down Expand Up @@ -662,7 +663,7 @@ async function detectNodePackageManager(root: string): Promise<string> {
if (await pathExists(join(root, "yarn.lock"))) {
return "yarn";
}
if (await pathExists(join(root, "bun.lockb"))) {
if ((await pathExists(join(root, "bun.lock"))) || (await pathExists(join(root, "bun.lockb")))) {
return "bun";
}
return "npm";
Expand Down
1 change: 1 addition & 0 deletions src/mappers/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ async function hasPackageManagerMarker(root: string, packageRoot: string): Promi
(await pathExists(join(root, packageRoot, "pnpm-workspace.yaml"))) ||
(await pathExists(join(root, packageRoot, "package-lock.json"))) ||
(await pathExists(join(root, packageRoot, "yarn.lock"))) ||
(await pathExists(join(root, packageRoot, "bun.lock"))) ||
(await pathExists(join(root, packageRoot, "bun.lockb")))
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mappers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export async function detectNodePackageManager(root: string): Promise<string> {
if (await pathExists(join(root, "yarn.lock"))) {
return "yarn";
}
if (await pathExists(join(root, "bun.lockb"))) {
if ((await pathExists(join(root, "bun.lock"))) || (await pathExists(join(root, "bun.lockb")))) {
return "bun";
}
return "npm";
Expand Down