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-npm-resolver-mtime

v0.10.0

Published

Use npm as a registry for your Bower Dependencies

Downloads

3

Readme

bower-npm-resolver

Greenkeeper badge

Build Status

Get it on npm

A custom Bower resolver supporting installation of NPM packages. This resolver should be used if the package (or the version of the package you want to use) is not available on default resolvers (bower registry, github, etc.).

Installation

npm install -g bower-npm-resolver

Or, if you use bower locally:

npm install bower-npm-resolver

Configuration and usage

.bowerrc

Add the resolver in your .bowerrc file:

{
  "resolvers": [
    "bower-npm-resolver"
  ]
}

Usage

Once configured, your bower.json files may reference packages using npm: prefix:

{
  "dependencies": {
    "jquery": "npm:jquery#1.0.0",
    "lodash": "4.0.0"
  }
}

The resolver will match packages with npm: prefix. In the example above, jquery will be fetched from npm. lodash will not be matched by this resolver.

Note that you can also specify scope package:

{
  "dependencies": {
    "angular-core": "npm:@angular/core#~2.0.0"
  }
}

The resolver will download the scope package on npm and extract the tarball in the bower_components directory named [scope]-[name] (in the example above, scope is angular, name is core).

Alternative usage

As of v0.2.0, matching were made using npm+ prefix, such as:

{
  "dependencies": {
    "npm+jquery": "jquery",
    "lodash": "4.0.0"
  }
}

The resolver will match packages with npm+ prefix, and strip the prefix prior to fetching from npm repo. In the example above, jquery will be fetched from npm, lodash will not be matched by this resolver.

If this is not what you want, you can pass configuration parameters in .bowerrc.

If you use a private npm repository for all your company's packages, and they all start with a shared prefix, you can change the prefix:

{
  "resolvers": [
    "bower-npm-resolver"
  ],
  "bowerNpmResolver": {
    "matchPrefix": "mycompanynpmpackages-",
    "stripPrefix": false
  }
}

Then in your bower.json:

{
  "dependencies": {
    "mycompanynpmpackages-foobar": "1.0.0",
    "other": "1.0.0"
  }
}

In the example above, mycompanynpmpackages-foobar will be fetched from npm. other will not be matched by this resolver.

Features

This resolver will:

  • Use NPM commands to get the version (and the list of available versions) to download.
  • Download the tarball associated with the package and the version (you can see the tarball URL that will be used by typing: npm view pkg@version dist.tarball).
  • Use NPM proxy configuration to download the tarball.
  • Extract the tarball, this directory will be used by bower.

Notes

If the package you download on NPM does not contains bower.json, you will not get the transitive dependencies (and you will have to explicitly add then to your bower.json file).

License

MIT License (MIT)

Changelogs

  • 0.10.0
    • Fix a compatibility issue with npm >= 6.6.0 (see #183).
    • Various dependency updates.
  • 0.9.1
    • Fix a bug (#35) that prevent using custom npm registry (thanks @madbonez).
  • 0.9.0
    • Update dependencies (cacache, pacote, etc.).
    • Fail if npm package name is not valid (#93).
    • Print package version when running bower with verbose option.
  • 0.8.2
    • Fix an incompatibility with NPM >= 5.6.0
    • Various dependency updates
  • 0.8.1
    • Fix NPM 5 compatibility
  • 0.8.0
    • Fix an incompatibility with NPM >= 5.0.0
  • 0.7.0
    • Fix a bug with requireg module.
    • Remove cwd update side effect.
  • 0.6.0
    • Use global npm instead of local module.
  • 0.5.0
    • Fix a bug with temporary directory being removed between two downloads.
  • 0.4.0
    • Use npm pack command to download packages (using npm proxy settings).
  • 0.3.0
    • Use npm: prefix.
    • Support scope packages.
  • 0.2.0
    • Allow custom prefixes (instead of default npm+).
  • 0.1.0 - Initial release
    • Use npm+ prefix to match packages.

Contributing

If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request.

To work in TDD mode, just run: npm run tdd.

Credits

Special thanks to @mhofman & @jakub-g for their contributions!