@acryldev/blends 1.7.18 → 1.7.20

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/dist/index.js CHANGED
@@ -95,7 +95,7 @@ var packages = {
95
95
  "path": "../plugins/versions"
96
96
  },
97
97
  "@acryldev/blends-frame": {
98
- "version": "0.2.11",
98
+ "version": "0.2.12",
99
99
  "path": "../plugins/blends-frame"
100
100
  }
101
101
  };
@@ -483,10 +483,17 @@ if (shell === undefined)
483
483
  throw new Error(
484
484
  `pack-blank-mac: ${app} has no desktop shell (plugins/desktop-shell, or the @acryldev/desktop-shell package)`,
485
485
  )
486
+ // The app's own icon, else ACRYL Blends' (the published desktop-shell carries it in lib/assets, its source in assets). Without one, electron-builder
487
+ // silently used Electron's own icon on every OS.
486
488
  const appIcon = [
487
489
  join(app, 'assets', 'icon.png'),
490
+ join(shell.root, 'lib', 'assets', 'acrylblends-logo.png'),
488
491
  join(shell.root, 'assets', 'acrylblends-logo.png'),
489
492
  ].find((file) => existsSync(file))
493
+ if (appIcon === undefined)
494
+ throw new Error(
495
+ `no icon: neither ${join(app, 'assets', 'icon.png')} nor ACRYL Blends' logo in ${shell.root}`,
496
+ )
490
497
  manifest.main = shell.main
491
498
  manifest.productName = PRODUCT
492
499
  manifest.description = DESCRIPTION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/blends",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
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",
@@ -11,7 +11,17 @@
11
11
  import { mkdirSync, readFileSync, unwatchFile, watchFile } from 'node:fs'
12
12
  import { join } from 'node:path'
13
13
  import { fileURLToPath, pathToFileURL } from 'node:url'
14
- import { app, BrowserWindow, dialog, ipcMain, Menu, MenuItem, screen, shell } from 'electron'
14
+ import {
15
+ app,
16
+ BrowserWindow,
17
+ dialog,
18
+ ipcMain,
19
+ Menu,
20
+ MenuItem,
21
+ screen,
22
+ session,
23
+ shell,
24
+ } from 'electron'
15
25
  import '@acryldev/node-server/register'
16
26
  import { type AppInstance, instanceEnv, selectInstance, withRunEnv } from '@acryldev/instance'
17
27
  import { readProduct } from '@acryldev/instance/bundle'
@@ -126,8 +136,17 @@ if (!app.requestSingleInstanceLock()) {
126
136
  await running?.stop()
127
137
  // The frame host this window started (never one it attached to) goes with the window, with every terminal it runs.
128
138
  await host?.stop()
139
+ // What the window stored is written now: the process may end at `quit`, before Chromium's own late teardown would write it.
140
+ session.defaultSession.flushStorageData()
141
+ await session.defaultSession.cookies.flushStore()
129
142
  },
130
143
  (code) => {
144
+ // Electron emits `quit` as its last step and then ends its message loop; on macOS that loop sometimes keeps running with nothing left (no
145
+ // window, no helper process, every disposer done), about one SIGTERM in six for ACRYL ADE, so the process stayed up forever. It ends here
146
+ // instead. process.exit in Electron's main process goes back into app.exit, which is already under way; reallyExit is Node's plain exit.
147
+ app.once('quit', () => {
148
+ ;(process as NodeJS.Process & { reallyExit(code: number): never }).reallyExit(code)
149
+ })
131
150
  app.exit(code)
132
151
  },
133
152
  )
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/desktop-shell",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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": {
@@ -11,6 +11,19 @@ export interface NpmPort extends NpmPublishPort {
11
11
  login(registry: string): string
12
12
  }
13
13
 
14
+ /** Why `npm whoami` failed, in words: not signed in (with the command), or what npm said without its pointer to a log file. */
15
+ export function whoamiProblem(stderr: string, registry: string): string {
16
+ const said = stderr
17
+ .split('\n')
18
+ .map((line) => line.replace(/^npm error\s*/u, '').trim())
19
+ .filter((line) => line !== '' && !/^npm (notice|warn)|A complete log of this run/iu.test(line))
20
+ const signedOut =
21
+ /ENEEDAUTH|E401|E403|need auth|Unauthorized|not logged in/iu.test(stderr) || said.length === 0
22
+ return signedOut
23
+ ? `npm whoami failed: you are not signed in to npm on ${registry} (sign in with: npm login --registry ${registry})`
24
+ : `npm whoami failed: ${said.slice(0, 2).join(' ')} (sign in with: npm login --registry ${registry})`
25
+ }
26
+
14
27
  export function npmWithLogin(): NpmPort {
15
28
  return {
16
29
  ...npmCli(),
@@ -27,15 +40,7 @@ export function npmWithLogin(): NpmPort {
27
40
  )
28
41
  const account = (result.stdout ?? '').trim()
29
42
  if (result.status !== 0 || account === '') {
30
- const last =
31
- (result.stderr ?? '')
32
- .trim()
33
- .split('\n')
34
- .filter((line) => !/^npm (notice|warn)/iu.test(line))
35
- .at(-1) ?? 'not signed in'
36
- throw new Error(
37
- `npm whoami failed: ${last} (sign in with: npm login --registry ${registry})`,
38
- )
43
+ throw new Error(whoamiProblem(result.stderr ?? '', registry))
39
44
  }
40
45
  return account
41
46
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/plugin-share",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Share plugins between people. Pull one someone released into the running app: fetched without running anything, checked by digest and for every OS, then installed live. Publish one, only as a plan a person confirmed.",
5
5
  "license": "MIT",
6
6
  "repository": {