Get started

Install

ulang-lite is TypeScript with no dependencies. It is not published to npm: you vendor it from the µLang Git repository.

Requirements

RuntimeHow
Node.js 22.18 or laterruns the TypeScript source directly; type stripping is on by default
Cloudflare Workersbundle with Wrangler; see Cloudflare Workers
Browsersstrip the types once into ES modules; see Browser
anything elsenpm run build in the package emits JavaScript to dist/ (needs TypeScript)

Get the source

Clone the repository, check out the release these docs describe, and copy the package into your project:

git clone https://github.com/ThinkTechHoldings/ulang-git.git
git -C ulang-git checkout 61af4281ed6fd09d5f9f2100d3960630d757ae49
mkdir -p vendor
cp -R ulang-git/packages/ulang-lite vendor/ulang-lite

The package carries its own test suite. Run it to check your copy:

vendor/ulang-litereal output · summary lines only
$ node --test tests/*.test.ts
# tests 47
# suites 9
# pass 47
# fail 0
# cancelled 0
# skipped 0
# todo 0

A command-line wrapper

The command line is vendor/ulang-lite/bin/ulang-lite.ts. A two-line wrapper keeps commands short; the guides use it:

ulang-liteexample project
#!/bin/sh
# Run the vendored ulang-lite command line: ./ulang-lite check policy/deploy.ul
exec node "$(dirname "$0")/vendor/ulang-lite/bin/ulang-lite.ts" "$@"

If you prefer npm scripts, or are on Windows:

package.jsonexample project
{
  "name": "deploy-policy",
  "private": true,
  "type": "module",
  "engines": { "node": ">=22.18.0" },
  "scripts": {
    "policy:check": "node vendor/ulang-lite/bin/ulang-lite.ts check policy/*.ul",
    "test": "node --test test/*.test.ts",
    "serve": "node src/server.ts"
  }
}

Then:

example projectreal output
$ ./ulang-lite check policy/deploy.ul
policy/deploy.ul: ok ProductionDeploy (6 clauses; actions deploy, rollback; sha256 686358ddc154b77b5b7b3a24870b8dd6f79b23d376ed039d6824a923284e4059)

The example project

The guides build one small project around a deploy-approval contract:

deploy-policy/
  .github/workflows/policy.yml
  facts/bad-type.json
  facts/freeze.json
  facts/green.json
  package.json
  policy/deploy.ul
  scripts/audit-demo.ts
  scripts/build-browser.mjs
  scripts/schema-check.ts
  src/audit.ts
  src/policy.ts
  src/server.ts
  src/ul.d.ts
  src/worker.ts
  test/deploy.test.ts
  ulang-lite
  web/browser-demo.js
  wrangler.toml
  vendor/ulang-lite/        copied from µLang Git

vendor/ulang-lite is the copy made above. Every file shown in the guides is the file the site build runs.