@acryldev/blends 1.7.32 → 1.7.33

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": "@acryldev/blends",
3
- "version": "1.7.32",
3
+ "version": "1.7.33",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -7,9 +7,10 @@ import { type ChildProcess, spawn } from 'node:child_process'
7
7
  import { existsSync, readFileSync } from 'node:fs'
8
8
  import { createRequire } from 'node:module'
9
9
  import { join } from 'node:path'
10
+ import { selectInstance } from '@acryldev/instance'
10
11
  import { acrylRoot, appIdOf, personHome } from '@acryldev/instance/home'
11
12
  import { APP_ROOT_ENV } from './app-root.ts'
12
- import { appTitle, brandedElectron, iconFile } from './brand.ts'
13
+ import { brandedElectron, iconFile } from './brand.ts'
13
14
 
14
15
  /** The sysctl that makes the sandbox fail for an Electron without an AppArmor profile; its value, or `undefined` where it does not exist (every system but a recent Ubuntu). */
15
16
  export const RESTRICT_USERNS = '/proc/sys/kernel/apparmor_restrict_unprivileged_userns'
@@ -78,6 +79,23 @@ function mainFile(): string {
78
79
  return existsSync(compiled) ? compiled : join(import.meta.dirname, 'main.ts')
79
80
  }
80
81
 
82
+ /**
83
+ * What the branded Electron of an app is made from: where it lives, its id, the name the Dock and Cmd+Tab show and its icon. The name is the one the instance gives
84
+ * (the app's Blend name in `blend.yaml`, else its package's, or ACRYLBLENDS_NAME): the window's title and About say the same, so the Dock never reads differently.
85
+ */
86
+ export function brandingOf(
87
+ projectRoot: string,
88
+ env: Record<string, string | undefined>,
89
+ platform: NodeJS.Platform,
90
+ ): { folder: string; id: string; name: string; icon: string } {
91
+ return {
92
+ folder: join(acrylRoot(platform, env, personHome(env, platform)), 'electron'),
93
+ id: appIdOf(projectRoot),
94
+ name: selectInstance({ projectRoot, env }).name,
95
+ icon: iconFile(projectRoot),
96
+ }
97
+ }
98
+
81
99
  /**
82
100
  * Start the app in `projectRoot` as a desktop app: `npm run desktop` (bin.ts) with the app's folder, `extra` its arguments. Electron's main learns the
83
101
  * app from ACRYLBLENDS_APP_ROOT (app-root.ts), since the shell is installed in node_modules, outside the app's tree.
@@ -91,13 +109,7 @@ export function launchDesktop(projectRoot: string, extra: readonly string[]): Ch
91
109
  // macOS: the Dock and Cmd+Tab name the app and draw its icon only when the bundle says so (brand.ts); a copy that cannot be made leaves the stock Electron, with a note.
92
110
  const branded = brandedElectron({
93
111
  binary: electron,
94
- folder: join(
95
- acrylRoot(process.platform, process.env, personHome(process.env, process.platform)),
96
- 'electron',
97
- ),
98
- id: appIdOf(projectRoot),
99
- name: appTitle(projectRoot),
100
- icon: iconFile(projectRoot),
112
+ ...brandingOf(projectRoot, process.env, process.platform),
101
113
  })
102
114
  if (branded.problem !== undefined)
103
115
  console.warn(`desktop: the Dock shows Electron's own name and icon (${branded.problem})`)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/desktop-shell",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Run the app as a desktop app: an Electron window on the app's own server. `npm run desktop`; the app's code never imports electron.",
5
5
  "license": "MIT",
6
6
  "repository": {