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

bower-alternative-source-resolver

v0.2.1

Published

An extension to bower allowing alternative component repositories

Downloads

45

Readme

bower-alternative-source-resolver

An extension to bower allowing alternative component repositories. This component solves issues with the shorthand_resolver in bower, because you can only target one resolver. This allows you to target different owners and re-write the URL to avoid using the shorthand_resolver.

Preparation

This repository augments bower.

npm install -g bower

Installation

In your project, install bower-alternative-source-resolver locally. It can be installed globally too.

npm install --save-dev bower-alternative-source-resolver

Edit a .bowerrc (which can be hosted at /, ~, or in any parent directory for your project) and add the resolver.

{
	"resolvers": [
	  "bower-alternative-source-resolver"
	]
}

Configuration

Add alternative sources to load from by adding an alternativeSources key to either your .bowerrc or bower.json object. The .bowerrc takes precendence, the arrays are not merged.

{
  "alternateSources": [
    {
      "owner": "my_components",
      "url": "https://internal.bitbucket.com/${owner}/${package}.git${version}"
    }
  ]
}

To re-write URI's you can use rewriteSources. There are three parts:

  1. match to find a URI to re-write (uses indexOf)
  2. parse to find parts in the URI to pull out for re-framing (uses new RegExp)
  3. rewrite to write the new form of the URI (uses _.template at v4.x.x)

The parts you match with the RegExp map to variables _# in the template for rewrite

{
  "rewriteSources": [
    {
      "match": "ssh",
      "parse": "group\\/(.*?)\\.",
      "rewrite": "group/${ _1 }"
    }
  ]
}

Usage

In your bower file or when using bower install the owner keys will match the owner portion of any shorthand bower URL's and re-write with the template provided in the associated url attribute.

{
  "dependencies": {
    "button": "my_components/button#1.2.3"
  }
}

If you type bower install for your project with this configuration the request to "my_components/button#1.2.3" will be re-written to "https://internal.bitbucket.com/my_components/button.git1.2.3" because the owner matched.