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

pko

v0.0.8

Published

Run npm commands using a local registry overlay

Downloads

19

Readme

pko - Package Overlay

Build Status Maintainability Test Coverage npm package

pko is a drop-in replacement for npm that uses local files instead of the standard npm registry for the packages it has been set up with. If you're wondering why you would want to do such things, refer to the use-cases section of this document.

npm is a registered trademark of npm, Inc.

Usage

Adding a package to the pko overlay

Simply publish your packages using the pko command instead of the npm command (this cannot work for packages that have publishConfig or private: true in their package.json file). No authentication is required.

  • For a package you're developing:
    pko publish path/to/package
  • For a package from your npm registry of choice:
    TGZ=$(npm pack package[@version]) # Download the package locally
    pko publish ${TGZ}              # Publish the downloaded package
    rm ${TGZ}                         # Clean-up after yourself

Determine which packages you have in the pko overlay

The ls-overrides subcommand will list all packages present in the local overlay and output their name and (latest) version number to STDOUT.

pko ls-overrides

Install packages using the pko overlay

Simply replace invokations of npm with pko, using the exact same arguments:

pko install
pko install --save-dev @types/node
pko run build

Overlay location

The overlay location is determined using the following procedure:

  1. The environment variable $PKO_REPOSITORY
  2. Walk up the tree from $PWD (the process' working directory) until:
    1. A .pko directory is found
    2. The root of the filesystem is reached
  3. Walk up the tree from where pko is installed in until:
    1. A .pko directory is found
    2. The root of the filesystem is reached
  4. Bail out in error.

Debugging

Verbose logging can be enabled by setting the PKO_VERBOSE environment variable to a truthy value:

PKO_VERBOSE=1 pko install

Use-cases

  • Distributing private packages without having to set-up a full-fledged npm registry for private use.

    Simply prepare an overlay locally, then distribute that overlay (for example, in a ZIP file) to interested users.

  • Enable full offline usage of npm

    Prepare an overlay with all the package versions that need to be available offline. No internet connectivity will be required for using those.

  • Replacing a dependency with customized code (for quick experimentations, ...)

    Publish your custom version under the exact same name as the package you want to replace to your overlay, and pko will use that instead of the version found in the public npm registry.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

License

This project is distributed under the Apache-2.0 license.