Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-beans-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

migrate to bun
5 changes: 5 additions & 0 deletions .changeset/ten-jobs-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/devnet": patch
---

remove cannon
14 changes: 4 additions & 10 deletions .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,21 @@ jobs:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # 1.6.0
with:
version: v1.4.3

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build
run: pnpm build --filter @cartesi/cli
run: bun run build --filter @cartesi/cli

- name: Test
run: pnpm test --filter @cartesi/cli
run: bun run test --filter @cartesi/cli

- name: "Report Coverage"
if: always()
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
cache: "pnpm"
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # 1.6.0
with:
version: v1.4.3

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build
run: pnpm build --filter @cartesi/devnet
run: bun run build --filter @cartesi/devnet
12 changes: 3 additions & 9 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,10 @@ jobs:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

- name: Install dependencies
run: pnpm install
run: bun install

- name: Lint
run: pnpm run lint
run: bun run lint
12 changes: 3 additions & 9 deletions .github/workflows/paymaster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,15 @@ jobs:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # 1.6.0
with:
version: v1.4.3

- name: Install dependencies
run: pnpm install
run: bun install

- name: Build
run: pnpm build --filter @cartesi/mock-verifying-paymaster
run: bun run build --filter @cartesi/mock-verifying-paymaster
48 changes: 17 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changeset.outputs.published }}
publishedPackages: ${{ steps.changeset.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0

- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js 20
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 20
cache: "pnpm"
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0

# Minimum required version for npm publish with OIDC Support
# https://docs.npmjs.com/trusted-publishers
Expand All @@ -44,13 +36,13 @@ jobs:
version: v1.4.3

- name: Install Dependencies
run: pnpm install
run: bun install

- name: Build
run: pnpm build
run: bun run build

- name: Test
run: pnpm test
run: bun run test

- name: "Report Coverage"
if: always()
Expand All @@ -60,29 +52,23 @@ jobs:

- name: Create Release Pull Request or Publish to npm
id: changeset
uses: changesets/action@06245a4e0a36c064a573d4150030f5ec548e4fcc # v1.4.10
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
commit: "release: version packages"
publish: pnpm run publish-packages
commitMode: "github-api"
publish: bun run publish-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packages_to_build:
name: Get released packages
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
outputs:
packages: ${{ steps.packages.outputs.PACKAGES }}
steps:
- name: Get released packages
id: packages
- name: Release CLI binaries
if: ${{ steps.changeset.outputs.published == 'true' && contains(steps.changeset.outputs.publishedPackages.*.name, '@cartesi/cli') }}
run: |
echo "PACKAGES=$(jq -c '[ .[].name ]' <(echo '${{ needs.release.outputs.publishedPackages }}'))" >> "$GITHUB_OUTPUT"
for f in cartesi-*; do tar -czf "$f.tar.gz" "$f"; done
VERSION=$(jq -r '.[] | select(.name=="@cartesi/cli") | .version' <<< '${{ steps.changeset.outputs.publishedPackages }}')
TAG="@cartesi/cli@${VERSION}"
gh release upload "$TAG" cartesi-*.tar.gz
working-directory: ./apps/cli/bin

build_sdk:
name: Build sdk
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
secrets: inherit
- name: Build SDK
if: ${{ steps.changeset.outputs.published == 'true' && contains(steps.changeset.outputs.publishedPackages.*.name, '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ This repo build uses Anvil commands. To install Anvil, you need to follow the in
To build all apps and packages, run the following command:

```shell
pnpm run build
bun run build
```
1 change: 1 addition & 0 deletions apps/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*-debug.log
*-error.log
/.nyc_output
/bin
/dist
/lib
/package-lock.json
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"extends": ["../../biome.json"],
"linter": {
"rules": {
Expand Down
34 changes: 34 additions & 0 deletions apps/cli/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// build for npm package
await Bun.build({
entrypoints: ["./src/index.ts"],
minify: true,
outdir: "dist",
sourcemap: true,
target: "node",
});

// build bun binaries for all supported platforms
const targets: Bun.Build.Target[] = [
"bun-darwin-arm64",
"bun-darwin-x64",
"bun-linux-arm64",
"bun-linux-x64",
];

await Promise.all(
targets.map((target) =>
Bun.build({
bytecode: true,
compile: {
outfile: `bin/cartesi-${target.replace("bun-", "")}`,
target,
},
entrypoints: ["./src/index.ts"],
minify: true,
sourcemap: "linked",
target: "bun",
}),
),
);

export {};
35 changes: 15 additions & 20 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
"license": "Apache-2.0",
"exports": "./dist/index.js",
"repository": "cartesi/cli",
"files": [
"/bin",
"/dist",
"/npm-shrinkwrap.json"
],
"files": ["/dist"],
"dependencies": {
"@commander-js/extra-typings": "^14.0.0",
"@inquirer/confirm": "^5.1.18",
"@inquirer/core": "^10.2.2",
"@inquirer/input": "^4.2.4",
"@inquirer/select": "^4.3.4",
"@inquirer/type": "^3.0.8",
"@inquirer/confirm": "^6.0.3",
"@inquirer/core": "^11.1.0",
"@inquirer/input": "^5.0.3",
"@inquirer/select": "^5.0.3",
"@inquirer/type": "^4.0.2",
"bytes": "^3.1.2",
"chalk": "^5.6.2",
"cli-table3": "^0.6.5",
Expand All @@ -36,44 +32,43 @@
"ora": "^9.0.0",
"p-retry": "^7.0.0",
"progress-stream": "^2.0.0",
"semver": "^7.7.2",
"semver": "^7.7.3",
"smol-toml": "^1.4.2",
"tmp": "^0.2.5",
"viem": "^2.37.6",
"yaml": "^2.8.2"
},
"devDependencies": {
"@biomejs/biome": "catalog:",
"@cartesi/devnet": "2.0.0-alpha.8",
"@biomejs/biome": "^2.2.4",
"@cartesi/devnet": "workspace:*",
"@cartesi/rollups": "2.1.1",
"@types/bun": "^1.3.5",
"@types/bytes": "^3.1.5",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.9",
"@types/node": "^24.5.1",
"@types/node": "^25.0.3",
"@types/node-fetch": "^2.6.13",
"@types/progress-stream": "^2.0.5",
"@types/prompts": "^2.4.9",
"@types/semver": "^7.7.1",
"@types/tmp": "^0.2.6",
"@vitest/coverage-istanbul": "^3.2.4",
"@vitest/coverage-istanbul": "^4.0.16",
"@wagmi/cli": "^2.5.1",
"npm-run-all": "^4.1.5",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"tsconfig": "workspace:*",
"tslib": "^2.8.1",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
"vitest": "^4.0.16"
},
"scripts": {
"build": "run-s clean codegen compile",
"clean": "rimraf dist",
"codegen": "run-p codegen:wagmi",
"codegen:wagmi": "wagmi generate",
"compile": "tsc -p tsconfig.build.json",
"postcompile": "chmod +x dist/index.js",
"compile": "bun build.ts",
"lint": "biome lint",
"posttest": "pnpm lint",
"posttest": "bun lint",
"test": "vitest"
},
"engines": {
Expand Down
2 changes: 0 additions & 2 deletions apps/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import { Command } from "@commander-js/extra-typings";
import { createRequire } from "node:module";
import { createAddressBookCommand } from "./commands/address-book.js";
Expand Down
7 changes: 0 additions & 7 deletions apps/cli/tsconfig.build.json

This file was deleted.

16 changes: 0 additions & 16 deletions apps/cli/tsconfig.json

This file was deleted.

15 changes: 0 additions & 15 deletions apps/cli/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { type Plugin, defineConfig } from "@wagmi/cli";
import { readFileSync, readdirSync } from "node:fs";
import path from "node:path";
import type { Abi } from "viem";

const DataAvailability = JSON.parse(
readFileSync(
"node_modules/@cartesi/rollups/out/DataAvailability.sol/DataAvailability.json",
"utf8",
),
);

interface CannonOptions {
directory: string;
Expand Down Expand Up @@ -67,16 +59,9 @@ const cannonDeployments = (config: CannonOptions): Plugin => {

export default defineConfig({
out: "src/contracts.ts",
contracts: [
{
name: "DataAvailability",
abi: DataAvailability.abi as Abi,
},
],
plugins: [
cannonDeployments({
directory: "node_modules/@cartesi/devnet/deployments",
includes: [/^cartesi*/, /^Test*/],
}),
],
});
Loading
Loading