Convert Figma logo to code with AI

electron logominimal-repro

Clone to try a simple Electron app

11,385
4,971
11,385
14

Top Related Projects

6,702

:electron: A complete tool for building and publishing Electron applications

Clone to try a simple Electron app

Explore the Electron APIs

A Foundation for Scalable Cross-Platform Apps

Make any web page a desktop application

91,910

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Quick Overview

The electron/minimal-repro repository is a template for creating minimal reproducible examples of issues in Electron applications. It provides a basic structure and configuration for quickly setting up a minimal Electron app, allowing developers to isolate and demonstrate problems they encounter when working with Electron.

Pros

  • Simplifies the process of creating reproducible examples for Electron issues
  • Helps developers communicate problems more effectively to the Electron community
  • Includes a basic project structure and configuration files for quick setup
  • Encourages best practices in bug reporting and issue resolution

Cons

  • May not cover all possible Electron configurations or use cases
  • Requires some familiarity with Electron and Node.js to use effectively
  • Limited documentation on how to customize the template for specific scenarios
  • May not be suitable for complex issues that require more extensive setup

Getting Started

To use the electron/minimal-repro template:

  1. Clone the repository:

    git clone https://github.com/electron/minimal-repro.git
    cd minimal-repro
    
  2. Install dependencies:

    npm install
    
  3. Modify the main.js and index.html files to demonstrate your issue.

  4. Run the app:

    npm start
    
  5. Once you've isolated the issue, create a new repository on GitHub and push your modified code to share with the Electron community.

Competitor Comparisons

6,702

:electron: A complete tool for building and publishing Electron applications

Pros of Forge

  • Comprehensive toolset for building, packaging, and distributing Electron apps
  • Simplified project setup with boilerplate code and configuration
  • Extensive documentation and community support

Cons of Forge

  • Steeper learning curve for beginners due to more complex structure
  • Potentially unnecessary features for simple projects
  • Larger project size and dependencies

Code Comparison

Forge (package.json):

{
  "name": "my-app",
  "productName": "My App",
  "version": "1.0.0",
  "main": ".webpack/main",
  "scripts": {
    "start": "electron-forge start"
  }
}

Minimal-repro (package.json):

{
  "name": "minimal-repro",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  }
}

Forge provides a more structured approach with built-in webpack configuration and additional scripts, while Minimal-repro offers a simpler setup for quick prototyping and issue reproduction. Forge is better suited for full-fledged application development, whereas Minimal-repro is ideal for creating minimal examples to demonstrate specific issues or concepts in Electron.

Clone to try a simple Electron app

Pros of minimal-repro

  • Simplified structure for easier issue reproduction
  • Focused on core Electron functionality
  • Quicker setup for developers to test specific issues

Cons of minimal-repro

  • Limited features compared to full Electron applications
  • May not cover all edge cases or complex scenarios
  • Potentially less representative of real-world usage

Code Comparison

minimal-repro:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

minimal-repro:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

As we can see, the code snippets for both repositories are identical. This is because minimal-repro and minimal-repro are the same repository. The comparison requested is between a repository and itself, which results in no differences. Both serve the same purpose of providing a minimal reproducible example for Electron-related issues.

Explore the Electron APIs

Pros of electron-api-demos

  • Comprehensive showcase of Electron features and APIs
  • Interactive examples with explanations for each API
  • Well-structured codebase with clear organization

Cons of electron-api-demos

  • Larger project size, potentially overwhelming for beginners
  • More complex setup and dependencies
  • May include unnecessary features for simple use cases

Code Comparison

minimal-repro:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

electron-api-demos:

const path = require('path')
const glob = require('glob')
const electron = require('electron')

const BrowserWindow = electron.BrowserWindow
const app = electron.app

const debug = /--debug/.test(process.argv[2])

if (process.mas) app.setName('Electron APIs')

Summary

minimal-repro is a bare-bones Electron project template, ideal for quick start and minimal reproduction of issues. It's lightweight and straightforward, making it perfect for beginners or simple applications.

electron-api-demos, on the other hand, is a comprehensive showcase of Electron's capabilities. It provides interactive examples and explanations for various APIs, making it an excellent learning resource. However, its complexity may be overwhelming for those just starting with Electron or looking to create simple applications.

Choose minimal-repro for quick prototypes or issue reproduction, and electron-api-demos for in-depth exploration of Electron's features and capabilities.

A Foundation for Scalable Cross-Platform Apps

Pros of electron-react-boilerplate

  • Comprehensive boilerplate with React, Redux, and TypeScript integration
  • Includes hot-reloading and production build configurations
  • Provides a full-featured development environment with linting and testing setup

Cons of electron-react-boilerplate

  • More complex and potentially overwhelming for beginners
  • Larger initial project size due to included dependencies
  • May include unnecessary features for simple projects

Code Comparison

minimal-repro:

const { app, BrowserWindow } = require('electron');

function createWindow() {
  const win = new BrowserWindow({ width: 800, height: 600 });
  win.loadFile('index.html');
}

app.whenReady().then(createWindow);

electron-react-boilerplate:

import { app, BrowserWindow, shell, ipcMain } from 'electron';
import { resolveHtmlPath } from './util';

let mainWindow: BrowserWindow | null = null;

const createWindow = async () => {
  mainWindow = new BrowserWindow({
    show: false,
    width: 1024,
    height: 728,
    // ... additional configuration
  });

  mainWindow.loadURL(resolveHtmlPath('index.html'));
  // ... additional setup
};

app.on('ready', createWindow);

The minimal-repro provides a basic Electron setup, while electron-react-boilerplate offers a more sophisticated structure with TypeScript and additional configurations for a React-based Electron application.

Make any web page a desktop application

Pros of Nativefier

  • Full-featured tool for creating desktop applications from web apps
  • Supports multiple platforms (Windows, macOS, Linux)
  • Active community and regular updates

Cons of Nativefier

  • Larger codebase and more complex setup
  • May include unnecessary features for simple projects
  • Potential performance overhead due to additional functionality

Code Comparison

Minimal-repro (main.js):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

Nativefier (cli.js):

const nativefier = require('nativefier').default;

const options = {
  name: 'My App',
  targetUrl: 'http://example.com',
  platform: 'darwin',
  arch: 'x64',
  out: '/path/to/build'
};

nativefier(options, (error, appPath) => {
  if (error) {
    console.error(error);
    return;
  }
  console.log('App has been nativefied to', appPath);
});

The code comparison shows that Minimal-repro provides a basic Electron setup, while Nativefier offers a higher-level API for creating desktop applications from web apps. Minimal-repro is more suitable for custom Electron projects, whereas Nativefier is designed for quickly converting web applications into desktop apps with minimal configuration.

91,910

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Pros of Tauri

  • Smaller application size and better performance due to native system components
  • Cross-platform support with a single codebase
  • Enhanced security features and more granular permissions system

Cons of Tauri

  • Less mature ecosystem compared to Electron
  • Steeper learning curve, especially for developers new to Rust
  • Limited access to certain native APIs compared to Electron

Code Comparison

Tauri (main.rs):

#![cfg_attr(
  all(not(debug_assertions), target_os = "windows"),
  windows_subsystem = "windows"
)]

fn main() {
  tauri::Builder::default()
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

Electron (main.js):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

While Minimal-repro serves as a template for reproducing Electron issues, Tauri offers a more comprehensive framework for building desktop applications. Tauri uses Rust for the backend and web technologies for the frontend, resulting in smaller, faster applications. However, Electron's mature ecosystem and easier learning curve may be preferable for some developers, especially those already familiar with Node.js.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

minimal-repro

Quickly create and share examples of Electron app behaviors or bugs.

[!NOTE] This repro was renamed from electron-quick-start to clarify its purpose as a repro template. If you're looking to boostrap a new Electron app, check out the Electron Forge docs instead to get started!

Creating a minimal reproduction (or "minimal repro") is essential when troubleshooting Electron apps. By stripping away everything except the code needed to demonstrate a specific behavior or bug, it becomes easier for others to understand, debug, and fix issues. This focused approach saves time and ensures that everyone involved is looking at exactly the same problem without distractions.

A basic Electron application contains:

  • package.json - Points to the app's main file and lists its details and dependencies.
  • main.js - Starts the app and creates a browser window to render HTML. This is the app's main process.
  • index.html - A web page to render. This is the app's renderer process.
  • preload.js - A content script that runs before the renderer process loads.

You can learn more about each of these components in depth within the Tutorial.

To Use

To clone and run this repository you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:

# Clone this repository
git clone https://github.com/electron/minimal-repro
# Go into the repository
cd minimal-repro
# Install dependencies
npm install
# Run the app
npm start

Note: If you're using Linux Bash for Windows, see this guide or use node from the command prompt.

Resources for Learning Electron

License

CC0 1.0 (Public Domain)