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

pkg-reflector

v3.6.0

Published

Find and install the npm modules

Downloads

65

Readme

pkg-reflector

Build Status NPM version npm npm David

Find and install the npm modules your js files used


New

  • use flag --custom-cmds="external install tool" override the install command, eg: --custom-cmds="cnpm install"

  • use flag --dry to dry run, show the finded npm modules

  • use flag --npm or --yarn choose installing tool (default: prefer yarn if available)

  • support alias prf for pkg-reflector

  • now support multi files, can be used like pkg-reflector src/* libs/* *.js, resolve files using globby and always ignore **/node_modules/**

Install

$ npm install -g pkg-reflector
# using yarn
$ yarn global add pkg-reflector

Feature

Sometimes, we copy some js file from other folder or project, such as rollup.config.js,you only want to use it in your current project.

If the js file depends some npm modules, you should install these first by yourself, like this:

$ yarn add module1 module2 module3...

we may get some error when add modules cause wrong spelling of the long module name, so use pkg-reflector, you can do it like this:

$ prf foo.js
# then all done

easy way, isn't it ?

Usage

$ prf <js file[s]> [options]
# use 'prf -h' for more help

simple

$ prf <file>

will install the pkgs and save dependence.

multi files

$ prf file1 file2 ...

or use patterns all sindresorhus/globby support

$ prf "./**/*.js" 

Note: you should pass args as string "./**/*.js", not ./**/*.js(this will be executed by terminal, if it contains node_modules folder maybe cause error zsh: argument list too long)