Skip to content

Latest commit

 

History

History
140 lines (100 loc) · 5.03 KB

File metadata and controls

140 lines (100 loc) · 5.03 KB

Development Environment Setup

Setup

You will need to install these tools on your machine:

macOS

  • Node.js v7 - this is the version embedded into Electron
  • Python 2.7
  • Xcode and Xcode Command Line Tools (Xcode -> Preferences -> Downloads)

Windows

  • Node.js v7 - this is the version embedded into Electron
    • Make sure you allow the Node.js installer to add node to the PATH.
  • Python 2.7
    • Let Python install into the default suggested path (c:\Python27), otherwise you'll have to configure node-gyp manually with the path which is annoying.
    • Ensure the Add python.exe to Path option is selected.
  • Visual Studio 2015 or Visual C++ Build Tools
    • If you already have Visual Studio 2015 installed, ensure you have the Common Tools for Visual C++ 2015 feature as that is required by Node.js for installing native modules.
    • Visual Studio 2017 support has not been tested yet - see #1766 for details
  • Run npm config set msvs_version 2015 to tell node the right toolchain to use for compiling native modules.

Fedora 26

First, add the NodeJS package repository. As this version of Fedora doesn't support v7, you'll need to use v8:

$ curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

After that, install the dependencies to build and test the app:

$ sudo yum install -y nodejs gcc-c++ make libsecret-devel libxscrnsaver

Because we haven't yet upgraded to NPM 5, we need to downgrade to the latest npm@4 release:

$ sudo npm install -g npm@4.6.1

If you want to package Desktop for distribution, you will need these additional dependencies:

$ sudo yum install fakeroot dpkg rpm rpm-build xz xorriso appstream bzip2-devel
#
# workarounds for linker issues when packaging for AppImage
# source: https://michaelheap.com/error-while-loading-shared-libraries-libbz2-so-1-0-cannot-open-shared-object-file-on-centos-7
$ sudo ln -s `find /usr/lib64/ -type f -name "libbz2.so.1*"` /usr/lib64/libbz2.so.1.0
# source: https://github.com/electron-userland/electron-builder/issues/993#issuecomment-291021974
$ sudo ln -s `find /usr/lib64/ -type f -name "libreadline.so.7.0"` /usr/lib64/libreadline.so.6

Verification

With these things installed, open a shell and validate you have these commands available and that the versions look similar:

> node -v
v7.8.0

> npm -v
4.2.0

> python --version
Python 2.7.13

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

Building Desktop

After cloning the repository, the typical workflow to get up running is as follows:

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

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

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

Running tests

  • npm test - Runs all unit and integration tests
  • npm run test:unit - Runs all unit tests
  • npm run test:integration - Runs all integration tests

Pro Tip: If you're only interested in the results of a single test and don't wish to run the entire test suite to see it you can pass along a search string in order to only run the tests that match that string.

npm run test:unit -- --grep CloneProgressParser

This example will run all test names containing CloneProgressParser.

Debugging

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

  1. Run the command npm 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.

An additional extension, Devtron, is also included but is disabled by default. To enable Devtron, select the Console tab in Chrome Developer Tools and run this command:

require('devtron').install()

The Next Steps

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

  • Help Wanted - we've marked some tasks in the backlog that are ideal for external contributors
  • Code Reviews - some notes on how the team does code reviews