Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion app/utils/install-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const packageManagers = [
action: 'add',
executeLocal: 'deno run',
executeRemote: 'deno run',
create: 'deno run',
create: 'deno create',
icon: 'i-simple-icons:deno',
},
{
Expand Down Expand Up @@ -137,6 +137,9 @@ export function getExecuteCommandParts(options: ExecuteCommandOptions): string[]
if (options.isCreatePackage) {
const shortName = getCreateShortName(options.packageName)
if (shortName !== options.packageName) {
if (options.packageManager === 'deno') {
return ['deno', 'create', `npm:${shortName}`]
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead set the shortName to npm:? How are we handling the other cases where we need to prefix with npm: for deno?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a helper function getCreatePackageSpecifier to handle this logic, similar to the getPackageSpecifier function that handles other cases of the npm: prefix.

This logic is purposefully separate from the other npm prefix logic because JSR is not yet handled (out of this PR's scope) for create-* packages and if checks for matching JSR packages of create-* packages are added in the future (as they are for the other logic), it would be very different from the JSR logic in getPackageSpecifier because:

  • jsr: specifier isn't needed for create command, unlike install command
  • JSR "create" or "template" packages are required to have a ./create export

return [...pm.create.split(' '), shortName]
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/app/utils/install-command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('install command generation', () => {
['pnpm', ['pnpm', 'create', 'vite']],
['yarn', ['yarn', 'create', 'vite']],
['bun', ['bun', 'create', 'vite']],
['deno', ['deno', 'run', 'vite']],
['deno', ['deno', 'create', 'npm:vite']],
['vlt', ['vlx', 'vite']],
] as const)('%s → %s', (pm, expected) => {
expect(
Expand Down
Loading