Skip to content

Cypherock/cypherock-cysync

Repository files navigation

Cypherock cySync

Table of contents

  1. Prerequisites
  2. Understanding the directory structure
  3. Development Setup
  4. Local setup
  5. Other commands
  6. Contributing

Prerequisites

Before you get started, please make sure you have the following setup -

  • Node.js v18 (use nvm if already using a different Node version).
  • pnpm
    npm i -g pnpm
    
  • Python >=3.6 (But less than 3.10)
    • Download and install the latest Python version.
    • Run npm config set python /path/to/executable/python to configure.
  • Install and set up node-gyp -
  • Dependencies for MacOS brew install pkg-config pixman cairo pango
  • If you are using linux, run the following command to configure usb.
    wget -q -O - https://raw.githubusercontent.com/Cypherock/cysync-scripts/main/configure-usb.sh | sudo bash

Understanding the directory structure

├── apps                # Contains all the applications
│   └── desktop             # CySync desktop application, contains all electron code
│   └── cli                 # CySync cli application
│
├── packages            # All packages required for apps
│   └── ui                  # UI library for cysync containing all components
│   └── interfaces          # Contains all `types` which needs to be shared between packages
│   └── desktop-ui          # Renderer part of desktop application
│   └── coins               # Static coin information
│   └── coin-support-*      # Coin support functionalities
│   └── cysync-core         # Contains all business logic of cysync, like pages,context etc
│   └── db-interfaces       # Interface for `database`
│   └── database            # Database implementation for electron
│   └── util-*              # Common utilities shared between packages
│
├── submodules          # Packages used by cysync but exist on different repository
│   └── sdk                 # SDK for communicating with Cypherock hardware
│
├── scripts             # Contains scripts to be used by the build system

├── package.json

Development Setup

The repository contains submodules, which need to be downloaded as well. Clone the repository along with its submodules using -

git clone git@github.com:Cypherock/cypherock-cysync.git --recurse-submodules

Local setup

Once you have cloned the repository, follow these steps -

pnpm i         # Install packages
pnpm start     # Start desktop application
pnpm start -s  # Start desktop application with short log format

Other commands

  • pnpm test: Run all tests

  • pnpm lint: Lint all files

  • pnpm pretty: Prettify all files

  • pnpm build:submodules: Build submodules if you are changing them

  • Desktop App

    • pnpm start: Start desktop application (Hot reload enabled)
    • pnpm make: Created packaged desktop application
  • CLI App

    • pnpm dev:cli -- <ARGS>: Run cli application
    • pnpm make:cli: Created packaged cli application
      • NOTE: You need to install pkg via npm i -g pkg before running pnpm make:cli

Editing submodules

  • Submodules are contains in submodules folder.
  • Submodules are packages which are used by CySync but are managed in a different repository. (Example: sdk)
  • When you edit something in the submodules, you'll need to run pnpm build:submodues to see the changes on cysync apps.
  • You may have to delete the ./apps/desktop/node_modules/.vite folder if the changes does not reflect on cysync apps.

Turorepo Remote Caching

  • Create a new file .turbo/config.json and add the following content -
    {
      "teamid": "team_<TEAMID>",
      "apiurl": "<CACHE API URL>"
    }
  • Set the TURBO_TOKEN=yourToken environment variable

Contributing

Please consider making a contribution to the project. Contributions can include bug fixes, feature proposal, or optimizations to the current code.