Tegami

Zig

Zig package support for build.zig.zon workspaces.

The Zig plugin discovers packages from build.zig.zon, follows local .path dependencies, bumps versions, and updates local dependency version constraints.

npm install @tegami/zig
import { tegami } from "tegami";
import { zig } from "@tegami/zig";

const paper = tegami({
  plugins: [zig()],
});

Discovery

Tegami starts from the root build.zig.zon and recursively follows dependencies declared with a local .path:

.{
    .name = .app,
    .version = "1.0.0",
    .dependencies = .{
        .core = .{
            .path = "packages/core",
            .version = "^1.0.0",
        },
    },
}

Each package needs a .name. Packages without .version are included in the graph but cannot be versioned. Remote .url / .hash dependencies are ignored for discovery.

Use workspace globs for packages not reachable from the root:

zig({
  workspace: ["packages/*", "tools/*"],
});

Dependency bumping

Dependency situationDefault dependent bump
Local .path without .versionpatch
Local .path with a range that rejects bumppatch
Local .path with a range that accepts bumpnone
Remote .url/.hash dependencynone

Local .version constraints are rewritten only when they no longer accept the new version. ^ and ~ prefixes are preserved.

Configuration

zig({
  workspace: ["packages/*"],
  bumpDep: ({ version }) => (version?.startsWith("^") ? false : "patch"),
  publish: "git-tag",
});

Prop

Type

Publishing

Zig has no standard package registry, so publishing is opt-in.

Git tags

Use publish: "git-tag" with the git, GitHub, or GitLab plugin:

import { tegami } from "tegami";
import { git } from "tegami/plugins/git";
import { zig } from "@tegami/zig";

const paper = tegami({
  plugins: [zig({ publish: "git-tag" }), git()],
});

Custom

Use a custom strategy when you need your own upload logic:

zig({
  publish: {
    type: "custom",
    async publish({ pkg }) {
      await uploadZigPackage(pkg.path, pkg.version!);
      return { type: "published" };
    },
  },
});

Add resolveStatus when your target can report whether a version already exists.

On this page