Skip to content

Add pkg-swap extension#17910

Merged
raycastbot merged 15 commits intoraycast:mainfrom
neversitdull:ext/pkg-swap
Mar 26, 2025
Merged

Add pkg-swap extension#17910
raycastbot merged 15 commits intoraycast:mainfrom
neversitdull:ext/pkg-swap

Conversation

@neversitdull
Copy link
Contributor

@neversitdull neversitdull commented Mar 16, 2025

Description

Pkg Swap is a simple utility that converts copied npm commands into your preferred package manager (pnpm, bun, yarn).
The extension includes 4 commands:

  1. Swap (This converts from npm to the default pkg manager set in the extension settings)
  2. Swap pnpm (converts npm commands to pnpm)
  3. Swap yarn (converts npm commands to yarn)
  4. Swap bun (converts npm commands to bun)

The goal of the extension is to make it easy to quickly copy npm commands and run them in your terminal or editor using one of the other package managers. This is especially useful when docs only share an example using npm.

Screencast

Here's a quick screencast showing the feature of copying a npm command from the Next.js docs and pasting into a terminal (Warp)
Screencast

Checklist

- Update package.json and add screenshot
- Initial commit
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Mar 16, 2025
@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days

Once the PR is approved and merged, the extension will be available on our Store.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds a new extension "Pkg Swap" that converts npm commands to other package managers (pnpm, yarn, bun) with support for multiple command patterns and clipboard integration.

  • Title in extensions/pkg-swap/CHANGELOG.md ("Package Morph") doesn't match the extension title in package.json ("Pkg Swap")
  • Commands in extensions/pkg-swap/package.json should have subtitles set to "Pkg Swap" for better context
  • launchCommand in extensions/pkg-swap/src/swap.ts should be wrapped in a try-catch block
  • Consider using showFailureToast from @raycast/utils in extensions/pkg-swap/src/lib/converter.ts instead of manual error handling
  • Since this is a new extension with mode: "no-view" commands, a metadata folder with screenshots should be added as per documentation

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

13 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

neversitdull and others added 9 commits March 16, 2025 13:42
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ridemountainpig
Copy link
Contributor

I tested it locally, and it works great. However, I'm now considering that since there are three separate commands for pnpm, bun, and yarn that users can use directly, do we still need the Swap command?

@neversitdull
Copy link
Contributor Author

However, I'm now considering that since there are three separate commands for pnpm, bun, and yarn that users can use directly, do we still need the Swap command?

Yeah, I thought about this too. The way I was thinking about it is that the Swap command would be the main command used, ideally with a hotkey set on paste. Then the others would be for more one-off situation (ie. you're testing bun in a small project, but it's not your main pkg manager pnpm). Maybe the one Swap command is enough though?

@ridemountainpig
Copy link
Contributor

However, I'm now considering that since there are three separate commands for pnpm, bun, and yarn that users can use directly, do we still need the Swap command?

Yeah, I thought about this too. The way I was thinking about it is that the Swap command would be the main command used, ideally with a hotkey set on paste. Then the others would be for more one-off situation (ie. you're testing bun in a small project, but it's not your main pkg manager pnpm). Maybe the one Swap command is enough though?

I think we can leave the pnpm, bun, and yarn commands as they are. If I have these three commands, I won't need to use the Swap command. Additionally, these commands allow users to set hotkeys for quicker access.

@pernielsentikaer
Copy link
Collaborator

Is this ready for another review?

@pernielsentikaer pernielsentikaer self-assigned this Mar 24, 2025
@neversitdull
Copy link
Contributor Author

Is this ready for another review?

I think so? Were the suggestions above requirements for the review? If so, I'll need to push an update first.

@pernielsentikaer
Copy link
Collaborator

If it makes sense to add it might be a good idea to do that before merge 🙂

@neversitdull
Copy link
Contributor Author

@pernielsentikaer updated to remove the main swap command in favor of the three base commands (per @ridemountainpig's suggestion). Should be all ready to go!

Co-authored-by: Yen Cheng Lin <92412722+ridemountainpig@users.noreply.github.com>
Copy link
Contributor

@ridemountainpig ridemountainpig left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

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

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit c948266 into raycast:main Mar 26, 2025
2 checks passed
@github-actions
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/neversitdull/pkg-swap

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@neversitdull).
Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag.

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

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants