mirinjs 0.1.0-alpha.10 → 0.1.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mirinjs",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.12",
4
4
  "description": "Build desktop apps with Bun, TypeScript, and Chromium (CEF). The Bun-native Electron alternative.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/config.ts CHANGED
@@ -90,9 +90,11 @@ export interface MirinConfig {
90
90
  /** Main-process entry, relative to the project root (runs in the Bun Worker). */
91
91
  main: string;
92
92
  /**
93
- * App icon, relative to the project root (macOS). Accepts a `.icns`, a
94
- * `.iconset` directory, or a single square `.png` (≥512px) that mirin renders
95
- * into an `.icns`. Embedded in the bundle for the Dock and Finder.
93
+ * App icon, relative to the project root. Accepts a `.icns`, a `.iconset`
94
+ * directory, or a single square `.png` (≥512px). macOS renders it into an
95
+ * `.icns` embedded in the bundle for the Dock and Finder; Linux resolves a PNG
96
+ * and sets it as the window's `_NET_WM_ICON` (taskbar/dock); Windows uses the
97
+ * `.ico` for the exe and window.
96
98
  */
97
99
  icon?: string;
98
100
  /**
@@ -126,6 +128,15 @@ export interface MirinConfig {
126
128
  * Requires `iscc` (Inno Setup 6+) on the build machine.
127
129
  */
128
130
  inno?: boolean | InnoConfig;
131
+ /**
132
+ * Linux distributable packages produced by `mirin release` (and by `mirin build`
133
+ * when packaging is requested): an **AppImage** (single-file, run-anywhere), a
134
+ * **.deb** (Debian/Ubuntu), and an **.rpm** (Fedora/RHEL/openSUSE). `true`/omitted
135
+ * builds all three with sensible defaults; an object customizes them (which
136
+ * `formats`, maintainer, runtime `depends`, …); `false` disables Linux packaging.
137
+ * Requires `fpm` (deb + rpm) and `appimagetool` (AppImage) on the build machine.
138
+ */
139
+ linux?: boolean | LinuxConfig;
129
140
  /**
130
141
  * External binaries bundled into the `.app` and spawned at runtime with
131
142
  * `app.sidecar(name)`. Maps a logical name to a path (relative to the project
@@ -252,6 +263,45 @@ export interface NsisConfig {
252
263
  */
253
264
  export type InnoConfig = NsisConfig;
254
265
 
266
+ /** A Linux distributable package format `mirin` can emit. */
267
+ export type LinuxPackageFormat = "appimage" | "deb" | "rpm";
268
+
269
+ /**
270
+ * Linux packaging options. Every format ships the same relocatable app payload
271
+ * (host binary + libcef.so + the CEF runtime + `resources/`) under a single
272
+ * prefix, with a launcher and a freedesktop `.desktop` entry + hicolor icon.
273
+ */
274
+ export interface LinuxConfig {
275
+ /** Which package formats to emit. Default: all three (`appimage`, `deb`, `rpm`). */
276
+ formats?: LinuxPackageFormat[];
277
+ /**
278
+ * The `/usr/bin` launcher command name and the deb/rpm package name. Defaults to
279
+ * the last dot-segment of the app `id` (e.g. `dev.netko.anko` → `anko`),
280
+ * lowercased and sanitized to a valid package name.
281
+ */
282
+ binName?: string;
283
+ /** Package maintainer for deb/rpm (`"Name <email>"`). Defaults to `publisher`. */
284
+ maintainer?: string;
285
+ /** One-line package description / `.desktop` `Comment`. Defaults to the app name. */
286
+ description?: string;
287
+ /** License identifier for deb/rpm metadata (e.g. `"MIT"`). Omitted when unset. */
288
+ license?: string;
289
+ /** Homepage URL for deb/rpm metadata. Omitted when unset. */
290
+ homepage?: string;
291
+ /** Freedesktop `.desktop` category (e.g. `"Development"`). Default `"Utility"`. */
292
+ category?: string;
293
+ /**
294
+ * Debian runtime dependency package names, replacing the built-in CEF/GTK
295
+ * defaults (`libgtk-3-0`, `libnss3`, `libasound2`, …). Advanced.
296
+ */
297
+ debDepends?: string[];
298
+ /**
299
+ * RPM runtime dependency package names, replacing the built-in CEF/GTK defaults
300
+ * (`gtk3`, `nss`, `alsa-lib`, …). Advanced.
301
+ */
302
+ rpmDepends?: string[];
303
+ }
304
+
255
305
  export interface ReleaseConfig {
256
306
  /** Flat directory URL hosting `{channel}-{platform}-{arch}-*` update files. */
257
307
  baseUrl: string;
package/src/host.ts CHANGED
@@ -20,15 +20,20 @@ import { existsSync, readFileSync } from "node:fs";
20
20
  import { Core } from "./native.ts";
21
21
 
22
22
  // Bundle layout differs by platform: macOS `.app` puts the host in
23
- // `Contents/MacOS` with resources in `../Resources`; Windows is a flat app folder
24
- // where the host exe sits beside `mirin_core.dll` with resources in `resources/`.
23
+ // `Contents/MacOS` with resources in `../Resources`; Windows and Linux are flat app
24
+ // folders where the host binary sits beside the core lib (`mirin_core.dll` /
25
+ // `libmirin_core.so`) with resources in `resources/`.
25
26
  const isWindows = process.platform === "win32";
27
+ const isMac = process.platform === "darwin";
26
28
  const exeDir = dirname(process.execPath);
27
- const resourcesDir = isWindows ? join(exeDir, "resources") : join(exeDir, "..", "Resources");
29
+ const resourcesDir = isMac ? join(exeDir, "..", "Resources") : join(exeDir, "resources");
28
30
 
29
- const corePath =
30
- process.env.MIRIN_CORE ??
31
- join(exeDir, isWindows ? "mirin_core.dll" : "libmirin_core.dylib");
31
+ const coreFileName = isWindows
32
+ ? "mirin_core.dll"
33
+ : isMac
34
+ ? "libmirin_core.dylib"
35
+ : "libmirin_core.so";
36
+ const corePath = process.env.MIRIN_CORE ?? join(exeDir, coreFileName);
32
37
  const workerPath = process.env.MIRIN_WORKER ?? join(resourcesDir, "worker.js");
33
38
  // Bundled-asset dirs for sidecars (Bun.spawn binaries) and extra workers. Dev
34
39
  // overrides via env (dev.ts stages them under .mirin); prod resolves in-bundle.
@@ -54,6 +59,13 @@ const coreConfig = JSON.parse(
54
59
  if (manifest.singleInstance === false) coreConfig.single_instance = false;
55
60
  // The app's bundle id keys the per-app CEF cache dir (Windows has no OS bundle id).
56
61
  if (typeof manifest.id === "string") coreConfig.identifier = manifest.id;
62
+ // Linux prod: the CLI stages the resolved app icon at resources/icon.png; the core
63
+ // stamps it onto each window as `_NET_WM_ICON` (taskbar/dock). Dev supplies this via
64
+ // MIRIN_CONFIG_JSON instead. macOS/Windows take the icon from the bundle.
65
+ if (process.platform === "linux" && !coreConfig.icon_path) {
66
+ const iconPng = join(resourcesDir, "icon.png");
67
+ if (existsSync(iconPng)) coreConfig.icon_path = iconPng;
68
+ }
57
69
 
58
70
  // Load the native core on the main thread FIRST. The Worker also dlopens the
59
71
  // same dylib in its boot; doing the main-thread dlopen before spawning the
package/src/index.ts CHANGED
@@ -53,6 +53,8 @@ export type {
53
53
  DmgConfig,
54
54
  NsisConfig,
55
55
  InnoConfig,
56
+ LinuxConfig,
57
+ LinuxPackageFormat,
56
58
  SidecarSpec,
57
59
  SidecarEntitlement,
58
60
  } from "./config.ts";