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 🙏

© 2025 – Pkg Stats / Ryan Hefner

reqchoir

v1.0.3

Published

Create new JavaScript files with all your requires required

Downloads

5

Readme

Create new JavaScript files with all your requires required.

####How to use / build

For this README you'll learn how to make reqchoir. Then you will know how to use it.

Create a new repo, clone it and cd into it.

From the command line in the root directory of your repo:

echo -e '#reqchoir\n\nCreate new JavaScript files with all your requires required.\n\n####Usage\n\n' > README.md

npm adduser

npm init

Add to your package.json the property: test: npm test.config.js test/*.js | faucet

npm i --save-dev tape pre-commit faucet

From the command line in the root directory of your repo:

echo node\/modules\/* > .gitignore

Add to package.json the property: pre-commit: test

write test.config, which will load all the files in /test and pipe them through tape into stdout:

var test = require('tape');
var path = require('path');

test.createStream().pipe(process.stdout);

process.argv.slice(2).forEach(function(file){
  require(path.resolve(file));
});

create index.js and test/index.test.js

write a passing version of test/index.test.js:

var test = require('tape');

test('index.js', function(t){
  t.plan(1);

  t.pass('t.pass');
});

npm i -s string-to-stream concat-stream

Here's index.js:

var file = require('path').resolve(process.argv.slice(2)[0]);
var modules = process.argv.slice(3);

var rechoir = modules.map(function(module){
  return "var " + module + " = require('" + module + "');";
}).join('\n');


var str = require('string-to-stream');
var ws = require('fs').createWriteStream(file);
str(rechoir).pipe(ws);

Use index.js as a template to write a test in index.test.js:

var test = require('tape');
var concat = require('concat-stream');

var modules = ['through2', 'concat-stream', 'ecstatic'];

var rechoir = modules.map(function(module){
  return "var " + module + " = require('" + module + "');";
}).join('\n');

var testFile = "var through2 = require('through2');\n" +
"var concat-stream = require('concat-stream');\n" +
"var ecstatic = require('ecstatic');";

var str = require('string-to-stream');
var writeableStream = concat(function(modules){
  
  test('index.js', function(t){
    t.plan(1);

    t.equals(modules.toString(), testFile);
  });
});


str(rechoir).pipe(writeableStream);

If you're publishing to npm, test it locally:

npm i -g ./

mkdir local_test/

cd temp/

reqchoir yes.js through2 trumpet fs hyperquest

confirm it worked:

cat yes.js

clean up:

cd .. rm -rf local_test/

And finally:

npm publish