npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

find-npm-by-author

v0.0.4

Published

Looks for local NPM packages by their author or URL

Downloads

9

Readme

find-npm-by-author

Latest version Dependency status

Looks for local NPM packages by their author or URL. Can be used to detect packages of authors, whose work you want to fund, or who you want to avoid.

Synopsis

Find all packages installed in the local node_modules authored by me, or with prantlf in the repository URL:

npx find-npm-by-author -A prantl -R prantlf

And the same programmatically:

import { findByAuthor } from 'find-npm-by-author'
const { directories } = await findByAuthor({ authors: ['prantl'], repositories: ['prantlf'] })
for (const directory of directories) console.log(directory)

Installation

The command-line tool is usually installed globally. The package can be installed locally too for the programmatic usage. You can use your favourite package manager like NPM, PNPM or Yarn. Make sure, that you use Node.js version 10 or newer:

npm i find-npm-by-author
pnpm i find-npm-by-author
yarn add find-npm-by-author

Command Line

Paths to directories paths with matching packages will be printed on the console.

find-npm-by-author [option...]

Options:
  -A|--author <word>      word to match in the name of the author
  -H|--homepage <word>    word to match in the home page URL
  -R|--repository <word>  word to match in the repository or bugs URL
  -p|--path <path>        path to modules to search (default: node_modules)
  -V|--version            print version number
  -h|--help               print usage instructions

Words will be matched as expressions with a word boundary, enclosed by \b.
The arguments can be specified multiple times to try one of several words.

API

This package exposes the following names exports.

findByAuthor({ path, authors, homepages, repositories }): result[]

Input parameters are expected as an object with the following properties. At least one of the arrays authors, homepages or repositories must not be empty.

| property | type | default | description | |:---------------|:-----------|:-----------------|:------------------------------------------------------------| | path | string | 'node_modules' | path to the directory with NPM modules to search | | authors | string[] | [] | word expressions to match in names of package authors | | homepages | string[] | [] | word expressions to match in the package home page URL | | repositories | string[] | [] | word expressions to match in package repository or bug URLs |

Output is an object with the following properties:

| property | type | description | |:---------------|:-----------|:----------------------------------------| | directories | string[] | directory paths with matching packages | | errors | object[] | errors from reading or parsing packages |

An error is described by an object with the following properties:

| property | type | description | |:----------|:---------|:--------------------------------------------------------------------------| | error | Error | the original error thrown when reading or parsing a package | | file | string | the path to the file which was processed when the error was thrown | | content | string | the content of the processed file if reading succeeded and parsing failed |

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.

License

Copyright (c) 2022 Ferdinand Prantl

Licensed under the MIT license.