Coder Social home page Coder Social logo

sindresorhus / alfred-npms Goto Github PK

View Code? Open in Web Editor NEW
363.0 8.0 26.0 203 KB

Alfred 3 workflow to search for npm packages with npms.io

License: MIT License

JavaScript 100.00%
alfred alfred-workflow alfred3-workflow nodejs alfy npm-package npm npms search search-engine

alfred-npms's Introduction

alfred-npms

Alfred workflow to search for npm packages with npms.io

npms.io is a great npm package search with deep analysis of package quality using a myriad of metrics. Much better than the official npmjs.com search.

Install

npm install --global alfred-npms

Requires Node.js 14+ and the Alfred Powerpack.

Usage

In Alfred, type npm, Enter, and your query, to search for packages.

Select a package and press Enter to go to its GitHub repo.
Hold Alt when pressing Enter to go to its npm page.
Hold Ctrl when pressing Enter to copy the package name to the clipboard.
Press Command to display additional information.
Press Shift to view its readme in Quick Look.

The search is made with boost-exact:false by default. You may pass any npms.io operators.

Related

alfred-npms's People

Contributors

litomore avatar mattfwood avatar patrik-csak avatar richienb avatar samverschueren avatar satazor avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred-npms's Issues

Workflows DIR not exist w/ new Alfred install

 npm install --global alfred-npms

> [email protected] postinstall /usr/local/lib/node_modules/alfred-npms
> alfy-init

{ Error: Command failed: alfred-link
Error: Workflow directory `/Users/dubba/repos/dotfiles-macbook-pro/alfred/Alfred.alfredpreferences/workflows` does not exist
    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/alfred-link/index.js:19:10)
    at <anonymous>

    at Promise.all.then.arr (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:201:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
  code: 1,
  killed: false,
  stdout: '',
  stderr: 'Error: Workflow directory `/Users/dubba/repos/dotfiles-macbook-pro/alfred/Alfred.alfredpreferences/workflows` does not exist\n    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/alfred-link/index.js:19:10)\n    at <anonymous>\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dubba/.npm/_logs/2018-04-12T19_01_01_940Z-debug.log

Install from NPM failed

Not sure if this is an issue with the alfred-link package, but it fails to find my user's Alfred preference files when install run as "sudo". However, on OS X to install packages globally, you must run as "sudo".
Here is the original NPM error:

[Error: Alfred preferences not found at location /Users/username/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist]
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "https://github.com/sindresorhus/alfred-npms.git"
npm ERR! node v5.7.0
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: alfred-link
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'alfred-link'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the alfred-npms package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! alfred-link
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs alfred-npms
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls alfred-npms
npm ERR! There is likely additional logging output above.

I confirmed the preferences plist is there at the path referenced above. I cloned the repo into the global folder at /usr/local/lib/node_modules and then did removed the post install script command, and did the "npm install -g" as sudo. Then I could manually run "alfred-link" in the directory (I had installed alfred-link globally via npm first).

RequestError: read ECONNRESET

Environment

  • MacOS Monterey 12.1
  • Node v16.13.2
  • Alfred 4.6.2

When I type anything, an error occurs.

"items": [
	{
		"title": "RequestError: read ECONNRESET",
		"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
		"valid": false,
		"text": {
			"copy": "```\nRequestError: read ECONNRESET\n    at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n    at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n```\n\n-\nnpms 3.0.0\nAlfred 4.6.2\ndarwin 21.2.0",
			"largetype": "RequestError: read ECONNRESET\n    at ClientRequest.<anonymous> (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/got/dist/source/core/index.js:962:111)\n    at ClientRequest.origin.emit (/Users/younho9/.nvm/versions/node/v16.13.2/lib/node_modules/alfred-npms/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)"
		},
		"icon": {
			"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
		}
	}
]

I found this issue comment, request/request-promise#147 (comment), and I added Connection: 'keep-alive' header to alfred-npms/node_modules/alfy/index.js:137 then the error has been resolved.

response = await got(url, {headers: {Connection: 'keep-alive'}, searchParams: options.query}).json();

Is there anyone else who experiences this error? I wonder if should add a Connection: 'keep-alive' header to the alfy.fetch.

Append '#readme' to GitHub

I think it would be much useful than just going to the GitHub page. I usually want to reference the README as fast as possible and this allows that.

Bundle to single workflow file

Would be great if you would bundle it to a single workflow file. I use NVM and don't want to add alfred workflows in every version. This would get messy at some point.

Bash error: cannot set terminal process group. Inappropriate ioctl for device

I downloaded the workflow from http://www.packal.org/workflow/npms-0 and installed it, but I cannot get the search to work.

Typing npm <enter> shows the expected screen screen shot 2016-06-27 at 9 47 10 am

but any typing after that turns into a "normal" alfred search screen shot 2016-06-27 at 9 48 27 am

I went into the workflow debugger and noticed the following debug output with each keystroke

Starting debug for 'npms'

[2016-06-27 09:42:47][ERROR: input.scriptfilter] Code 127: bash: cannot set terminal process group (18927): Inappropriate ioctl for device
bash: no job control in this shell
/Users/jschulz/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/BAA37249-3FCB-4A17-8851-29707885B376: line 9: node: command not found

node is installed. I'm assuming that's a cascading failure originating from the cannot set terminal process group error.

Let me know if I can do anything else to help debug or fix.

I followed the same steps and get the same behavior for https://github.com/sindresorhus/alfred-emoj. Let me know if you'd like me to open an issue there, as well.

Alfred 4 incompatible

Hi there,

I am getting the following error when I want to install this as an Alfred 4 Workflow:

error /Users/mbroder/.config/yarn/global/node_modules/alfred-npms: Command failed.
Exit code: 1
Command: alfy-init
Arguments:
Directory: /Users/mbroder/.config/yarn/global/node_modules/alfred-npms
Output:
{ Error: Command failed: alfred-link
Error: `Alfred.alfredpreferences` package does not exist
    at resolveAlfredPrefs.then.then.prefsExists (/Users/mbroder/.config/yarn/global/node_modules/alfred-link/index.js:27:12)


    at makeError (/Users/mbroder/.config/yarn/global/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/Users/mbroder/.config/yarn/global/node_modules/execa/index.js:278:16)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  code: 1,
  stdout: '',
  stderr:
   'Error: `Alfred.alfredpreferences` package does not exist\n    at resolveAlfredPrefs.then.then.prefsExists (/Users/mbroder/.config/yarn/global/node_modules/alfred-link/index.js:27:12)\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false,
  killed: false }
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

Would be great if we can get it to work with Alfred 4

Syncing across different Macs

This is a great workflow! The only issue for me is syncing across different machines since I'd like to use this on both my work and personal computers. From the Alfred docs, I've set up dropbox to keep my workflows consistent but installing this on one machine removes it from the other.

Stopped working

I'm using latest Alfred and this workflow stopped working for me.
The search never stops and the debugger output just shows:

[11:53:12.375] npms[Script Filter] Queuing argument 'r'
[11:53:12.432] npms[Script Filter] Queuing argument 're'
[11:53:12.519] npms[Script Filter] Queuing argument 'rea'
[11:53:12.668] npms[Script Filter] Queuing argument 'reac'
[11:53:12.816] npms[Script Filter] Queuing argument 'react'

Install error

What's going on here?

$ npm --global install alfred-npms
> [email protected] postinstall /usr/local/lib/node_modules/alfred-npms
> alfy-init

{ Error: Command failed: alfred-link
Error: Alfred preferences not found at location /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist
    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/resolve-alfred-prefs/index.js:15:10)


    at makeError (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/usr/local/lib/node_modules/alfred-npms/node_modules/execa/index.js:278:16)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
  code: 1,
  stdout: '',
  stderr:
   'Error: Alfred preferences not found at location /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n    at pathExists.then.exists (/usr/local/lib/node_modules/alfred-npms/node_modules/resolve-alfred-prefs/index.js:15:10)\n',
  failed: true,
  signal: null,
  cmd: 'alfred-link',
  timedOut: false,
  killed: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `alfy-init`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/folders/sh/xb5grs3d247c0cxy_7s57_2r0000gk/T/brewdo.2VFTfF5U/.npm/_logs/2019-02-23T03_35_58_148Z-debug.log

Publish on npm

Hi,

I'm looking to see if you can publish this module into npm as I have just recently developed this app which is made to be compatible with existing alfy workflows. Right now it works with my own alfy module but would like to see if become fully compatible with other alfy modules.

Install via NPM makes my Alfred Preferences unusable

I installed the workflow as suggested via the readme using npm install -g alfred-npms. On opening my Alfred preferences all I get is a white window 😕

Fortunately enough everything works again after uninstalling via npm.

Support Alfred 4 request

when I install alfred-npms , the npm raise an error

Error: Permission denied to read Alfred preferences at location /Users/manjusaka/Library/Preferences/com.runningwithcrayons.Alfred-Preferences-3.plist\n

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.