CUE for node.js & browser using WASM. Supports all commands of the CUE CLI.
- CUE: v0.4.0-beta.1
- Built with Go: 1.15.6
npm install cuelang-js --save
In node.js .cue
files are loaded from the local file system.
import cue from 'cuelang-js'
const result = await cue('export', ['/path/to/your.cue'], {"--out": "json"})
In browser .cue
files are loaded via memfs
. Write your files to memfs
before executing a command.
import cue, { memfs } from 'cuelang-js'
await memfs.writeFileSync('/your.cue', 'hello: "world"');
const result = await cue('export', ['/your.cue'], {"--out": "json"})
For external imports CUE will check the current working directory for a cue.mod
directory.
Given the following import CUE will attempt to import from ./cue.mod/pkg/example/test
import (
"example.com/test"
)
In the browser the current working directory path is root (/
) use memfs
to write your external package to the expected paths.
await memfs.mkdirSync('/cue.mod/pkg/example.com/test', { recursive: true })
await memfs.writeFileSync('/cue.mod/pkg/example.com/test/test.cue', 'package test\nmessage: "I was imported!"')
CUE | cuelang-js |
---|---|
v0.4.0-beta.1 | 1.3.0 |
v0.3.2 | 1.2.0 |
Feel free to PR if the CUE version needs bumping.
- In
package.json
updateCUE_VERSION
and runnpm run build:wasm
. - Update CUE version at the top of this document
- Add new version to the version tracking table above.
- CUE Docs - Official documentation
- CUE Discussions - Recommended for questions & answers
- CUE Language Specification - Let's get technical
- CUE Standard Packages - Available packages for import
- CUEtorials - CUE tutorials by the Hofstadter team
- CUE Playground - Experiment with CUE in the browser
- CUE Playground Tip - Same as above but with the latests alpha version of CUE
- CUE Kubernetes Tutorial - Learn how CUE can dramatically simplify Kubernetes configuration