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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@miguelleonmarti/twine

v1.0.0

Published

A command line Twitter client (CLI)

Readme

Twine

A command line Twitter client (CLI)

Project Directory Structure

  • /bin: Options parsing, Help text, Command execution
  • /commands: User input, Console output, Sequence of steps
  • /lib: Store/load credentials, Make API calls, Utilities

Twine in Three Steps

  • Consumer API Key and Secret
  • Twitter Account Token and Secret
  • Specific Twitter API Call

Handling Errors

Workflow: /bin --> /commands --> /lib Errors: /lib --> /commands --> /bin

Exiting Node.js Correctly on Error

// This is an example of what NOT to do:
if (someConditionNotMet()) {
    printUsageToStdout();
    process.exit(1);
}

// How to properly set the exit code while letting
// the process exit gracefully
if (someConditionNotMet()) {
    printUsageToStdout();
    process.exitCode = 1;
}

Environment Variables

  • Consumer API Key and Secret:

    • TWINE_CONSUMER_KEY
    • TWINE_CONSUMER_SECRET
  • Twitter Account Token and Secret:

    • TWINE_ACCOUNT_KEY
    • TWINE_ACCOUNT_SECRET

Setting Environment Variables

set TWINE_CONSUMER_KEY=key
set TWINE_CONSUMER_SECRET=secret

Note:

  • Standard In: process.stdin
  • Standard Out: process.stdout
  • Standard Error: process.stderr
process.stdin.pipe(process.stdout)

Support params both on the command line and read from stdin

  • A single parameter
twine [some command] param
echo "param" | twine [some command]
  • Multiple parameters
twine [some command] param1, param2
twine [some command] < param-file.txt
param-generator | twine [some command]

Examples:

param-generator | twine lookup users
  1. process.stdin
  2. split on newline
  3. batches of 100
  4. Twitter API(s)
  5. flatten
  6. JSON stringify
  7. process.stdout
twine lookup users user1,user2
  1. CLI params
  2. array
  3. batches of 100
  4. Twitter API(s)
  5. flatten
  6. JSON stringify
  7. process.stdout

Several New Stream-related Modules

  • split2
  • parallel-transform
  • through2
  • JSONStream
  • from2-array
  • promise-streams

Example

users.txt

user1
user2

cmd

type users.txt | twine lookup users

JQ (find out more about this)

choco install jq

Publish our command line app!

Publishing to npm

Two simple commands:

  • npm login
  • npm publish

However we need a scoped package: @miguelleonmarti/twine (miguelleonmarti is the scope) Why using scoped packages in npm? Due to private packages, grouping, namespacing

Executing Binaries Directly with npx

  • Typical module usage:
npm install -g @miguelleonmarti/twine
twine lookup users miguelleonmarti
  • With npx:
npx @miguelleonmarti/twine lookup users miguelleonmarti

Automatically check for updates

Automate our deployments

Create a Docker image for our CLI