-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: prepare for release #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8f1dda5
refactor: update compiler and builder as in the compact-contracts
0xisk 52d658a
chore: fix readme
0xisk b74c8ea
chore: fix readme
0xisk 1f691af
refactor: adding changelog
0xisk c67d01c
feat: split the cli and the builder
0xisk f95ab43
chore: fix lint
0xisk dd2b023
refactor: types depend on the build
0xisk 6225d51
refactor: remove the barrel package
0xisk d8aca73
chore: ignore .claude/ directory
0xisk bec5468
fix(builder): prevent shell injection by using execFile + shell-quote
0xisk e981481
fix: address coderabbit review (rethrow build errors, no flag dedup, …
0xisk 7f70dc9
docs: address review feedback (drop premature changelogs, slim README…
0xisk e7b457d
chore: fix lint
0xisk 8f04ab9
Merge branch 'main' into refactor/prepare-for-release
andrew-fleming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,5 @@ coverage | |
| *~ | ||
|
|
||
| *temp | ||
|
|
||
| .claude/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| [](https://docs.midnight.network/relnotes/compact/minokawa-0-18-26-0) | ||
| [](https://docs.midnight.network/relnotes/compact/) | ||
| [](CODE_OF_CONDUCT.md) | ||
| [](https://api.securityscorecards.dev/projects/github.com/OpenZeppelin/compact-tools) | ||
|
|
||
|
|
@@ -8,32 +8,38 @@ This project extends the Midnight Network with additional developer tooling. | |
|
|
||
| Tools for compiling, building, and testing Compact smart contracts. This is a monorepo containing: | ||
|
|
||
| - `packages/cli`: CLI utilities to run the Compact compiler and builder | ||
| - `packages/simulator`: TypeScript simulator to run and test Compact contracts locally | ||
| - [`packages/builder`](./packages/builder) — programmatic library that drives the Compact compiler + builder | ||
| - [`packages/cli`](./packages/cli) — thin bin wrapper around the builder library (`compact-compiler`, `compact-builder`) | ||
| - [`packages/simulator`](./packages/simulator) — TypeScript simulator to run and test Compact contracts locally | ||
|
|
||
| ## External usage (via git submodule until npm publish) | ||
| See each package's README for usage, options, and examples. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
|
|
||
| Until packages are published to the npm registry, you can consume this repo from another project using a git submodule: | ||
| ## Installation | ||
|
|
||
| Pick the package that matches what you need: | ||
|
|
||
| ```bash | ||
| # Programmatic library — call the compiler/builder from TypeScript | ||
| yarn add --dev @openzeppelin/compact-builder | ||
|
|
||
| # CLI bins (compact-compiler, compact-builder) for use in package.json scripts | ||
| yarn add --dev @openzeppelin/compact-cli | ||
|
|
||
| # Simulator — test Compact contracts locally | ||
| yarn add --dev @openzeppelin/compact-simulator | ||
| ``` | ||
|
|
||
| `compact-cli` depends transitively on `compact-builder`, so installing the CLI | ||
| gives you both the binaries and the underlying library. | ||
|
|
||
| ```bash | ||
| # In your project | ||
| git submodule add https://github.com/OpenZeppelin/compact-tools | ||
| git submodule update --init --recursive | ||
|
|
||
| # Install and build the tools | ||
| yarn --cwd tools/compact-tools install | ||
| yarn --cwd tools/compact-tools build | ||
|
|
||
| # Use the simulator as a local dependency | ||
| # package.json | ||
| "devDependencies": { | ||
| "@openzeppelin/compact-tools-simulator": "file:./compact-tools/packages/simulator" | ||
| } | ||
| yarn install | ||
|
|
||
| # Call the CLIs directly or via scripts | ||
| node compact-tools/packages/cli/dist/runCompiler.js --help | ||
| node compact-tools/packages/cli/dist/runBuilder.js --help | ||
| yarn compact-compiler --help | ||
| yarn compact-builder --help | ||
| ``` | ||
|
|
||
| ```ts | ||
| import { CompactCompiler, CompactBuilder } from '@openzeppelin/compact-builder'; | ||
| import { createSimulator } from '@openzeppelin/compact-simulator'; | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
@@ -48,13 +54,13 @@ Confirm your Compact toolchain: | |
| ```bash | ||
| $ compact compile --version | ||
|
|
||
| Compactc version: 0.28.0 | ||
| 0.28.0 | ||
| Compactc version: 0.29.0 | ||
| 0.29.0 | ||
| ``` | ||
|
|
||
| ## Getting started | ||
| ## Development | ||
|
|
||
| Install dependencies at the repo root: | ||
| Clone the repo and install dependencies at the root: | ||
|
|
||
| ```bash | ||
| nvm install | ||
|
|
@@ -86,45 +92,6 @@ Clean generated artifacts: | |
| yarn clean | ||
| ``` | ||
|
|
||
| ## Packages | ||
|
|
||
| ### `@openzeppelin/compact-tools-cli` ([packages/cli](./packages/cli)) | ||
|
|
||
| CLI utilities for compiling and building Compact smart contracts. | ||
|
|
||
| **Quickstart:** | ||
|
|
||
| ```bash | ||
| # Compile all .compact files | ||
| compact-compiler | ||
|
|
||
| # Skip ZK proofs for faster development builds | ||
| compact-compiler --skip-zk | ||
|
|
||
| # Compile specific directory | ||
| compact-compiler --dir security | ||
|
|
||
| # Full build (compile + TypeScript + copy artifacts) | ||
| compact-builder | ||
| ``` | ||
|
|
||
| See [packages/cli/README.md](./packages/cli/README.md) for full documentation including all options, programmatic API, and examples. | ||
|
|
||
| ### `@openzeppelin/compact-tools-simulator` ([packages/simulator](./packages/simulator)) | ||
|
|
||
| TypeScript simulator for testing Compact contracts locally. | ||
|
|
||
| **Quickstart:** | ||
|
|
||
| ```ts | ||
| import { createSimulator } from '@openzeppelin/compact-tools-simulator'; | ||
|
|
||
| const simulator = createSimulator({}); | ||
| // Deploy and execute contract circuits, inspect state, etc. | ||
| ``` | ||
|
|
||
| See package tests in `packages/simulator/src/integration` and `src/unit` for full examples. | ||
|
|
||
| ## Contributing | ||
|
|
||
| Before opening a PR, please read `CODE_OF_CONDUCT.md`. Use the root scripts to build, test, and format. For targeted work inside a package, run the scripts in that package directory. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # @openzeppelin/compact-builder | ||
|
|
||
| Programmatic library for compiling and building Compact smart contracts on the | ||
| Midnight network. Drives the `compactc` toolchain with progress reporting, | ||
| structured error handling, and configurable output layouts. | ||
|
|
||
| This is the **library** — it ships no CLI binaries. If you want the bins | ||
| (`compact-compiler`, `compact-builder`) for use in `package.json` scripts, | ||
| install [`@openzeppelin/compact-cli`](../cli) instead, which is a thin | ||
| wrapper around this library. | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| yarn add --dev @openzeppelin/compact-builder | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```ts | ||
| import { CompactCompiler, CompactBuilder } from '@openzeppelin/compact-builder'; | ||
|
|
||
| // Compile all .compact files in src/ to artifacts/ | ||
| await new CompactCompiler({ flags: '--skip-zk' }).compile(); | ||
|
|
||
| // Or run the full build pipeline (compile + dist assembly) | ||
| const builder = new CompactBuilder({ | ||
| cleanDist: true, | ||
| hierarchical: true, | ||
| exclude: ['Mock*', '*/archive/*'], | ||
| copyToDist: ['package.json', '../README.md'], | ||
| }); | ||
| await builder.build(); | ||
| ``` | ||
|
|
||
| ## Public API | ||
|
|
||
| ```ts | ||
| // Orchestrators | ||
| export class CompactCompiler { /* … */ } | ||
| export class CompactBuilder { /* … */ } | ||
|
|
||
| // Service classes (use for advanced custom pipelines) | ||
| export class EnvironmentValidator { /* … */ } | ||
| export class FileDiscovery { /* … */ } | ||
| export class CompilerService { /* … */ } | ||
| export const UIService = { /* … */ }; | ||
|
|
||
| // Option types | ||
| export interface CompilerOptions { /* flags, targetDir, version, hierarchical, srcDir, outDir, exclude */ } | ||
| export type BuilderOptions = CompilerOptions & { | ||
| cleanDist?: boolean; | ||
| copyToDist?: string[]; | ||
| }; | ||
|
|
||
| // Errors | ||
| export class CompactCliNotFoundError extends Error { /* … */ } | ||
| export class CompilationError extends Error { /* … */ } | ||
| export class DirectoryNotFoundError extends Error { /* … */ } | ||
| ``` | ||
|
|
||
| ## See also | ||
|
|
||
| - [`@openzeppelin/compact-cli`](https://www.npmjs.com/package/@openzeppelin/compact-cli) — bin wrapper around this library | ||
| - [`@openzeppelin/compact-simulator`](https://www.npmjs.com/package/@openzeppelin/compact-simulator) — TypeScript simulator for testing Compact contracts locally | ||
|
|
||
| See the [monorepo README](https://github.com/OpenZeppelin/compact-tools#readme) for the full developer guide. | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "name": "@openzeppelin/compact-builder", | ||
| "description": "Programmatic library for compiling and building Compact smart contracts", | ||
| "version": "0.0.1", | ||
| "keywords": [ | ||
| "compact", | ||
| "midnight", | ||
| "compiler", | ||
| "builder", | ||
| "library" | ||
| ], | ||
| "author": "OpenZeppelin Community <maintainers@openzeppelin.org>", | ||
| "license": "MIT", | ||
| "type": "module", | ||
| "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "README.md", | ||
| "LICENSE" | ||
| ], | ||
| "engines": { | ||
| "node": ">=20" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc -p .", | ||
| "types": "tsc -p tsconfig.json --noEmit", | ||
| "test": "yarn vitest run", | ||
| "clean": "git clean -fXd" | ||
| }, | ||
| "devDependencies": { | ||
| "@tsconfig/node24": "^24.0.3", | ||
| "@types/node": "24.10.1", | ||
| "@types/shell-quote": "^1.7.5", | ||
| "typescript": "^5.9.3", | ||
| "vitest": "^4.0.15" | ||
| }, | ||
| "dependencies": { | ||
| "chalk": "^5.6.2", | ||
| "log-symbols": "^7.0.0", | ||
| "ora": "^9.0.0", | ||
| "shell-quote": "^1.8.3" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.