0Pricing
Electron Desktop App Development · 강의

크로스 플랫폼 패키징

`electron-builder`를 사용한 고급 패키징 옵션과 구성을 익혀 안정적인 크로스 플랫폼 배포를 구현합니다.

크로스 플랫폼 패키징은(는) CoddyKit의 무료 Electron Desktop App Development 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Electron Desktop App Development 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Electron Desktop App Development 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

What is Cross-Platform Packaging?

When you build an Electron application, you're creating a desktop app using web technologies. To distribute this app to users, you need to package it into an executable or installer specific to their operating system.

Cross-platform packaging means creating these distribution files for Windows, macOS, and Linux from a single codebase. This ensures your app can reach a wide audience regardless of their chosen OS.

Introducing electron-builder

electron-builder is the go-to solution for packaging and distributing Electron applications. It's a powerful and flexible tool that automates much of the complex process.

  • Generates installers: Creates `.exe`, `.dmg`, `.deb`, `.AppImage`, and more.
  • Code signing: Handles signing for security and trust.
  • Auto-updates: Integrates with auto-update mechanisms.
  • Flexible configuration: Highly customizable through your package.json file or external configuration.

Basic electron-builder Setup

To get started, you'll install electron-builder as a development dependency and add a "build" script to your package.json. This script typically points to the electron-builder command.

Here's a basic setup:

{
  "name": "my-electron-app",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-builder"
  },
  "devDependencies": {
    "electron": "^28.0.0",
    "electron-builder": "^24.0.0"
  },
  "build": {
    "appId": "com.yourapp.id"
  }
}

Understanding "appId"

The appId (Application ID) is a crucial identifier for your application. It's a unique string, often in reverse domain name format (e.g., com.yourcompany.yourappname).

  • Uniqueness: Helps operating systems identify your app.
  • Updates: Essential for distinguishing your app during updates.
  • Data storage: Used by OS for application-specific data.

Always use a unique appId for your application.

Windows-Specific Configurations

For Windows, electron-builder can generate different installer types. The most common are NSIS (Nullsoft Scriptable Install System) and Squirrel.Windows.

  • NSIS: Creates traditional `.exe` installers, offering more customization.
  • Squirrel.Windows: Provides easy auto-updates and a simpler installation experience.

You can define Windows-specific settings under the "win" key in your "build" configuration.

Windows Config Example

Here's how you might configure `electron-builder` for Windows, specifying targets and an icon:

{
  "name": "my-electron-app",
  "build": {
    "appId": "com.yourapp.id",
    "win": {
      "target": [
        "nsis",
        "squirrel"
      ],
      "icon": "build/icon.ico"
    }
  }
}

macOS-Specific Configurations

On macOS, the primary distribution formats are DMG (Disk Image) and PKG (Installer Package). `electron-builder` handles the specifics for these.

  • DMG: The most common way to distribute macOS apps, allowing drag-and-drop installation.
  • PKG: A traditional installer package, suitable for more complex installations or enterprise distribution.

Crucial macOS settings include category and bundleId (which should match your appId).

macOS Config Example

This snippet shows macOS-specific settings, including targets, bundle ID, and application category:

{
  "name": "my-electron-app",
  "build": {
    "appId": "com.yourapp.id",
    "mac": {
      "target": [
        "dmg",
        "pkg"
      ],
      "category": "public.app-category.developer-tools",
      "bundleId": "com.yourapp.id",
      "icon": "build/icon.icns"
    }
  }
}

Linux-Specific Configurations

Linux has a variety of package formats. electron-builder supports popular ones like AppImage, deb, and rpm.

  • AppImage: A universal format that runs on most Linux distributions without installation.
  • deb: For Debian-based systems (Ubuntu, Debian).
  • rpm: For Red Hat-based systems (Fedora, CentOS).

Similar to macOS, you'll often define a category for your application.

Linux Config Example

Here's an example of configuring for Linux, targeting different formats and setting an icon:

{
  "name": "my-electron-app",
  "build": {
    "appId": "com.yourapp.id",
    "linux": {
      "target": [
        "AppImage",
        "deb",
        "rpm"
      ],
      "category": "Development",
      "icon": "build/icon.png"
    }
  }
}

Check Your Packaging Knowledge

Match the `electron-builder` target configuration key with its primary operating system.

Recap & Next Steps

Great job! You've learned the fundamentals of cross-platform packaging with electron-builder.

  • We explored how electron-builder simplifies creating installers for Windows, macOS, and Linux.
  • You saw how to configure platform-specific settings directly in your package.json.
  • Understanding appId and various installer targets (NSIS, DMG, AppImage) is key to successful distribution.

Next, you'll learn about code signing and notarization, essential steps for ensuring your application is trusted by users and operating systems.

자주 묻는 질문

“크로스 플랫폼 패키징” 강의는 무료인가요?

네 — “크로스 플랫폼 패키징” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Electron Desktop App Development 강의 전체를 잠금 해제할 수 있습니다. Electron Desktop App Development 강의에는 총 4개의 강의가 포함되어 있습니다.

“크로스 플랫폼 패키징”에서 뭘 배우나요?

`electron-builder`를 사용한 고급 패키징 옵션과 구성을 익혀 안정적인 크로스 플랫폼 배포를 구현합니다. 브라우저에서 직접 실행하는 실습 코드로 Electron Desktop App Development을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Electron Desktop App Development을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Electron Desktop App Development은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.

“크로스 플랫폼 패키징” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Electron Desktop App Development 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Electron Desktop App Development 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 크로스 플랫폼 패키징
  2. 코드 서명 및 공증
  3. 앱 스토어를 통한 배포
  4. CI/CD로 릴리스 자동화하기
← Electron Desktop App Development(으)로 돌아가기