@mirinjs/cli 0.1.0-alpha.20 → 0.1.0-alpha.23

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/cli",
3
- "version": "0.1.0-alpha.20",
3
+ "version": "0.1.0-alpha.23",
4
4
  "description": "CLI for mirin apps: dev, build, init.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,15 +27,15 @@
27
27
  "bun": ">=1.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "create-mirinjs": "0.1.0-alpha.20",
31
- "mirinjs": "0.1.0-alpha.20"
30
+ "create-mirinjs": "0.1.0-alpha.23",
31
+ "mirinjs": "0.1.0-alpha.23"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@mirinjs/darwin-arm64": "0.1.0-alpha.20",
35
- "@mirinjs/win32-x64": "0.1.0-alpha.20",
36
- "@mirinjs/win32-arm64": "0.1.0-alpha.20",
37
- "@mirinjs/linux-arm64": "0.1.0-alpha.20",
38
- "@mirinjs/linux-x64": "0.1.0-alpha.20"
34
+ "@mirinjs/darwin-arm64": "0.1.0-alpha.23",
35
+ "@mirinjs/win32-x64": "0.1.0-alpha.23",
36
+ "@mirinjs/win32-arm64": "0.1.0-alpha.23",
37
+ "@mirinjs/linux-arm64": "0.1.0-alpha.23",
38
+ "@mirinjs/linux-x64": "0.1.0-alpha.23"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
package/src/build.ts CHANGED
@@ -22,6 +22,7 @@ import { buildAppBundle } from "./bundle/macos/index.ts";
22
22
  import { normalizeCefLocales } from "./bundle/shared/cef-locales.ts";
23
23
  import { buildWindowsBundle } from "./bundle/windows/index.ts";
24
24
  import { compileWorkers, normalizeSidecars } from "./extras.ts";
25
+ import { resolveIconSource } from "./icons/sources.ts";
25
26
  import { makeWindowsIcon } from "./icons/windows/index.ts";
26
27
  import { buildLinuxPackages, resolveLinuxFormats } from "./package/linux/index.ts";
27
28
  import { sweepBuildTemps } from "./temps.ts";
@@ -194,7 +195,8 @@ export async function build(
194
195
  const linux: boolean | import("mirinjs").LinuxConfig = config.linux ?? true;
195
196
  const publisher: string = config.publisher ?? appName;
196
197
  const cefLocales = normalizeCefLocales(config.cef?.locales);
197
- const appIconPath: string | undefined = config.icon ? join(projectDir, config.icon) : undefined;
198
+ // `.icon` documents are macOS-only, so the platform picks its own source.
199
+ const appIconPath = resolveIconSource(config.icon, projectDir);
198
200
 
199
201
  console.log(`[mirin build] ${appName} ${version}`);
200
202
 
package/src/dev.ts CHANGED
@@ -30,6 +30,7 @@ const IS_WINDOWS = process.platform === "win32";
30
30
  const IS_LINUX = process.platform === "linux";
31
31
 
32
32
  import { compileWorkers, normalizeSidecars } from "./extras.ts";
33
+ import { resolveIconSource } from "./icons/sources.ts";
33
34
  import { createReporter } from "./shared/report.ts";
34
35
  import { DevSession } from "./shared/session.ts";
35
36
  import { sweepBuildTemps } from "./temps.ts";
@@ -72,7 +73,7 @@ export async function dev(projectDir = process.cwd(), options?: DevOptions): Pro
72
73
  const appName: string = config.name ?? "Mirin App";
73
74
  const bundleId: string = config.id ?? "dev.mirin.app";
74
75
  const mainEntry = join(projectDir, config.main ?? "main/main.ts");
75
- const iconSrc = config.icon ? join(projectDir, config.icon) : undefined;
76
+ const iconSrc = resolveIconSource(config.icon, projectDir);
76
77
  // Linux: resolve the app icon to a concrete PNG the core stamps onto the window
77
78
  // as `_NET_WM_ICON` (cosmic dock/taskbar). Passed straight through in dev — no
78
79
  // bundling; the file is read from the project at window-create time.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Resolve the manifest's `icon` — a path, or per-platform {@link IconSources} —
3
+ * to the absolute path this build's target platform should use.
4
+ */
5
+
6
+ import { join } from "node:path";
7
+ import type { IconSources } from "mirinjs/config";
8
+
9
+ export type IconPlatform = "macos" | "windows" | "linux";
10
+
11
+ export function currentIconPlatform(platform: NodeJS.Platform = process.platform): IconPlatform {
12
+ if (platform === "win32") return "windows";
13
+ if (platform === "darwin") return "macos";
14
+ return "linux";
15
+ }
16
+
17
+ export function resolveIconSource(
18
+ icon: string | IconSources | undefined,
19
+ projectDir: string,
20
+ platform: IconPlatform = currentIconPlatform(),
21
+ ): string | undefined {
22
+ if (!icon) return undefined;
23
+ const picked = typeof icon === "string" ? icon : (icon[platform] ?? icon.default);
24
+ return picked ? join(projectDir, picked) : undefined;
25
+ }