Skip to content
Open
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
30 changes: 30 additions & 0 deletions src/discover/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,7 @@ mod tests {
"npx prisma",
"pnpm prisma",
"pnpx prisma",
"bunx prisma",
"prisma",
];
for command in commands {
Expand Down Expand Up @@ -2885,6 +2886,7 @@ mod tests {
"npx prisma",
"pnpm prisma",
"pnpx prisma",
"bunx prisma",
"prisma",
];
for command in commands {
Expand All @@ -2897,6 +2899,34 @@ mod tests {
}
}

#[test]
fn test_rewrite_bunx_prisma_subcommands() {
// #1401: exercise the full Prisma surface that the reporter said hits
// unfiltered with bun. The classify_command/rewrite tests above already
// cover `migrate dev` for every runner; this nails down each subcommand
// shape verbatim so a future regex tweak doesn't silently drop one.
let cases = [
("bunx prisma migrate dev", "rtk prisma migrate dev"),
(
"bunx prisma migrate dev --name add_col",
"rtk prisma migrate dev --name add_col",
),
("bunx prisma migrate deploy", "rtk prisma migrate deploy"),
("bunx prisma migrate status", "rtk prisma migrate status"),
("bunx prisma generate", "rtk prisma generate"),
("bunx prisma db seed", "rtk prisma db seed"),
("bunx prisma studio", "rtk prisma studio"),
];
for (input, expected) in cases {
assert_eq!(
rewrite_command_no_prefixes(input, &[]),
Some(expected.into()),
"Failed for input: {}",
input
);
}
}

#[test]
fn test_rewrite_prettier() {
let commands = vec![
Expand Down
7 changes: 6 additions & 1 deletion src/discover/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,15 @@ pub const RULES: &[RtkRule] = &[
subcmd_savings: &[],
subcmd_status: &[],
},
// #1401: Bun is now the primary JS runtime on a growing share of Prisma
// projects. `bunx prisma <sub>` is semantically equivalent to
// `npx prisma <sub>` (same CLI, same output format), so it routes through
// the same `rtk prisma` filter — no new output-handling logic required.
RtkRule {
pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx)\s+)?prisma",
pattern: r"^((p?np(m|x)|p?npm\s+(exec|run|run-script)|npm\s+(rum|urn|x)|pnpm\s+dlx|bunx)\s+)?prisma",
rtk_cmd: "rtk prisma",
rewrite_prefixes: &[
"bunx prisma",
"npm exec prisma",
"npm prisma",
"npm rum prisma",
Expand Down
Loading