Skip to content

Commit

Permalink
fix: change run command for Deno to prepend npm: prefix (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
bartlomieju and benmccann authored Nov 28, 2024
1 parent 5af076e commit c50c6a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ function npmRun(agent: string) {
}
}

function denoRun() {
return (args: string[]) => {
return ['deno', 'run', `npm:${args[0]}`, ...args.slice(1)]
}
}

const npm: AgentCommands = {
'agent': ['npm', 0],
'run': npmRun('npm'),
Expand Down Expand Up @@ -87,7 +93,7 @@ const bun: AgentCommands = {

const deno: AgentCommands = {
'agent': ['deno', 0],
'run': ['deno', 'run', 0],
'run': denoRun(),
'install': ['deno', 'install', 0],
'frozen': ['deno', 'install', '--frozen'],
'global': ['deno', 'install', '-g', 0],
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/command.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`test deno run command > command handles args correctly 1`] = `
{
"args": [
"run",
"arg0",
"npm:arg0",
"arg1-0 arg1-1",
],
"command": "deno",
Expand Down

0 comments on commit c50c6a1

Please # to comment.