@adea-ai/app-framework 0.33.1 → 0.35.0
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/README.md +30 -12
- package/ci/desktop-release.sh +203 -0
- package/dist/app/create-application.d.ts +2 -0
- package/dist/app/create-application.js +19 -5
- package/dist/cli/create-application-cli.js +6 -4
- package/dist/desktop/desktop-client.d.ts +5 -0
- package/dist/desktop/desktop-client.js +12 -3
- package/dist/framework-source.json +1 -1
- package/dist/installer/installer-upgrade-command.js +1 -1
- package/dist/native/app-bundle.d.ts +14 -2
- package/dist/native/app-bundle.js +18 -5
- package/dist/native/desktop-build.d.ts +63 -0
- package/dist/native/desktop-build.js +119 -0
- package/dist/native/native-utilities.d.ts +18 -0
- package/dist/native/native-utilities.js +22 -1
- package/dist/native/sidecar-services.d.ts +5 -0
- package/dist/native/sidecar-services.js +10 -4
- package/dist/release/local-release.js +1 -1
- package/dist/release/release-assets-plan.js +4 -2
- package/dist/release/release-config.d.ts +7 -1
- package/dist/release/release-config.js +17 -6
- package/dist/release/release-cut-command.js +4 -2
- package/dist/release/release-finalize.js +3 -3
- package/dist/release/release-promotion-command.js +2 -2
- package/dist/release/release-publish-command.js +2 -2
- package/dist/release/retained-release-build.js +2 -2
- package/dist/shell/app-utilities.d.ts +1 -0
- package/dist/shell/app-utilities.js +2 -1
- package/dist/shell/media-query.d.ts +8 -0
- package/dist/shell/media-query.js +51 -0
- package/dist/updates/desktop-updater.js +1 -1
- package/dist/updates/release-version.d.ts +11 -0
- package/dist/updates/release-version.js +23 -1
- package/dist/updates/update-adapter.d.ts +38 -1
- package/dist/updates/update-adapter.js +121 -1
- package/dist/updates/update-channel-store.js +1 -1
- package/dist/updates/update-discovery.js +1 -1
- package/dist/updates/update-handoff-plan.js +1 -1
- package/dist/updates/update-manager.js +1 -1
- package/dist/views/update-surface.js +2 -2
- package/package.json +29 -2
- package/src/native/electrobun-types.d.ts +87 -0
- package/src/shell/app-utilities.tsx +1 -0
- package/src/shell/media-query.ts +59 -0
- package/src/updates/release-version.ts +33 -0
- package/src/updates/update-adapter.ts +168 -1
- package/templates/application/.gitlab/desktop-release.yml +42 -0
- package/templates/application/.gitlab-ci.yml +9 -0
- package/templates/application/README.md +14 -3
- package/templates/application/electrobun.config.ts +6 -2
- package/templates/application/scripts/app-version.ts +2 -8
- package/templates/application/scripts/build-desktop.ts +9 -36
- package/templates/application/src/bun/index.ts +5 -16
- package/templates/application/tsconfig.json +1 -1
- package/templates/application/src/electrobun.d.ts +0 -27
|
@@ -2,14 +2,23 @@ image:
|
|
|
2
2
|
name: oven/bun:1.4.4
|
|
3
3
|
entrypoint: ['']
|
|
4
4
|
|
|
5
|
+
include:
|
|
6
|
+
- local: .gitlab/desktop-release.yml
|
|
7
|
+
|
|
5
8
|
workflow:
|
|
6
9
|
rules:
|
|
7
10
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
8
11
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
12
|
+
# Release tags run only the desktop release jobs (.gitlab/desktop-release.yml).
|
|
13
|
+
- if: $CI_COMMIT_TAG
|
|
9
14
|
|
|
10
15
|
validate:
|
|
11
16
|
timeout: 20m
|
|
12
17
|
# {{GITLAB_RUNNER_TAGS}}
|
|
18
|
+
rules:
|
|
19
|
+
- if: $CI_COMMIT_TAG
|
|
20
|
+
when: never
|
|
21
|
+
- when: on_success
|
|
13
22
|
script:
|
|
14
23
|
- bun install --frozen-lockfile
|
|
15
24
|
- bun run format:check
|
|
@@ -9,9 +9,20 @@ with the same checks as the GitHub validation workflow. Commit `bun.lock`
|
|
|
9
9
|
before running it. It uses an untagged Docker runner by default; if your GitLab
|
|
10
10
|
runner requires tags, supply `--gitlab-runner-tags tag1,tag2` when generating
|
|
11
11
|
the app or add the tags to the job afterward. The runner must have access to
|
|
12
|
-
the package registry.
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
the package registry.
|
|
13
|
+
|
|
14
|
+
`.gitlab/desktop-release.yml` publishes desktop releases from GitLab: a
|
|
15
|
+
`v<version>` tag on main (from Release Please) runs `adea-desktop-release`,
|
|
16
|
+
which builds the release runner's platform, signs the channel descriptors,
|
|
17
|
+
uploads the release to `releaseFeed` and links its files on the GitLab release,
|
|
18
|
+
then promotes the newest qualified daily to stable after `soakHours`. The release
|
|
19
|
+
runner needs bun, git and the aws CLI; pass its tags with
|
|
20
|
+
`--gitlab-release-runner-tags` (a macOS arm64 shell runner builds `macos-arm64`).
|
|
21
|
+
It stays off until the project sets the protected variable
|
|
22
|
+
`DESKTOP_RELEASE_ENABLED=true`, protects `v*` tags and adds the protected,
|
|
23
|
+
masked `DESKTOP_UPDATE_SIGNING_KEY_B64` (base64 of the private key PEM) and
|
|
24
|
+
bucket credentials listed in that file. A GitLab-only app may remove the
|
|
25
|
+
`.github` workflows and `releaseWorkflows` from `release-config.json`.
|
|
15
26
|
|
|
16
27
|
The generated release control workflow uses `release-config.json` for daily,
|
|
17
28
|
dev and stable channels. Run `bun install` and commit `bun.lock` before
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { signsMacosBuild } from '@adea-ai/app-framework/desktop-build'
|
|
1
2
|
import { createRendererProfile } from '@adea-ai/app-framework/renderer-profile'
|
|
2
3
|
import { appConfig } from './src/app-config'
|
|
3
4
|
import { applicationVersion } from './scripts/app-version'
|
|
@@ -17,10 +18,13 @@ export default {
|
|
|
17
18
|
views: {},
|
|
18
19
|
copy: {
|
|
19
20
|
'build/client': 'client',
|
|
20
|
-
|
|
21
|
+
// scripts/build-desktop.ts stages the framework's post-exit update helper here.
|
|
22
|
+
'build/update-helper.js': 'update-helper.js',
|
|
21
23
|
'release-config.json': 'release-config.json',
|
|
22
24
|
},
|
|
23
25
|
...profile.build,
|
|
24
|
-
|
|
26
|
+
// Electrobun signs the stable payload only when an identity is configured; a stable macOS
|
|
27
|
+
// build without a Developer ID gets an ad-hoc one (scripts/build-desktop.ts).
|
|
28
|
+
mac: { ...profile.build.mac, codesign: signsMacosBuild(process.env), createDmg: false },
|
|
25
29
|
},
|
|
26
30
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { applicationVersion as releaseVersion } from '@adea-ai/app-framework/release-version'
|
|
1
2
|
import appPackage from '../package.json' with { type: 'json' }
|
|
2
3
|
|
|
3
4
|
/** Keep the shell and its client on the same validated release version. */
|
|
4
5
|
export function applicationVersion(env: Record<string, string | undefined> = process.env): string {
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
typeof version !== 'string' ||
|
|
8
|
-
version.length > 64 ||
|
|
9
|
-
!/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(version)
|
|
10
|
-
)
|
|
11
|
-
throw new Error('Invalid application release version')
|
|
12
|
-
return version
|
|
6
|
+
return releaseVersion(env, appPackage.version)
|
|
13
7
|
}
|
|
@@ -1,38 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
parseDesktopBuildEnvironment,
|
|
3
|
+
runElectrobunBuild,
|
|
4
|
+
stageUpdateHelper,
|
|
5
|
+
} from '@adea-ai/app-framework/desktop-build'
|
|
3
6
|
import { appConfig } from '../src/app-config'
|
|
4
7
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (env.ADEA_ENABLE_POSIX_LAUNCH_LEASE === '1') {
|
|
10
|
-
if (environment !== 'stable' || process.platform !== 'darwin' || process.arch !== 'arm64')
|
|
11
|
-
throw new Error('POSIX launch lease integration supports stable macOS arm64 builds only')
|
|
12
|
-
}
|
|
13
|
-
if (process.platform === 'win32') {
|
|
14
|
-
const tar = Bun.spawnSync({ cmd: ['tar', '--version'], stdout: 'pipe', stderr: 'pipe', env })
|
|
15
|
-
if (tar.exitCode !== 0) throw new Error('A working tar executable is required')
|
|
16
|
-
if (/GNU tar/i.test(tar.stdout.toString())) env.TAR_OPTIONS = '--force-local'
|
|
17
|
-
}
|
|
18
|
-
const child = Bun.spawn({
|
|
19
|
-
cmd: [
|
|
20
|
-
'node',
|
|
21
|
-
join('node_modules', 'electrobun', 'bin', 'electrobun.cjs'),
|
|
22
|
-
'build',
|
|
23
|
-
`--env=${environment}`,
|
|
24
|
-
],
|
|
25
|
-
env,
|
|
26
|
-
stdin: 'inherit',
|
|
27
|
-
stdout: 'inherit',
|
|
28
|
-
stderr: 'inherit',
|
|
29
|
-
})
|
|
30
|
-
if ((await child.exited) !== 0) throw new Error('Desktop build failed')
|
|
31
|
-
if (environment === 'stable' && process.platform === 'darwin') {
|
|
32
|
-
const bundle = appConfig.name.replaceAll(' ', '')
|
|
33
|
-
createMacosDmg({
|
|
34
|
-
appName: appConfig.name,
|
|
35
|
-
appPath: join('build', `stable-macos-${process.arch}`, `${appConfig.name}.app`),
|
|
36
|
-
outputPath: join('artifacts', `macos-${process.arch}-${bundle}.dmg`),
|
|
37
|
-
})
|
|
38
|
-
}
|
|
8
|
+
const environment = parseDesktopBuildEnvironment(process.argv.slice(2))
|
|
9
|
+
// electrobun.config.ts copies the staged helper into the bundle.
|
|
10
|
+
stageUpdateHelper('build')
|
|
11
|
+
await runElectrobunBuild({ environment, appName: appConfig.name })
|
|
@@ -29,7 +29,10 @@ import {
|
|
|
29
29
|
startDesktopHostWithRetry,
|
|
30
30
|
} from '@adea-ai/app-framework/desktop-host'
|
|
31
31
|
import { createServiceRegistry } from '@adea-ai/app-framework/service-registry'
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
electrobunFileDialogs,
|
|
34
|
+
registerNativeUtilities,
|
|
35
|
+
} from '@adea-ai/app-framework/native-utilities'
|
|
33
36
|
import { appConfig } from '../app-config'
|
|
34
37
|
|
|
35
38
|
const HOST_DRAIN_TIMEOUT_MS = 5000
|
|
@@ -85,21 +88,7 @@ registerNativeUtilities({
|
|
|
85
88
|
info: { name: appConfig.name, version, platform: process.platform },
|
|
86
89
|
authorize: (principal) => principal === 'app-window',
|
|
87
90
|
openExternal: (url) => Utils.openExternal(url),
|
|
88
|
-
|
|
89
|
-
Utils.openFileDialog({
|
|
90
|
-
...(startingFolder === undefined ? {} : { startingFolder }),
|
|
91
|
-
canChooseFiles: false,
|
|
92
|
-
canChooseDirectory: true,
|
|
93
|
-
allowsMultipleSelection: false,
|
|
94
|
-
}),
|
|
95
|
-
pickFiles: ({ startingFolder, extensions, multiple }) =>
|
|
96
|
-
Utils.openFileDialog({
|
|
97
|
-
...(startingFolder === undefined ? {} : { startingFolder }),
|
|
98
|
-
allowedFileTypes: extensions === undefined ? '*' : extensions.join(','),
|
|
99
|
-
canChooseFiles: true,
|
|
100
|
-
canChooseDirectory: false,
|
|
101
|
-
allowsMultipleSelection: multiple,
|
|
102
|
-
}),
|
|
91
|
+
...electrobunFileDialogs(Utils),
|
|
103
92
|
})
|
|
104
93
|
services.register('app.hello', {
|
|
105
94
|
parse: (value) => value,
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** Narrow declarations for the Electrobun 2.0.5 APIs used by the generated host. */
|
|
2
|
-
declare module 'electrobun/bun' {
|
|
3
|
-
import type { NativeWindow, SecureWindowOptions } from '@adea-ai/app-framework/secure-window'
|
|
4
|
-
export class BrowserWindow implements NativeWindow {
|
|
5
|
-
constructor(options: SecureWindowOptions)
|
|
6
|
-
webview: NativeWindow['webview']
|
|
7
|
-
on(event: 'close', handler: () => void): unknown
|
|
8
|
-
close(): unknown
|
|
9
|
-
}
|
|
10
|
-
export const ApplicationMenu: {
|
|
11
|
-
setApplicationMenu(
|
|
12
|
-
menu: import('@adea-ai/app-framework/application-menu').ApplicationMenuItem[]
|
|
13
|
-
): void
|
|
14
|
-
on(name: 'application-menu-clicked', handler: (event: unknown) => void): void
|
|
15
|
-
}
|
|
16
|
-
export const Utils: {
|
|
17
|
-
paths: { userData: string }
|
|
18
|
-
openExternal(url: string): boolean
|
|
19
|
-
openFileDialog(options?: {
|
|
20
|
-
startingFolder?: string
|
|
21
|
-
allowedFileTypes?: string
|
|
22
|
-
canChooseFiles?: boolean
|
|
23
|
-
canChooseDirectory?: boolean
|
|
24
|
-
allowsMultipleSelection?: boolean
|
|
25
|
-
}): Promise<string[]>
|
|
26
|
-
}
|
|
27
|
-
}
|