fix: command for create-* packages in Deno#2357
fix: command for create-* packages in Deno#2357knotbin wants to merge 5 commits intonpmx-dev:mainfrom
create-* packages in Deno#2357Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Hello! Thank you for opening your first PR to npmx, @knotbin! 🚀 Here’s what will happen next:
|
create-* packages in Deno
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThis PR updates Deno's package managers configuration to use Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
app/utils/install-command.tstest/unit/app/utils/install-command.spec.ts
ghostdevv
left a comment
There was a problem hiding this comment.
Could you take a look at the coderabbit suggestion?
|
@ghostdevv So sorry, I should have scrolled farther when I got the CodeRabbit review, I assumed the first comment was its full review. 😅 |
app/utils/install-command.ts
Outdated
| if (options.packageManager === 'deno') { | ||
| return ['deno', 'create', `npm:${shortName}`] | ||
| } |
There was a problem hiding this comment.
Could we instead set the shortName to npm:? How are we handling the other cases where we need to prefix with npm: for deno?
There was a problem hiding this comment.
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
./createexport
no worries! |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: face9f72-296d-40a4-acec-f22fb58083dd
📒 Files selected for processing (3)
app/components/Terminal/Install.vueapp/utils/install-command.tsshared/utils/package-analysis.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- app/utils/install-command.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/utils/install-command.ts (1)
128-144: Well-structured helper function for Deno npm compatibility.The new
getCreatePackageSpecifierfunction cleanly encapsulates the logic for generating create package specifiers with appropriate Deno-specific handling (npm:prefix). The guard at lines 135-137 is a sensible defensive check to ensure we only use the create command flow when an actual transformation occurred.One minor consideration: if
getCreateShortNameever returns an empty string unexpectedly, Deno would receivenpm:as the specifier. Consider whether additional validation is warranted:💡 Optional defensive check
const shortName = getCreateShortName(packageName) - if (shortName === packageName) { + if (!shortName || shortName === packageName) { return null }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bcdeb143-59ad-4a65-8950-4485ef929e6a
📒 Files selected for processing (1)
app/utils/install-command.ts
🔗 Linked issue
resolves #2337
🧭 Context
For example package
create-example, Current Deno commanddeno run exampleis incorrect and errors out.This PR fixes that and changes it to the correct
deno createcommand.📚 Description
This is a simple change that just changes the Deno command for create to the correct
deno create npm:examplecommand.