Skip to content

fix: command for create-* packages in Deno#2357

Open
knotbin wants to merge 2 commits intonpmx-dev:mainfrom
knotbin:deno-create-cmd
Open

fix: command for create-* packages in Deno#2357
knotbin wants to merge 2 commits intonpmx-dev:mainfrom
knotbin:deno-create-cmd

Conversation

@knotbin
Copy link
Copy Markdown

@knotbin knotbin commented Apr 1, 2026

🔗 Linked issue

resolves #2337

🧭 Context

For example package create-example, Current Deno command deno run example is incorrect and errors out.

This PR fixes that and changes it to the correct deno create command.

📚 Description

This is a simple change that just changes the Deno command for create to the correct deno create npm:example command.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Apr 1, 2026 9:07pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Apr 1, 2026 9:07pm
npmx-lunaria Ignored Ignored Apr 1, 2026 9:07pm

Request Review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Hello! Thank you for opening your first PR to npmx, @knotbin! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@knotbin knotbin changed the title fix: Deno command for create- packages fix: command for create-* packages in Deno Apr 1, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Terminal/Install.vue 0.00% 4 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

The install-command.ts utility has been updated to generate correct Deno commands for create-scoped packages. When handling isCreatePackage scenarios where the derived shortName differs from the original packageName, the code now generates ['deno', 'create', 'npm:<shortName>'] command parts instead of delegating to the generic pm.create mapping. This ensures Deno receives the deno create subcommand with the appropriate npm package specifier, addressing the previous incorrect deno run invocation. Corresponding test expectations have been updated to validate the new command output.

Possibly related PRs

Suggested reviewers

  • serhalp
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR partially addresses issue #2337 by implementing 'deno create npm:' but does not implement support for Deno <2.7 requiring 'deno init --npm example'. Implement conditional logic to support both Deno ≥2.7 ('deno create npm:example') and Deno <2.7 ('deno init --npm example') as specified in issue #2337.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The PR description clearly relates to the changeset, explaining the correction of Deno command generation for create-packages from 'deno run' to 'deno create npm:'.
Out of Scope Changes check ✅ Passed All changes in app/utils/install-command.ts and test files are directly scoped to fixing the Deno create command generation for create-packages as required by the linked issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/unit/app/utils/install-command.spec.ts (1)

397-417: Consider adding test coverage for Deno scoped create packages.

The scoped create package tests only cover npm. Since the Deno implementation now includes the npm: prefix handling (lines 140-142 in install-command.ts), it would be beneficial to verify this works correctly for scoped packages like @vue/create-app['deno', 'create', 'npm:@vue/app'].

🧪 Suggested test additions
       it('handles `@scope/create` pattern', () => {
         expect(
           getExecuteCommandParts({
             packageName: '@angular/create',
             packageManager: 'npm',
             isCreatePackage: true,
           }),
         ).toEqual(['npm', 'create', '@angular'])
       })
+
+      it('handles `@scope/create-app` pattern for deno with npm: prefix', () => {
+        expect(
+          getExecuteCommandParts({
+            packageName: '@vue/create-app',
+            packageManager: 'deno',
+            isCreatePackage: true,
+          }),
+        ).toEqual(['deno', 'create', 'npm:`@vue/app`'])
+      })
     })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e552c239-b5fb-47f2-941a-926cabf91abb

📥 Commits

Reviewing files that changed from the base of the PR and between 2af4011 and 71ba4c2.

📒 Files selected for processing (2)
  • app/utils/install-command.ts
  • test/unit/app/utils/install-command.spec.ts

Comment on lines +140 to +142
if (options.packageManager === 'deno') {
return ['deno', 'create', `npm:${shortName}`]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how Install.vue handles create commands for Deno
rg -n -A 15 'getCreatePartsForPM' --type vue

Repository: npmx-dev/npmx.dev

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Search for all usages of pm.create to see if there are other places needing updates
rg -n 'pm\.create' --type ts --type vue

Repository: npmx-dev/npmx.dev

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Locate the files mentioned in the review
fd -e ts -e vue install-command
fd -e vue Install

Repository: npmx-dev/npmx.dev

Length of output: 261


🏁 Script executed:

#!/bin/bash
# Read the install-command.ts file around lines 140-142
cat app/utils/install-command.ts | head -n 150 | tail -n 20

Repository: npmx-dev/npmx.dev

Length of output: 814


🏁 Script executed:

#!/bin/bash
# Search for the Install.vue file and read it
find . -name "Install.vue" -type f 2>/dev/null | head -5

Repository: npmx-dev/npmx.dev

Length of output: 98


🏁 Script executed:

#!/bin/bash
# Read the Install.vue file to check the getCreatePartsForPM function around lines 61-79
cat -n app/components/Terminal/Install.vue | sed -n '50,100p'

Repository: npmx-dev/npmx.dev

Length of output: 2074


🏁 Script executed:

#!/bin/bash
# Search for usages of getCreatePartsForPM and getExecuteCommandParts
rg -n 'getCreatePartsForPM|getExecuteCommandParts' app/components/Terminal/Install.vue app/utils/install-command.ts

Repository: npmx-dev/npmx.dev

Length of output: 555


🏁 Script executed:

#!/bin/bash
# Check if Install.vue imports anything from install-command.ts
rg -n 'import.*install-command|from.*install-command' app/components/Terminal/Install.vue

Repository: npmx-dev/npmx.dev

Length of output: 126


Fix Deno create package handling inconsistency between install-command.ts and Install.vue.

The getExecuteCommandParts function in install-command.ts (lines 140–142) correctly generates ['deno', 'create', 'npm:${shortName}'] for Deno, but Install.vue's getCreatePartsForPM function (lines 61–79) duplicates this logic without the npm: prefix, producing ['deno', 'create', shortName] instead. This inconsistency mirrors the existing Deno handling in getTypesInstallPartsForPM (line 88), which correctly uses the npm: prefix.

Update getCreatePartsForPM in Install.vue to add Deno-specific handling:

if (pmId === 'deno') {
  return ['deno', 'create', `npm:${shortName}`]
}
return [...pm.create.split(' '), shortName]

Alternatively, refactor Install.vue to use getExecuteCommandParts from install-command.ts to eliminate duplication.

Copy link
Copy Markdown
Contributor

@ghostdevv ghostdevv left a comment

Choose a reason for hiding this comment

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

Could you take a look at the coderabbit suggestion?

@knotbin
Copy link
Copy Markdown
Author

knotbin commented Apr 1, 2026

@ghostdevv So sorry, I should have scrolled farther when I got the CodeRabbit review, I assumed the first comment was its full review. 😅

Comment on lines +140 to +142
if (options.packageManager === 'deno') {
return ['deno', 'create', `npm:${shortName}`]
}
Copy link
Copy Markdown
Contributor

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?

@ghostdevv
Copy link
Copy Markdown
Contributor

@ghostdevv So sorry, I should have scrolled farther when I got the CodeRabbit review, I assumed the first comment was its full review. 😅

no worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deno command for create- packages is wrong/non-functional

2 participants