CLI wrapper around @openzeppelin/compact-builder and
@openzeppelin/compact-deployer. Provides the
compact-compiler, compact-builder, and compact-deploy binaries for use
in package.json scripts. Contains no programmatic API of its own. If you
want to call the compiler, builder, or deployer from TypeScript, use the
library package directly.
yarn add --dev @openzeppelin/compact-cliyarn compact-compiler --help
yarn compact-builder --help
yarn compact-deploy --helpTypical package.json scripts (replace <version> with the Compact
toolchain release you want to pin, e.g. +0.29.0):
{
"scripts": {
"compact": "compact-compiler +<version> --exclude '*/archive/*'",
"compact:access": "compact-compiler +<version> --dir access",
"build": "compact-builder +<version> --clean-dist --hierarchical --copy package.json --copy ../README.md",
"test": "compact-compiler +<version> --skip-zk && vitest run"
}
}Deploys a compiled contract to a Midnight network. Options are documented
in full under @openzeppelin/compact-deployer; the common
ones are --network, --config, --seed-file, --dry-run, and --json.
compact-deploy <Contract> --network localBoth accept the same compiler-side options (forwarded to the underlying
library); compact-builder additionally accepts dist-layout options:
| Flag | Applies to | Description |
|---|---|---|
--dir <directory> |
both | Scope to a subdirectory inside --src. |
--src <directory> |
both | Source directory containing .compact files (default: src). |
--out <directory> |
both | Output directory for compiled artifacts (default: artifacts). |
--hierarchical |
both | Preserve source directory structure in artifacts AND in the builder's .compact copy. |
--exclude <pattern> |
both | Skip .compact files matching the glob (repeatable). Default for the builder: Mock*, *.mock.compact. |
--skip-zk |
compiler | Skip zero-knowledge proof generation (also via SKIP_ZK=true env var). |
+<version> |
both | Pin the Compact toolchain version (e.g +0.29.0). |
--clean-dist |
builder | rm -rf dist before building. |
--copy <path> |
builder | Copy an extra file into dist/ (repeatable; e.g. package.json, ../README.md). |
See @openzeppelin/compact-builder for the full
documentation, programmatic API, and behavioural details.
- Node.js >= 24 for
compact-deploy, which uses explicit resource management (await using/AsyncDisposableStack), global only from Node 24. The compiler and builder binaries run on older releases. - Midnight Compact toolchain installed and available in
PATH
$ compact compile --version
Compactc version: 0.29.0@openzeppelin/compact-builder— programmatic library backing this CLI@openzeppelin/compact-simulator— simulator for testing Compact contracts
MIT