-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add h2 shortcut with shell aliases #679
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing locally worked (Mac only)! The code here is still a bit confusing to me because I don't have a lot of knowledge about shell/OS stuff, but the code is easy enough to follow. I think this strikes a better balance for this feature wrt longer-term support. Do you mind adding some tests as well? Enough to mock each platform and assert that the various branches do what they should.
🚀 🚀 Thanks for continuing to push this forward!
This comment has been minimized.
This comment has been minimized.
🎉🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀🚀🚀
} | ||
|
||
// Create a PowerShell function and an alias to call it. | ||
const PS_FUNCTION = `function Invoke-Local-H2 {$npmPrefix = npm prefix -s; Invoke-Expression "$npmPrefix\\node_modules\\.bin\\shopify.ps1 hydrogen $Args"}; Set-Alias -Name ${ALIAS_NAME} -Value Invoke-Local-H2`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are a powershell ninja
Like #430 but only creating aliases at the shell level. Something similar to
alias h2='$(npm bin)/shopify hydrogen'
in ZSH/Bash.🎩 :
cd templates/hello-world
npx shopify hydrogen shortcut
<-- creates the shell h2 aliash2 g r cart
Notes:
static aliases
work in Oclif. No idea why, it just ignores them.