Prerequisites
Before building GitHub Desktop, ensure you have the required tools installed:- Node.js v20.17.0 or later
- Yarn 1.21.1 or later
- Python 3.9.x or later
Initial Setup
Build Commands
Development Build
Create a development build with source maps and debugging support:- Compiles TypeScript with development settings
- Bundles the application using webpack
- Includes source maps for debugging
Production Build
Create an optimized production build:Production builds use more memory during compilation. The
NODE_OPTIONS='--max_old_space_size=4096' flag is automatically set to handle this.Compilation Only
If you only want to compile without building:Running the Application
After building, start the application:- Chrome DevTools for debugging
- React DevTools (automatically installed on first run)
- Hot reload support (press
Ctrl/Cmd+Alt+Rto reload)
Running in Production Mode
To test production mode locally:Background Compilation
When you run
yarn start, changes are compiled automatically in the background. Simply reload the app to see your changes.main-process folder require rebuilding:
Packaging
Create distributable packages:out directory.
Clean Build
If you encounter build issues, perform a clean build:Specialized Build Tasks
Generate Octicons
Regenerate Octicons from the latest version:Validate Electron Version
Ensure you’re using the correct Electron version:Compile Scripts
Compile scripts in thescript/ directory:
Build Architecture
GitHub Desktop uses:- TypeScript: Type-safe JavaScript with strict type checking
- Webpack: Module bundler for the application
- Electron: Cross-platform desktop framework
- React: UI component library
Build Configuration
Build configurations are located in:app/webpack.development.ts- Development webpack configapp/webpack.production.ts- Production webpack configscript/tsconfig.json- TypeScript compiler config for scriptstsconfig.json- Main TypeScript compiler config
Troubleshooting
If you encounter build issues, see the Troubleshooting Development Issues guide.Next Steps
- Learn about Testing
- Set up Linting
- Configure your Development Tools