Skip to content
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

Cartesi CLI #462

Merged
merged 9 commits into from
Apr 29, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ["@sunodo/eslint-config/library.js"],
extends: ["@cartesi/eslint-config/library.js"],
};
53 changes: 0 additions & 53 deletions .github/workflows/car-download.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run: pnpm install

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

- name: Publish
if: ${{ inputs.release }}
Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/contracts.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: pnpm install

- name: Build
run: pnpm build --filter @sunodo/devnet
run: pnpm build --filter @cartesi/devnet

- name: Publish
if: ${{ inputs.release }}
Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,24 @@ jobs:
build_sdk:
name: Build sdk
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@sunodo/sdk') }}
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/sdk') }}
uses: ./.github/workflows/sdk.yaml
secrets: inherit

build_devnet:
name: Build devnet
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@sunodo/devnet') }}
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/devnet') }}
uses: ./.github/workflows/devnet.yaml
secrets: inherit
with:
release: true

build_contracts:
tuler marked this conversation as resolved.
Show resolved Hide resolved
name: Build contracts
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@sunodo/contracts') }}
uses: ./.github/workflows/contracts.yaml
secrets: inherit
with:
release: true

build_cli:
name: Build cli
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@sunodo/cli') }}
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@cartesi/cli') }}
uses: ./.github/workflows/cli.yaml
secrets: inherit
with:
release: true

tuler marked this conversation as resolved.
Show resolved Hide resolved
build_car_download:
name: Build car-download
needs: [release, packages_to_build]
if: ${{ needs.release.outputs.published == 'true' && contains(fromJSON(needs.packages_to_build.outputs.packages), '@sunodo/car-download') }}
uses: ./.github/workflows/car-download.yaml
secrets: inherit
with:
release: true
4 changes: 2 additions & 2 deletions .github/workflows/rm-closed-pr-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [closed]
jobs:
cleanup:
name: PR - cleanup ghcr.io/sunodo/${{ matrix.image }}:pr-${{ github.event.number }} images
name: PR - cleanup ghcr.io/cartesi/${{ matrix.image }}:pr-${{ github.event.number }} images
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -17,7 +17,7 @@ jobs:
steps:
- uses: vlaurin/action-ghcr-prune@v0.6.0
with:
organization: sunodo
organization: cartesi
container: ${{ matrix.image }}
token: ${{ secrets.GITHUB_TOKEN }}
prune-untagged: false
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
docker.io/sunodo/sdk,enable=${{ github.event_name != 'pull_request' }}
ghcr.io/sunodo/sdk
docker.io/cartesi/sdk,enable=${{ github.event_name != 'pull_request' }}
ghcr.io/cartesi/sdk
tags: |
type=raw,value=${{ steps.package-version.outputs.PACKAGE_VERSION }},enable=${{ github.event_name == 'push' }}
type=ref,event=pr
labels: |
org.opencontainers.image.title=Sunodo SDK
org.opencontainers.image.description=Sunodo SDK tools image
org.opencontainers.image.title=Cartesi SDK
org.opencontainers.image.description=Cartesi SDK tools image

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2023 Sunodo
Copyright 2024 Cartesi and individual contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
26 changes: 6 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
# Sunodo
# Cartesi CLI

![Release Packages](https://github.com/sunodo/sunodo/actions/workflows/release.yaml/badge.svg)
![Release Packages](https://github.com/cartesi/cli/actions/workflows/release.yaml/badge.svg)

Sunodo is a framework for developing decentralized applications built on top of [Cartesi](http://cartesi.io) technology.
It helps developers to:
Cartesi CLI is a tool to help creating [Cartesi](http://cartesi.io) applications. It includes commands that help developers to:

- `create` applications from templates
- `build` applications from source to a Cartesi machine
- `run` applications in a local development environment
- `deploy` applications to a cloud provider
- `deploy` applications to a live networks

## Apps and Packages

- `cli`: a [oclif](https://oclif.io) CLI tool for development, deployment and management of applications, available at `brew install sunodo/tap/sunodo`;
- `docs`: a [VitePress](https://vitepress.dev/) app with Sunodo documentation, deployed at [https://docs.sunodo.io](https://docs.sunodo.io)
- `web`: a [next.js](https://nextjs.org/) app for Sunodo website, deployed at [https://sunodo.io](https://sunodo.io)
- `car-download`: Utility library and CLI to download IPFS CAR to local filesystem;
- `cli`: a [oclif](https://oclif.io) CLI tool for development, deployment and management of applications, available at `brew install cartesi/tap/cartesi`;
- `sdk`: Docker image to help with Cartesi build and execution;
- `contracts`: smart contracts for application deployment;
- `devnet`: local deployment of Cartesi contracts and token test contracts;
Expand All @@ -26,22 +22,12 @@ Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).

## Dependencies

Sunodo uses Anvil commands. To install Anvil, you need to follow the instructions [here](https://book.getfoundry.sh/getting-started/installation#using-foundryup)
This repo build uses Anvil commands. To install Anvil, you need to follow the instructions [here](https://book.getfoundry.sh/getting-started/installation#using-foundryup)

## Build

To build all apps and packages, run the following command:

```shell
cd sunodo
pnpm run build
```

## Develop

To develop all apps and packages, run the following command:

```shell
cd sunodo
pnpm run dev
```
2 changes: 1 addition & 1 deletion apps/cli/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
extends: [
"@sunodo/eslint-config/library.js",
"@cartesi/eslint-config/library.js",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
Expand Down
16 changes: 7 additions & 9 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
# Sunodo CLI
# Cartesi CLI

Sunodo provides a CLI to help developers to:
Cartesi CLI provides a tool to help developers to:

- `create` applications from templates
- `build` applications from source to a cartesi machine
- `run` applications in a local development environment
- `test` applications running inside a cartesi machine
- `deploy` applications to a cloud provider
- `monitor` application already running on a cloud provider
- `deploy` applications to a live network

It's implemented using the [oclif framework](https://oclif.io) and distributed through several channels including `npm` and `homebrew`.
It's distributed through several channels including `npm` and `homebrew`.

## Installation

```shell
brew install sunodo/tap/sunodo
sunodo --help
brew install cartesi/tap/cartesi
cartesi --help
```

More documentation at [https://docs.sunodo.io](https://docs.sunodo.io).
More documentation at [https://docs.cartesi.io](https://docs.cartesi.io).
22 changes: 11 additions & 11 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@sunodo/cli",
"name": "@cartesi/cli",
"version": "0.13.1",
"description": "Sunodo CLI",
"description": "Cartesi CLI",
"author": "Danilo Tuler <tuler@pobox.com>",
"bin": {
"sunodo": "./bin/run.js"
"cartesi": "./bin/run.js"
},
"type": "module",
"homepage": "https://github.com/sunodo/sunodo",
"homepage": "https://github.com/cartesi/cli",
"license": "Apache-2.0",
"exports": "./dist/index.js",
"repository": "sunodo/sunodo",
"repository": "cartesi/cli",
"files": [
"/bin",
"/dist",
Expand Down Expand Up @@ -41,8 +41,8 @@
},
"devDependencies": {
"@oclif/test": "^3.2.8",
"@sunodo/devnet": "workspace:*",
"@sunodo/eslint-config": "workspace:*",
"@cartesi/devnet": "workspace:*",
"@cartesi/eslint-config": "workspace:*",
"@sunodo/wagmi-plugin-hardhat-deploy": "^0.3.0",
"@types/bytes": "^3.1",
"@types/fs-extra": "^11",
Expand All @@ -68,15 +68,15 @@
"vitest": "^1.4.0"
},
"oclif": {
"bin": "sunodo",
"dirname": "sunodo",
"bin": "cartesi",
"dirname": "cartesi",
"commands": "./dist/commands",
"plugins": [
"@oclif/plugin-help"
],
"topicSeparator": " ",
"macos": {
"identifier": "io.sunodo.cli"
"identifier": "io.cartesi.cli"
}
},
"scripts": {
Expand All @@ -95,7 +95,7 @@
"engines": {
"node": ">=18.0.0"
},
"bugs": "https://github.com/sunodo/sunodo/issues",
"bugs": "https://github.com/cartesi/cli/issues",
"keywords": [
"oclif"
],
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/baseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
}

protected getContextPath(...paths: string[]): string {
return path.join(".sunodo", ...paths);
return path.join(".cartesi", ...paths);
}

protected getMachineHash(): Hash | undefined {
Expand Down