jsonnet-bundler/README.md

103 lines
2.1 KiB
Markdown
Raw Normal View History

2018-04-24 15:19:40 +01:00
# jsonnet-bundler
> NOTE: This project is *alpha* stage. Flags, configuration, behavior and design may change significantly in following releases.
2019-03-12 19:00:08 +00:00
The jsonnet-bundler is a package manager for [Jsonnet](http://jsonnet.org/).
2018-04-24 15:19:40 +01:00
## Install
```
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
```
2019-03-12 19:00:08 +00:00
## Features
- Fetches transitive dependencies
- Can vendor subtrees, as opposed to whole repositories
## Current Limitations
- Always clones entire dependent repositories, even when updating
- If two dependencies depend on the same package (diamond problem), they must require the same version
## Example Usage
Initialize your project:
```sh
mkdir myproject
cd myproject
jb init
```
The existence of the `jsonnetfile.json` file means your directory is now a
jsonnet-bundler package.
To depend on another package (another Github repository):
```sh
jb install https://github.com/anguslees/kustomize-libsonnet
```
Now write `myconfig.jsonnet`, which can import a file from that package.
```jsonnet
local kustomize = import 'vendor/kustomize-libsonnet/kustomize.libsonnet';
local my_resource = {
metadata: {
name: 'my-resource',
},
};
kustomize.namePrefix('staging-')(my_resource)
```
Depend on a package that is in a subtree of a Github repo (this package also
happens to bring in a transitive dependency):
```sh
jb install https://github.com/coreos/prometheus-operator/jsonnet/prometheus-operator
```
Note that if you are copy pasting from the Github website's address bar,
remove the `tree/master` from the path.
If pushed to Github, your project can now be referenced from other packages in
the same way.
## All command line flags
2018-04-24 15:19:40 +01:00
[embedmd]:# (_output/help.txt)
```txt
$ jb -h
2018-05-13 06:55:13 -07:00
usage: jb [<flags>] <command> [<args> ...]
A jsonnet package manager
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--jsonnetpkg-home="vendor"
The directory used to cache packages in.
Commands:
help [<command>...]
Show help.
init
Initialize a new empty jsonnetfile
install [<packages>...]
Install all dependencies or install specific ones
2018-06-29 14:29:48 +02:00
update
Update all dependencies.
2018-04-24 15:19:40 +01:00
```
2019-03-12 19:00:08 +00:00