Skip to main content

Contributing Code

The preferred way of contributing to the Deskulpt codebase is to fork the main repository on GitHub, and then submit a pull request (a.k.a, PR).

Building from Source

In the first few steps, we explain how to locally install and build Deskulpt, and how to set up your Git repository.

  1. Fork the project repository: Click on the "Fork" button near the top of the webpage. This creates a copy under your GitHub account. See this guide for more information regarding how to fork a repository.

  2. Clone your fork of the Deskulpt repository to your local machine and add the upstream remote. This saves a reference to the main Deskulpt repository, which you can use to keep your repository synchronized with the latest changes upstream.

    git clone git@github.com:YOUR_USERNAME/Deskulpt.git  # add --depth 1 if connection is slow
    cd Deskulpt
    git remote add upstream git@github.com:CSCI-SHU-410-SE-Project/Deskulpt.git

    Check that the upstream and origin remote aliases are configured correctly by running:

    git remote -v

    You should have origin pointing to your fork and upstream pointing to the main Deskulpt repository.

  3. Install the prerequisites of Tauri v2. Once you finished the guide, you should have Node.js and Rust installed.

  4. Install node dependencies. Note that Rust dependencies should be installed automatically when you build the project.

    pnpm install
  5. Start the development server. This will be slow for the first time as it needs to build the whole Rust backend. Subsequent runs will be significantly faster.

    pnpm tauri dev
  6. Build the project. You can build the platform-specific executable or installer of Deskulpt by running:

    pnpm tauri build

    Refer to the printout of the command for the location of the built artifacts. You may also want to make a debug build that is not optimized but includes debug symbols and devtools:

    pnpm tauri build -- --debug

You should now have a working installation of Deskulpt, and your Git repository properly configured. You can now start contributing to the project.

Submitting Pull Request

Please make sure that you have completed the steps in the previous section before continuing. The next steps will describe the process of modifying code and submitting a pull request.

  1. Synchronize your main branch with the upstream/main branch. See the guide for more information regarding how to synchronize a fork.

    git checkout main
    git fetch upstream
    git merge upstream/main
  2. Create a new branch for your feature or bug fix before making any changes. It is always good practice to keep your main branch clean and only use it for merging other branches.

    git checkout -b MY-FEATURE
  3. Develop on your new branch, using Git for version control. You may be interested in developers' API references which provide details about the codebase of Deskulpt. When you are done editing, add changed files using git add and then git commit to record your changes in Git. You may also push your changes to your fork with:

    git push -u origin MY-FEATURE

    This will create a new branch on your fork that is a copy of your local branch.

  4. (Optional but recommended) Run quality checks and tests before submitting a pull request. You may refer to quality assurance for more information.

  5. Follow these instructions to create a pull request from your fork to the main Deskulpt repository.

It is often helpful to keep your local feature branch synchronized with the latest changes in the main Deskulpt repository. To do this:

git fetch upstream
git merge upstream/main

Subsequently, you might need to resolve merge conflicts, for which you may refer to this guide.

Quality Assurance

Before submitting a pull request, it is recommended to run quality checks and tests to ensure that your changes are in good shape. Deskulpt provides the following convenience scripts to help you with this:

  • Formatting: Run the formatter to ensure that your code is properly formatted, in consistency with the format of the codebase.

    pnpm format     # All
    pnpm format:js # JS/TS only
    pnpm format:rs # Rust only
  • Linting: Run the linters to check for code styling issues. This is useful to ensure that your code follows the project's coding standards.

    pnpm lint     # All
    pnpm lint:js # JS/TS only
    pnpm lint:rs # Rust only
  • Testing: Run the test suite to ensure that your changes do not break existing functionality. This is especially important for changes that affect the core functionality of Deskulpt.

    pnpm test     # All
    pnpm test:rs # Rust only
  • Code coverage: Run the test suite and generate a coverage report to ensure that the test suite covers a significant portion (if not all) of the codebase.

    pnpm cov     # All
    pnpm cov:rs # Rust only

Powered by Husky, formatting and linting for the frontend and formatting for the backend will be automatically run when you commit your changes. You may bypass these checks by using the --no-verify (or -n) flag when committing. However, quality check failures will still prevent your pull request from being merged into the main repository, so it is recommended to fix issues early when possible.