Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/octohelm/cuemod
experimental cuelang mod tool
https://github.com/octohelm/cuemod
cue tanka
Last synced: 3 months ago
JSON representation
experimental cuelang mod tool
- Host: GitHub
- URL: https://github.com/octohelm/cuemod
- Owner: octohelm
- License: mit
- Created: 2021-03-08T07:16:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T02:56:56.000Z (8 months ago)
- Last Synced: 2024-06-19T02:58:40.850Z (5 months ago)
- Topics: cue, tanka
- Language: Go
- Homepage:
- Size: 1.1 MB
- Stars: 33
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cue - cuemod - Dependency management for CUE without committing cue.mod. (Projects)
README
# CUE Mod
[![GoDoc Widget](https://godoc.org/github.com/octohelm/cuemod?status.svg)](https://pkg.go.dev/github.com/octohelm/cuemod)
[![Go Report Card](https://goreportcard.com/badge/github.com/octohelm/cuemod)](https://goreportcard.com/report/github.com/octohelm/cuemod)**ALPHA VERSION**
**May deprecated when [cue modules official supported](https://github.com/cue-lang/cue/issues/851)**
dependency management for [CUE](https://cuelang.org/) without committing `cue.mod`
## Requirements
* `git` or other vcs tool supported by go for vcs downloading.
## Install
```shell
go install github.com/octohelm/cuemod/cmd/cuem@latest
```## Usage
### Quick Start
```bash
mkdir -p ./demo && cd ./democat << EOT > kube.cue
package kubeimport (
apps_v1 "k8s.io/api/apps/v1"
)deployment: [string]: apps_v1.#Deployment
_labels: { "app": "nginx" }
deployment: nginx: spec: selector: matchLabels: _labels
deployment: nginx: spec: template: metadata: labels: _labels
deployment: nginx: spec: template: spec: {
containers: [{
name: "nginx"
image: "nginx:1.11.10-alpine"
}]
}
EOT
cuem eval -o kube.yaml ./kube.cue
# build, will automately install deps if not exists or generator if needed.cuem eval -o ./kube.single-file.cue ./kube.cue
# will bundle to one single cue file
```### Dependency management
```bash
# auto added deps
cuem get ./...# upgrade deps
cuem get -u ./...# install dep with special version
cuem get github.com/grafana/jsonnet-libs@latest
```## Features
* Dependency management based on go modules
* all dependency codes will download under `$(go env GOMODCACHE)`
* `GOPROXY` supported to speed up downloading
* Extract to cue pkg from other language or schema spec.
* `golang` supported
* k8s `crd` json supported## Spec `cue.mod/module.cue`
```cue
// module name
// for sub mod import, /path/to/sub
// NOTICE: the module name should be a valid repo name
module: "github.com/octohelm/cuemod"require: {
"dagger.io": "v0.2.8-0.20220512005159-64cb4f755695"
"k8s.io/api": "v0.24.0"
"universe.dagger.io": "v0.2.8-0.20220512005159-64cb4f755695"
}require: {
"k8s.io/apimachinery": "v0.24.0" @indirect()
}replace: {
// replace module with spec version
"dagger.io": "github.com/morlay/dagger/pkg/dagger.io@#release-main"
"universe.dagger.io": "github.com/morlay/dagger/pkg/universe.dagger.io@#release-main"
// **notice** only works for current mod
"github.com/x/a": "../a"
}replace: {
"k8s.io/api": "" @import("go")
"k8s.io/apimachinery": "" @import("go")
}```
### Known issues
#### pkg name may not same as path
Some path like `github.com/istio/istio/manifests/charts/istio-operator`, the `istio-operator` is not a valid identifier
in `cue-lang`. Should import with `github.com/istio/istio/manifests/charts/istio-operator:istio_operator`