Merge pull request #928 from tjovicic/update-package-manager-docs

Update package manager docs with new dagger/packages repo
This commit is contained in:
Sam Alba 2021-08-31 09:22:25 -07:00 committed by GitHub
commit 34224469c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,14 +39,14 @@ That will create 2 directories: `.dagger` and `cue.mod` where our package will r
### Install
In our example we will use `gcpcloudrun` module from [github](https://github.com/tjovicic/dagger-modules/blob/main/gcpcloudrun/source.cue)
In our example we will use `gcpcloudrun` package from [github](https://github.com/dagger/packages/blob/main/gcpcloudrun/source.cue)
Let's first add it to our `source.cue` file:
```cue title="./source.cue"
package main
import (
"github.com/tjovicic/dagger-modules/gcpcloudrun"
"github.com/dagger/packages/gcpcloudrun"
)
run: gcpcloudrun.#Run
@ -55,7 +55,7 @@ run: gcpcloudrun.#Run
To install it just run
```shell
dagger mod get github.com/tjovicic/dagger-modules/gcpcloudrun@v0.1
dagger mod get github.com/dagger/packages/gcpcloudrun@v0.1
```
It should pull the `v0.1` version from Github, leave a copy in `cue.mod/pkg` and reflect the change in
@ -63,8 +63,8 @@ It should pull the `v0.1` version from Github, leave a copy in `cue.mod/pkg` and
```shell
cue.mod/pkg/github.com/
└── tjovicic
└── dagger-modules
└── dagger
└── packages
└── gcpcloudrun
├── cue.mod
├── README.md
@ -72,7 +72,7 @@ cue.mod/pkg/github.com/
```
```cue title="./cue.mod/dagger.mod"
github.com/tjovicic/dagger-modules/gcpcloudrun v0.1
github.com/dagger/packages/gcpcloudrun v0.1
```
Querying the current setup with `dagger query` should return a valid result:
@ -102,17 +102,27 @@ Querying the current setup with `dagger query` should return a valid result:
Now that you've successfully installed a package, let's try to upgrade it.
```shell
dagger mod get github.com/tjovicic/dagger-modules/gcpcloudrun@v0.2
dagger mod get github.com/dagger/packages/gcpcloudrun@v0.2
```
You should see similar output:
```shell
12:25PM INF system | downloading github.com/tjovicic/dagger-modules:v0.2
12:25PM INF system | downloading github.com/dagger/packages:v0.2
```
And `cue.mod/dagger.mod.cue` should reflect the new version:
```cue title="./cue.mod/dagger.mod"
github.com/tjovicic/dagger-modules/gcpcloudrun v0.2
github.com/dagger/packages/gcpcloudrun v0.2
```
## Develop package locally
Currently, package manager cannot add local packages so a workaround is linking the package to `cue.mod/pkg`.
Create a directory with your domain name, usually github.com/myuser, and link your package directory.
```shell
mkdir cue.mod/pkg/<mydomain>
ln -s <localpackage> cue.mod/pkg/<mydomain>/<mypackagename>
```