Skip to content

feat: Support ArchiveTarget linux artifacts to include exporting a .desktop file#9699

Open
mmaietta wants to merge 17 commits into
masterfrom
feat/desktop-file-archives
Open

feat: Support ArchiveTarget linux artifacts to include exporting a .desktop file#9699
mmaietta wants to merge 17 commits into
masterfrom
feat/desktop-file-archives

Conversation

@mmaietta

@mmaietta mmaietta commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Implements: #9091

CC @t3chguy

@changeset-bot

changeset-bot Bot commented May 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb72b95

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmaietta mmaietta marked this pull request as draft May 3, 2026 15:18
@mmaietta mmaietta marked this pull request as draft May 3, 2026 15:18
@mmaietta mmaietta requested a review from Copilot May 15, 2026 15:56
@mmaietta mmaietta marked this pull request as ready for review May 15, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for emitting Linux .desktop files for archive-style targets, with related config/schema updates and tests.

Changes:

  • Emits .desktop artifacts for Linux archive targets when desktop is configured.
  • Expands desktop option typing/schema to allow booleans.
  • Adds/updates Linux packaging tests and snapshots for archive desktop output.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
packages/app-builder-lib/src/linuxPackager.ts Adds archive desktop artifact emission logic.
packages/app-builder-lib/src/targets/LinuxTargetHelper.ts Normalizes boolean desktop config and updates validation.
packages/app-builder-lib/src/options/linuxOptions.ts Updates desktop option docs and type.
packages/app-builder-lib/src/targets/targetFactory.ts Exports archive target set for reuse.
packages/app-builder-lib/scheme.json Updates generated schema for desktop booleans/docs.
test/src/linux/linuxPackagerTest.ts Adds archive desktop tests and reorganizes AppImage tests.
test/snapshots/linux/linuxPackagerTest.js.snap Updates Linux packager snapshots.
test/snapshots/linux/linuxArchiveTest.js.snap Adds archive-related snapshots.
.changeset/hip-rooms-throw.md Adds minor changeset entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/src/linux/linuxPackagerTest.ts Outdated
Comment thread packages/app-builder-lib/src/linuxPackager.ts Outdated
Comment thread packages/app-builder-lib/src/options/linuxOptions.ts Outdated
Comment thread packages/app-builder-lib/src/options/linuxOptions.ts Outdated
Comment thread test/src/linux/linuxPackagerTest.ts Outdated
Comment on lines +467 to +475
linux: {
description: "Test Comment",
desktop: {
entry: {
Name: "Test App",
},
},
},
{
projectDirCreated: projectDir =>
modifyPackageJson(projectDir, data => {
data.author = "Foo"
}),
}
))
},
import { ToolsetConfig } from "app-builder-lib/src"

const appImageTarget = Platform.LINUX.createTarget("appimage", Arch.x64)
const zipTarget = Platform.LINUX.createTarget("zip", Arch.x64)
Comment on lines +38 to +39
override async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<any> {
await super.pack(outDir, arch, targets, taskManager)
Comment thread packages/app-builder-lib/src/linuxPackager.ts Outdated
Comment thread packages/app-builder-lib/scheme.json Outdated
mmaietta and others added 7 commits May 15, 2026 22:06
# Conflicts:
#	packages/app-builder-lib/src/linuxPackager.ts
#	packages/app-builder-lib/src/targets/LinuxTargetHelper.ts
#	test/snapshots/linux/linuxPackagerTest.js.snap
#	test/src/linux/linuxPackagerTest.ts
…ktop-file-archives

# Conflicts:
#	packages/app-builder-lib/src/targets/LinuxTargetHelper.ts
@mmaietta mmaietta linked an issue Jun 1, 2026 that may be closed by this pull request
mmaietta and others added 3 commits May 31, 2026 17:05
Resolve conflicts from the v27 ESM migration (#9544):
- linuxPackager.ts: combine ESM imports (.js, builder-util/internal,
  targets/linux/*) with the desktop-emission pack() override
- LinuxTargetHelper.ts (moved to targets/linux/): keep desktop boolean
  normalization + InvalidConfigurationError for desktop.entry.Exec/Comment
  alongside master's desktopName validation
- platformPackager.ts: cast `this as unknown as LinuxPackager` now that
  LinuxPackager has extra private members (getHelper/_helper/emittedDesktopFiles)
- scheme.json: regenerated (desktop now LinuxDesktopFile | boolean | null)
- tests: drop linuxPackagerTest.js.snap (deleted upstream) and reduce
  linuxPackagerTest.ts to the new archive/desktop coverage; AppImage/icon/
  license cases already live in linuxPackagerTestSuite.ts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… coverage

Security/correctness:
- Escape every .desktop field value at the single serialization site
  (except the already-quoted Exec key) so user desktop.entry overrides,
  desktopActions, MimeType, and Categories can no longer inject extra
  key=value lines (e.g. a second Exec=). No-op for normal inputs.
- Correct the pack() comment: desktop emission runs concurrently with
  archive builds, not strictly after; the build still fails on archive error.

Docs:
- linux.md: distinguish package-format (always bundled) vs archive (opt-in)
  desktop files; document the boolean option and installed-app Exec/Icon caveat.
- linux.desktop JSDoc: archive behavior + no per-target archive override.
- scheme.json: regenerated (desktop now LinuxDesktopFile | boolean | null).

Tests (e2e expansion, all CI-safe):
- default-content contract; 7z/tar.* per-format emission + within-build dedup;
  multi-arch shared-outDir dedup; desktopName -> StartupWMClass (not filename);
  fileAssociations+protocols -> MimeType; desktopActions; dir-only emits none;
  appImage+zip emits one standalone; newline-injection regression tests.
- Commit reviewed snapshot baseline test/snapshots/linux/linuxPackagerTest.js.snap.
- Update generated linuxPackager suite snapshots: forbid desktop.Exec now throws
  InvalidConfigurationError (snapshot captures the error code).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for .tar.gz linux target to include the .desktop file

2 participants