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

gulp-bower-overrides

v0.1.1

Published

merge bower overrides into bower.json files

Downloads

61

Readme

gulp-bower-overrides Build Status

Merge overrides into bower.json files to produce "fixed" packages.

Install

$ npm install --save-dev gulp-bower-overrides

Usage

Define an overrides block in your bower.json per the proposed spec: an inline object literal or path to .json file that defines a map of package names to overridden properties.

Take the Lodash package as an example. By default, Lodash's bower.json specifies lodash.compat.js as the main file, which is the compatibility build for new & old environments. If you'd like to use the fancy modern build instead, you could provide the following overrides definition in your application's root bower.json file:

{
  "name": "my-application",
  "dependencies": {
    "lodash": "latest"
  },
  "overrides": {
    "lodash": {
      "main": "./dist/lodash.js"
    }
  }
}

Then define a gulp task that runs each bower.json file through the plugin. The contents of each bower.json will be merged with the corresponding overrides block (if present) to produce a new bower.json according to your wishes.

var gulp = require('gulp');

gulp.task('bower', function () {
  var bowerOverrides = require('gulp-bower-overrides');

  return gulp.src('bower_components/*/bower.json')
    .pipe(bowerOverrides())
    .pipe(gulp.dest('dist'));
});

Example output Lodash bower.json (trimmed for readability) given configuration above:

{
  "name": "lodash",
  "version": "2.4.1",
  "main": "./dist/lodash.js"
}

API

bowerOverrides(options)

The plugin itself. Merges overrides with each bower.json.

options

bowerPath

Type: String
Default: './bower.json'

Path to project bower.json file with overrides block. Defaults to bower.json in root project directory.

bowerComponentsPath

Type: String
Default: './bower_components/'

Path to bower package install directory. Defaults to bower_components/ in root project directory. Used to expand globs if expandGlobs option is enabled.

overrides

Type: String, Object

Path to a .json file or object literal value containing package overrides. If provided, this value will be used instead of loading from a bower.json file.

expandGlobs

Type: Boolean
Default: false

Expand globs in main block to all matched files using node-glob. This is useful because the bower.json spec does not support globs in main by default, but some plugins do.

NOTE: If you're using a custom install directory, be sure to set the bowerComponentsPath option above to that path.

bowerOverrides.mapJSON(iterator)

A thin wrapper around through2-map.obj() that passes the parsed JSON content of each file to the iterator and updates the content with stringified return value.

iterator

Map function to call for each file in stream. Receives (json, file) arguments and returns new JSON content.

License

MIT © Palantir Technologies