Skip to content

Add "Search npm" extension - #95

Merged
thomaspaulmann merged 4 commits into
raycast:mainfrom
mrmartineau:main
Oct 20, 2021
Merged

thomaspaulmann merged 4 commits into
raycast:mainfrom
mrmartineau:main

Conversation

@mrmartineau

@mrmartineau mrmartineau commented Oct 18, 2021 •

Copy link
Copy Markdown
Contributor

Description

Extension to search for npm package using npms.io

Features

  • search npm packages using npms.io
  • hit ENTER to view the package's homepage
  • view the package's bundlephobia.com cost. hit ⌘ ENTER
  • view the package's README in Raycast
  • view the package's Snyk vulnerability report
  • view the package source code on GitHub.dev & CodeSandbox
  • copy yarn/npm install commands to clipboard

Type of change

  • New extension

Screencast

raycast-npms.mp4

Checklist

@thomaspaulmann thomaspaulmann left a comment •

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.

This is really cool! I can't wait to find my npm packages quicker with Raycast :-) I left a few inline comments to change the naming to follow our UI guidelines, which is most often title case. Also, please make sure to update the icon to be 512x512px.

Can you please apply the suggestions and then we should be good to go.

Comment thread extensions/search-npm/package.json Resolved
Comment thread extensions/search-npm/package.json Resolved
Comment thread extensions/search-npm/package.json Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
Comment thread extensions/search-npm/src/index.tsx Resolved
@mrmartineau

Copy link
Copy Markdown
Contributor Author

@thomaspaulmann I updated the PR based on your comments. I also added a couple of extra features:

  • view code in github.dev
  • view code in CodeSandbox

{type === 'github' || (type === 'gitlab' && owner && name) ? (
<OpenInBrowserAction
url={`https://codesandbox.io/s/${
type === 'github' ? 'github' : 'gitlab'

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.

Bitbucket? ;-)

@thomaspaulmann thomaspaulmann left a comment

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.

Thanks for applying all the changes and adding even more features. Let's get this into the store. If you have something new, just open another PR.

@thomaspaulmann
thomaspaulmann merged commit 5f6ef8b into raycast:main Oct 20, 2021
@PitNikola

Copy link
Copy Markdown
Member

@mrmartineau, cool extension. Any idea why it doesn't find "@raycast/api" search string?

CleanShot 2021-10-20 at 10 14 29@2x

CleanShot 2021-10-20 at 10 15 09@2x

@mrmartineau

mrmartineau commented Oct 20, 2021 •

Copy link
Copy Markdown
Contributor Author

@PitNikola

cool extension.

Thanks..

Any idea why it doesn't find "@raycast/api" search string?

The search is based on npms.io which also does not return any results for that query, see https://npms.io/search?q=%40raycast%2Fapi

❯ curl "https://api.npms.io/v2/search?q=@raycast/api"
{"total":0,"results":[]}⏎

Perhaps the special chars need to be escaped..

@mrmartineau

Copy link
Copy Markdown
Contributor Author

After further investigation, the npm website uses this query: https://www.npmjs.com/search/suggestions?q=@raycast/api which does return results.

I will see if we're allowed to use the npm API, which is based on npms (very odd that they don't return the same values though..)

See more info about that here

You can use the npm search bar to find packages to use in your projects. npm search uses npms and the npms analyzer; for more information on both, see https://npms.io/about.

❯ curl "https://www.npmjs.com/search/suggestions?q=@raycast/api"
[{"name":"@raycast/api","scope":"raycast","version":"1.25.0","description":"Build extensions for Raycast with React and Node.js.","date":"2021-10-13T12:17:57.474Z","links":{"npm":"https://www.npmjs.com/package/%40raycast%2Fapi","homepage":"https://developers.raycast.com"},"author":{"name":"Raycast Technologies Ltd."},"publisher":{"username":"raycastbot","email":"[email protected]"},"maintainers":[{"username":"pitnikola","email":"[email protected]"},{"username":"felix.rc","email":"[email protected]"},{"username":"raycastbot","email":"[email protected]"},{"username":"grzegorzkrukowski_raycast","email":"[email protected]"},{"username":"mattisssa","email":"[email protected]"},{"username":"thomaspaulmann","email":"[email protected]"}]},{"name":"@raycast/api_beta","scope":"raycast","version":"1.24.2","description":"Raycast API","date":"2021-10-11T18:34:20.065Z","links":{"npm":"https://www.npmjs.com/package/%40raycast%2Fapi_beta"},"author":{"name":"Raycast Technologies Ltd."},"publisher":{"username":"raycastbot","email":"[email protected]"},"maintainers":[{"username":"raycastbot","email":"[email protected]"},{"username":"grzegorzkrukowski_raycast","email":"[email protected]"},{"username":"mattisssa","email":"[email protected]"},{"username":"thomaspaulmann","email":"[email protected]"}]}]⏎

FezVrasta pushed a commit to FezVrasta/extensions that referenced this pull request Nov 24, 2021
* Add Search npm extension

* Various updates & improvements based on PR comments

* Update extensions/search-npm/src/index.tsx

* Update extensions/search-npm/package.json

Co-authored-by: Thomas Paul Mann <[email protected]>
jfox85 added a commit to jfox85/raycast-extensions that referenced this pull request Sep 19, 2025