github-desktop/docs/contributing/setup.md
2023-10-06 15:41:46 +02:00

3.3 KiB

Development Environment Setup

Setup

Refer to the specific instructions for each platform:

Experimental support for building Desktop is also available for these platforms:

Verification

Verify you have these commands available in your shell and that the found versions look similar to the below output:

$ node -v
v18.16.1

$ yarn -v
1.21.1

$ python --version
Python 3.9.x

There are also additional resources to configure your favorite editor to work nicely with the GitHub Desktop repository.

Building Desktop

First, create a fork of desktop/desktop and then clone the repository to your local machine. You'll need to be inside the repository in order to build the application locally.

The typical workflow to get up running is as follows:

  • Run yarn to get all required dependencies on your machine.
  • Run yarn build:dev to create a development build of the app.
  • Run yarn start to launch the application. Changes will be compiled in the background. The app can then be reloaded to see the changes (Ctrl/Command+Alt+R).

Optional Tip: On macOS and Linux, you can use screen to avoid filling your terminal with logging output:

$ screen -S "desktop" yarn start # -S sets the name of the session; you can pick anything
$ # Your screen clears and shows logs. Press Ctrl+A then D to exit.
[detached]
$ screen -R "desktop" # to reopen the session, read the logs, and exit (Ctrl+C)
[screen is terminating]

If you've made changes in the main-process folder you need to run yarn build:dev to rebuild the package, and then yarn start for these changes to be reflected in the running app.

If you are using GitHub Enterprise with your development build of GitHub Desktop, you will need to follow a few extra steps to authenticate properly.

If you're still encountering issues with building, refer to our troubleshooting guide for more common problems.

Running tests

  • yarn test - Runs all unit and integration tests
  • yarn test:unit - Runs all unit tests
    • Add <file> or <pattern> argument to only run tests in the specified file or files matching a pattern
    • Add -t <regex> to only match tests whose name matches a regex
    • For more information on these and other arguments, see Jest CLI options

Debugging

Electron ships with Chrome Dev Tools to assist with debugging, profiling and other measurement tools.

  1. Run the command yarn start to launch the app
  2. Under the View menu, select Toggle Developer Tools

When running the app in development mode, React Dev Tools should automatically install itself on first start when in development mode.


## The Next Steps

You're almost there! Here's a couple of things we recommend you read next:

 - [Help Wanted](../../.github/CONTRIBUTING.md#help-wanted) - we've marked some
   tasks in the backlog that are ideal for external contributors
 - [Notes for Contributors](../process/notes-for-contributors.md) - some notes
   for new contributors getting started