Socket
Socket
Sign inDemoInstall

bower2nix

Package Overview
Dependencies
272
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bower2nix

Generate nix expressions to fetch bower dependencies


Version published
Weekly downloads
10
decreased by-28.57%
Maintainers
2
Install size
22.8 MB
Created
Weekly downloads
 

Readme

Source

bower2nix

Generate nix expressions to fetch bower dependencies.

Usage

usage: bower2nix [-h] [-v] [INPUT] [OUTPUT]

Generate nix expressions to fetch bower dependencies

Positional arguments:
  INPUT          The bower.json file (default: ./bower.json)
  OUTPUT         The output file to generate (default: stdout)

Optional arguments:
  -h, --help     Show this help message and exit.
  -v, --version  Show program's version number and exit.

Installing

The easiest way to install bower2nix is not to install it at all. Just start a nix-shell:

nix-shell -p nodePackages.bower2nix

Example

If you have a bower.json file like this:

{
  "name": "bower-test",
  "dependencies": {
    "angular": "~1.4.0"
  }
}

Then running bower2nix bower.json bower-generated.nix will generate something like this:

# bower-generated.nix
{ fetchbower, buildEnv }:
buildEnv { name = "bower-env"; ignoreCollisions = true; paths = [
  (fetchbower "angular" "1.4.9" "~1.4.0" "0a2754zsxv9dngpg08gkr9fdwv75y986av12q4drf1sm8p8cj6bs")
]; }

The resulting derivation is a union of all the downloaded bower packages (and their dependencies).

How to use in your project

Usually, you want a bower_components directory. This can be generated with bower install by pointing it at the environment of downloaded bower packages.

  bowerComponents = pkgs.buildBowerComponents {
    name = "bower-test";
    generated = ./bower-generated.nix;
    src = mySources;
  };

The resulting derivation contains a bower_components directory which is ready to use in your project's build process.

There is a small example within the example subdirectory of this repo.

For more information, see the Nixpkgs manual.

Fetch Bower

For testing purposes, a single package can be downloaded. For example: fetch-bower angular '~1.4.0' '1.4.8'. If no output directory is provided, the package attributes will be shown, and the package contents discarded.

usage: fetch-bower [-h] [-v] [--out DIR] NAME [TARGET] [VERSION]

Fetch a single bower dependency

Positional arguments:
  NAME               Package name
  TARGET             Target version range
  VERSION            Exact package version

Optional arguments:
  -h, --help         Show this help message and exit.
  -v, --version      Show program's version number and exit.
  --out DIR, -o DIR  Output directory

Requirements

bower2nix requires Node.js 4.x or higher. The latest version of bower2nix is in the 16.09 release of nixpkgs/NixOS, so use that.

Authors

  • Shea Levy @shlevy
  • Rodney Lorrimar @rvl

FAQs

Last updated on 27 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc