bower-nexus-resolver
Important
If you are using NEXUS 3, please consider using the official bower-nexus3-resolver
Problematic
Nexus 2.x does not integrate Bower. Bower 1.5 offers pluggable resolvers which could make it possible.
The future Nexus behavior should mimic the default bower registry behavior.
For nexus to properly integrate Bower, it needs to respond some JSON info to this URL:
http://<domain>/nexus/content/repositories/<bower-repo>/packages/<package-name>
This JSON should be formed as (url below is a suggestion)
Thus bower, thanks to the resolver, can recognise it's talking to a Nexus registry.
Today, Nexus doesn't implement this functionality, so we need to fake it with a fake server. Any server responding some JSON is fine. I recommend express.
You will also need to add in the .bowerrc
a new entry nexusRegistry
which is the URL of your Nexus registry.
The default registry
key is taken by your fake express server.
A typical .bowerrc
would be
Installation
npm install -g bower-nexus-resolver
In order to use Bower with Nexus you need:
- bower - Bower version 1.5.0 and above:
npm install -g bower
- bower-nexus-resolver:
npm install -g bower-nexus-resolver
(if bower is installed globally) - express - To mimic default repo responses
Client Configuration
Edit your ~/.bowerrc and add Nexus Bower Resolver
You will need an interface between Nexus and this resolver. Since Nexus doesn't implement bower registry features, you need to mimic it. To do so, create a node.js (or whatever else) server that respond a JSON like (example with angular):
to a request like http://<YOUR_SERVER>/<SOME_REPO_NAME>/packages/<PACKAGE-NAME>
.
Minic the bower registry response
This example depends on express to create the server.
var express = json = http = config = port: 8082 context: 'nexus-bower' prefix: 'nexus://' app = server = http; app; // wait for a request as: // http://<hostname>/<context>/packages/<package-name> // respond a simple JSON app; console;
Once, done, edit your ~/.bowerrc and point the registry to your brand new server
Then tell bower the real URL of your Nexus npm repository
Nexus Configuring
NPM remote repository for bower components
- Simply create a new npm repository
- Run the node.js server that respond JSON
Usage
Use the client to install packages from Nexus, e.g. bower install bootstrap