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

packman

v0.3.2

Published

text file packager tool

Downloads

35

Readme

packman is a command line tool that can package text files together.

packman was born of the need to group several JavaScript files together in one big, minified, versioned JavaScript file to improve websites' performance, therefore this is its most common use case. However, packman works with any type of text files and can package any number of files in any number of crazy ways you want.

Basic usage

Install: npm install packman

Usage: packman -c path/to/myconfig.json -l 4

Options:
  -c, --config   Path to the config file to use                                                     [required]
  -l, --logging  Logging level (only errors = 1, also warnings = 2, also info = 3, also debug = 4)  [default: 1]

Config files are written in yaml and look like this

source: my/source/dir
destination: my/target/dir
visitors:
    - coffeescript
    - jsmin
packages:
    main.js:
        files:
            - CORE.js
            - CORE/Object.js
            - CORE/Logging.js
    utils.js:
        files:
            includes:
                - CORE/utils/**/*.js
            excludes:
            	- CORE/utils/specials/*.js
    css/styles.css:
        visitors:
            - less
        files:
            includes:
                - **/*.less

The first level of the config contains general configuration like the source and destination folders to work on.

Then, inside the packages node, is the list of all packages to be created.

Files to be included inside a package are given in the files sub-node and can be either an array of file names, or an object with either includes or excludes or both. These sub-properties are arrays of file names or ant pattern (?, *, **). If an array of files is provided, the files will be merged in this order.

Visitors

You may have noticed that the configuration accepts a visitors array. A visitor is a piece of code that transform package content, package name and file content while things are done. This is the way to get packages perfectly fit to your needs.

You can imagine using visitors for pretty much anything you want. Visitors can alter the file content but also package file names and locations or simply output other files.

Examples of visitors include (but are not restricted to) including separators between the files, minifying file content, renaming package files to include a version number, processing less css or coffeescript files.

A bunch of existing visitors can already be used from the visitors folder.

Visitors can be specified either globally at the top level of the config file, or locally, within each package definition. Visitors are configure through an array, and are, therefore, run in a sequence, one after the other.

A visitor in packman is simply a nodejs module that exports any of the following functions:

// At the very start, even before any files have been packaged
onStart: function(callback, config) {},

// Before starting to package a set of files together
onPackageStart: function(callback, config, packageFileObject) {},

// Before a file is being inserted into a package
onFileStart: function(callback, config, packageFileObject) {},

// When inserting the content of a file into a package
onFileContent: function(callback, config, fileObject) {},

// After a file has been inserted into a package
onFileEnd: function(callback, config, packageFileObject) {},

// After having packaged a set of files together
onPackageEnd: function(callback, config, packageFileObject) {},

// At the end, when all packages are done
onEnd: function(callback, config) {}

Visitors' methods can be asynchronous if needed, this is why they accept a callback as their first parameter. Once their processing is done, they must call the callback to allow packman to continue looping on other visitors, and ultimately on other files and packages.

Note that since the config is passed as argument to the above methods, you can add extra data to it to be used by visitors.

Most visitors' methods accept a packageFileObject as argument while the onFileContent method accepts a fileObject argument, here are their interfaces:

PackageFile = {
    path: "the logical path of the package file",
    content: "the current content of the package file",
    currentFile: "reference to the File instance that is currently being packaged if any"
};

File =  {
    path: "the logical path of the file",
    physicalPath: "the physical path of the file",
    content: "the current content of the file",
    packageFile: "reference to the PackageFile including this file"
};

Most visitors will want to modify the fileObject.content on the fly (to minify javascript for instance) or to append content to the packageFileObject.content (to insert separators for instance).