Creating Packages

bower.json

Packages are defined by a manifest file bower.json. This is similar to Node’s package.json or Ruby’s Gemfile.

Interactively create a bower.json with bower init

$ bower init

Specification

Detailed specification of bower.json file can be found in bower/spec repository.

Maintaining dependencies

Using bower install <package> --save will add <package> to your project’s bower.json dependencies array.

# install package and add it to bower.json dependencies
$ bower install <package> --save

Similarly, using bower install <package> --save-dev will add <package> to your project’s bower.json devDependencies array.

# install package and add it to bower.json devDependencies
$ bower install <package> --save-dev

Register

Registering your package allows others to install it with a short name, like bower install <my-package-name>.

To register a new package:

  • The package name must adhere to the bower.json spec.
  • There must be a valid bower.json in the project’s root directory.
  • Your package should use semver Git tags. The v prefix is allowed.
  • Your package must be publically available at a Git endpoint (e.g., GitHub). Remember to push your Git tags!
  • For private packages (e.g. GitHub Enterprise), please consider running a private Bower registry.

Then use bower register:

$ bower register <my-package-name> <git-endpoint>
# for example
$ bower register example git://github.com/user/example.git

Now anyone can run bower install <my-package-name>, and get your library installed. The Bower registry does not have authentication or user management at this point in time. It’s on a first come, first served basis.

Bower doesn’t support GitHub-style namespacing (org/repo), however you are encouraged to namespace related packages with -, for example, angular- and paper-.

Please do not squat on package names. Register your package and claim your name after you have a valid public repo with working code.

For package name transfers, intellectual property and other disputes, please try to resolve with the owner first. If no resolution, please submit a ticket in the Bower Registry repo and the Bower Core Team will assist.

Unregister

You can unregister packages with bower unregister. You first need to authenticate with GitHub with bower login to confirm you are a contributor to the package repo.

bower login
# enter username and password
? Username:
? Password:
# unregister packages after successful login
bower unregister <package>

You’ll likely want to bower cache clean after your change. Please remember it is generally considered bad behavior to remove versions of a library that others are depending on. Think twice :) If the above doesn’t work for you, you can request a package be unregistered manually.

© 2018 Bower contributors
Licensed under the MIT License.
https://bower.io/docs/creating-packages