mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 08:00:05 +01:00
Merge pull request #26 from sparkprime/readme
Add usage examples to README.md
This commit is contained in:
commit
482b78743f
1 changed files with 66 additions and 4 deletions
70
README.md
70
README.md
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
> NOTE: This project is *alpha* stage. Flags, configuration, behavior and design may change significantly in following releases.
|
> NOTE: This project is *alpha* stage. Flags, configuration, behavior and design may change significantly in following releases.
|
||||||
|
|
||||||
The jsonnet-bundler is a package manager for [jsonnet](http://jsonnet.org/).
|
The jsonnet-bundler is a package manager for [Jsonnet](http://jsonnet.org/).
|
||||||
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|
@ -10,9 +11,70 @@ The jsonnet-bundler is a package manager for [jsonnet](http://jsonnet.org/).
|
||||||
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
|
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
All command line flags:
|
## Features
|
||||||
|
|
||||||
|
- Fetches transitive dependencies
|
||||||
|
- Can vendor subtrees, as opposed to whole repositories
|
||||||
|
|
||||||
|
|
||||||
|
## Current Limitations
|
||||||
|
|
||||||
|
- Always downloads 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 that can define dependencies.
|
||||||
|
|
||||||
|
To depend on another package (another Github repository):
|
||||||
|
*Note that your dependency need not be initialized with a `jsonnetfile.json`.
|
||||||
|
If it is not, it is assumed it has no transitive dependencies.*
|
||||||
|
|
||||||
|
```sh
|
||||||
|
jb install https://github.com/anguslees/kustomize-libsonnet
|
||||||
|
```
|
||||||
|
|
||||||
|
Now write `myconfig.jsonnet`, which can import a file from that package.
|
||||||
|
Remember to use `-J vendor` when running Jsonnet to include the vendor tree.
|
||||||
|
|
||||||
|
```jsonnet
|
||||||
|
local kustomize = import 'kustomize-libsonnet/kustomize.libsonnet';
|
||||||
|
|
||||||
|
local my_resource = {
|
||||||
|
metadata: {
|
||||||
|
name: 'my-resource',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
kustomize.namePrefix('staging-')(my_resource)
|
||||||
|
```
|
||||||
|
|
||||||
|
To 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, with its dependencies fetched automatically.
|
||||||
|
|
||||||
|
|
||||||
|
## All command line flags
|
||||||
|
|
||||||
[embedmd]:# (_output/help.txt)
|
[embedmd]:# (_output/help.txt)
|
||||||
```txt
|
```txt
|
||||||
|
|
@ -39,5 +101,5 @@ Commands:
|
||||||
update
|
update
|
||||||
Update all dependencies.
|
Update all dependencies.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue