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

@vaemoi/orpin-cli

v1.1.3

Published

Warp links for dependencies & assets into your html.

Downloads

3

Readme

orpin-cli npm version

Known Vulnerabilities Maintainability Coverage Status

The cli interface for orpin

About

orpin helps to manage npm packages in your web (read: browser) projects by keeping the <script> tags within your <head></head> element in sync with the versions in your package.json file. Currently orpin only supports jsdelivr for fetching any packages and as the url in the src attribute for the injected script tag.

Configuration

orpin can be configured either via a config file .orpinrc or from flags passed to the cli.

orpin also depends on a file called package.json to know which version of files to get from the cdn. The package.json file should be located in the same directory as .orpinrc. The pacakge.json should have a key dependencies which is an object whose keys match the keys in packages within .orpinrc and the value is the semver compatible version number to use.

.orpinrc

The following are the accepted values for an `.orpinrc.

anchorSelector

A valid dom selector to some element in the indexFile which tells orpin where to inject the script tags for the packages. orpin always injects before the anchorSelector. cheerio is used for querying and manipulating the dom.

indexFile

A path to an html file where the script tags for the packages will be injected.

packages

Each packages represents an npm package to download from cdnjs. Each package can specify three options path and devPath is where to find the file you want from the cdn; the url looks like:

https://cdn.jsdelivr.net/npm/package@version/file

The devPath takes precedency over path when it has been supplied a value and the environment variable PRODUCTION is not set. This is useful for when npm packges have production and development versions you would like to use (e.g React):

{
    "packages": {
        "devPath": "umd/react.development.js",
        "path": "umd/react.production.js"
    }
}

vendorPath

A path to a directory where downloaded files will saved.

orpin will create the vendorPath if is does not already exist but will throw an error if the path exists and the current user does not have read and write permissions

vendorSrcPrefix

A string representing what the src attribute will be for the script tags injected into indexFile


A typical .orpinrc looks like:

{
  "anchorSelector": "script[src='js/something.js']",
  "indexFile": "public/index.html",
  "vendorPath": "public/assets/vendor",
  "vendorSrcPrefix": "assets/vendor",
  "packages": {
    "dompurify": {
      "path": "dist/purify.js"
    },
    "localforage": {
      "devPath": "dist/localforage.js",
      "path": "dist/localforage.min.js"
    },
    "lodash.debounce": {
      "skip": true
    }
  }
}

CLI Parameters

The cli help page list all parameters and can be accessed with the -h flag.

➜ ./bin/cli.js --help

Usage:

    cli.js [<options>]

Options:
  -c, --config_path  Path to .orpinrc
  -d, --defer_off    Exclude 'defer' attribute from tags
  -k, --check        Check if orpin can be run
  -f, --force        Fetch remote files
  -h, --help         Show help
  -v, --version      Show version number

for more information, checkout https://gitlab.com/vaemoi/orpin/orpin-cli

Examples

cli usage

  • Normal
orpin
  • Passing the path to a config file
orpin -c ../some/path/to/.orpinrc
  • Turning off defer and forcing download
orpin -d --force
  • Prodcution (fetching files and injecting but not saving the file)
export PRODUCTION=true && orpin

usage in NodeJS

(Coming soon)