@omega.js/desktop 0.51.0 → 0.53.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 +18 -13
- package/dist/assets/css/core/_initialize.scss +1 -1
- package/dist/assets/js/core/app-shell.js +14 -15
- package/dist/assets/themes/_template/_theme.js +6 -6
- package/dist/assets/themes/base/_includes/global/sections/account.html +4 -4
- package/dist/assets/themes/base/_includes/global/sections/app-sidebar.html +5 -5
- package/dist/assets/themes/base/_layouts/frontend/pages/account/index.html +3 -3
- package/dist/assets/themes/base/_layouts/frontend/pages/alternatives/index.html +1 -1
- package/dist/assets/themes/base/_layouts/frontend/pages/blog/tags/tag.html +1 -1
- package/dist/assets/themes/base/_layouts/frontend/pages/payment/confirmation.html +1 -1
- package/dist/assets/themes/base/_sections/marketing/newsletter-cta/section.js +2 -3
- package/dist/assets/themes/base/_sections/verts/unit/section.html +1 -1
- package/dist/assets/themes/base/_sections/verts/unit/section.js +3 -4
- package/dist/assets/themes/base/_theme.js +4 -3
- package/dist/assets/themes/bootstrap/_theme.js +2 -2
- package/dist/assets/themes/bootstrap/overrides/_links.scss +1 -1
- package/dist/assets/themes/classy/_theme.js +8 -6
- package/dist/assets/themes/classy/css/marketing/_sections.scss +1 -2
- package/dist/assets/themes/classy/js/hero-demo-form.js +3 -2
- package/dist/assets/themes/neobrutalism/_theme.js +5 -5
- package/dist/assets/themes/neobrutalism/js/pages/test/libraries/layers/index.js +1 -1
- package/dist/assets/themes/newsflash/_theme.js +6 -6
- package/dist/assets/themes/newsflash/js/pages/test/libraries/layers/index.js +1 -1
- package/dist/build.js +87 -111
- package/dist/cli.js +1 -1
- package/dist/commands/build.js +2 -2
- package/dist/commands/cdp/capture.js +2 -2
- package/dist/commands/cdp/quit.js +2 -2
- package/dist/commands/cdp/relaunch.js +2 -2
- package/dist/commands/cdp/theme.js +1 -1
- package/dist/commands/clean.js +2 -2
- package/dist/commands/deploy.js +4 -4
- package/dist/commands/finalize-release.js +4 -4
- package/dist/commands/install.js +3 -3
- package/dist/commands/launch.js +2 -2
- package/dist/commands/lib/deploy-precheck.js +3 -3
- package/dist/commands/lib/ensure-target.js +6 -6
- package/dist/commands/package.js +2 -2
- package/dist/commands/publish.js +2 -2
- package/dist/commands/release.js +3 -3
- package/dist/commands/runner.js +145 -48
- package/dist/commands/sign-windows.js +5 -5
- package/dist/commands/test.js +4 -4
- package/dist/commands/update.js +2 -2
- package/dist/commands/validate-certs.js +4 -4
- package/dist/commands/version.js +3 -3
- package/dist/defaults/.github/workflows/build.yml +2 -0
- package/dist/defaults/AGENTS.md +17 -8
- package/dist/defaults/config/omega.json5 +7 -7
- package/dist/defaults/hooks/build/post.js +1 -1
- package/dist/defaults/hooks/build/pre.js +1 -1
- package/dist/defaults/hooks/deploy/pre.js +1 -1
- package/dist/defaults/hooks/release/post.js +1 -1
- package/dist/defaults/hooks/release/pre.js +1 -1
- package/dist/defaults/src/assets/js/components/about/index.js +3 -5
- package/dist/defaults/src/assets/js/components/main/index.js +3 -5
- package/dist/defaults/src/assets/js/components/settings/index.js +3 -5
- package/dist/defaults/src/integrations/context-menu/index.js +2 -2
- package/dist/defaults/src/integrations/menu/index.js +3 -3
- package/dist/defaults/src/integrations/tray/index.js +3 -3
- package/dist/defaults/src/main.js +3 -5
- package/dist/defaults/src/preload.js +3 -5
- package/dist/defaults/test/README.md +2 -2
- package/dist/gulp/main.js +9 -10
- package/dist/gulp/tasks/audit.js +7 -7
- package/dist/gulp/tasks/build-config.js +8 -8
- package/dist/gulp/tasks/bundle.js +16 -16
- package/dist/gulp/tasks/defaults.js +3 -3
- package/dist/gulp/tasks/distribute.js +2 -2
- package/dist/gulp/tasks/html.js +9 -9
- package/dist/gulp/tasks/package-quick.js +3 -3
- package/dist/gulp/tasks/package.js +3 -3
- package/dist/gulp/tasks/release.js +3 -3
- package/dist/gulp/tasks/sass.js +6 -6
- package/dist/gulp/tasks/serve.js +4 -4
- package/dist/hooks/notarize-artifacts.js +1 -1
- package/dist/hooks/notarize.js +1 -1
- package/dist/index.js +5 -8
- package/dist/lib/_environment-mixin.js +50 -0
- package/dist/lib/_lifecycle-mixin.js +45 -0
- package/dist/lib/analytics.js +33 -35
- package/dist/lib/app-state.js +14 -14
- package/dist/lib/auth-flow.js +18 -18
- package/dist/lib/auth-persistence.js +12 -12
- package/dist/lib/auth.js +421 -0
- package/dist/lib/auto-updater.js +49 -49
- package/dist/lib/context-menu.js +13 -13
- package/dist/lib/context.js +19 -19
- package/dist/lib/deep-link.js +34 -34
- package/dist/lib/fontawesome.js +5 -5
- package/dist/lib/ipc.js +4 -4
- package/dist/lib/menu.js +25 -25
- package/dist/lib/protocol.js +5 -5
- package/dist/lib/remote-config.js +22 -22
- package/dist/lib/remote-scripts.js +21 -21
- package/dist/lib/restart-manager/index.js +28 -28
- package/dist/lib/sign-helpers/exec-with-limit.js +1 -1
- package/dist/lib/sign-helpers/sign-events.js +1 -1
- package/dist/lib/startup.js +18 -13
- package/dist/lib/storage.js +10 -10
- package/dist/lib/templating.js +16 -16
- package/dist/lib/theme.js +10 -10
- package/dist/lib/tray.js +27 -27
- package/dist/lib/usage.js +11 -11
- package/dist/lib/window-manager.js +26 -26
- package/dist/main.js +398 -483
- package/dist/preload.js +236 -176
- package/dist/renderer.js +417 -391
- package/dist/runner/job-started.js +1 -1
- package/dist/test/fixtures/consumer-app/config/omega.json5 +1 -1
- package/dist/test/fixtures/consumer-app/src/assets/js/components/main/index.js +8 -11
- package/dist/test/fixtures/consumer-app/src/main.js +5 -7
- package/dist/test/fixtures/consumer-app/src/preload.js +2 -2
- package/dist/test/harness/boot-entry.js +22 -20
- package/dist/test/harness/main-entry.js +31 -30
- package/dist/test/harness/renderer-entry.js +5 -5
- package/dist/test/harness/renderer-preload.js +137 -141
- package/dist/test/index.js +10 -10
- package/dist/test/runner.js +2 -2
- package/dist/test/runners/boot.js +7 -6
- package/dist/test/runners/electron.js +3 -2
- package/dist/test/runners/render-event.js +2 -2
- package/dist/test/suites/boot/consumer-app-boots.test.js +57 -26
- package/dist/test/suites/boot/restart-manager.test.js +2 -2
- package/dist/test/suites/boot/storage-bundled.test.js +5 -5
- package/dist/test/suites/boot/theme.test.js +13 -13
- package/dist/test/suites/build/audit.test.js +1 -1
- package/dist/test/suites/build/auth-persistence-resolve.test.js +6 -6
- package/dist/test/suites/build/boot-fixture.test.js +2 -2
- package/dist/test/suites/build/boot-runner-timeout.test.js +6 -5
- package/dist/test/suites/build/brand-scss.test.js +1 -1
- package/dist/test/suites/build/build-json-bake.test.js +1 -1
- package/dist/test/suites/build/cli.test.js +2 -2
- package/dist/test/suites/build/config-schema.test.js +5 -5
- package/dist/test/suites/build/defaults-scaffold.test.js +2 -2
- package/dist/test/suites/build/deploy-hook.test.js +3 -3
- package/dist/test/suites/build/ensure-target.test.js +2 -2
- package/dist/test/suites/build/env-delivery.test.js +2 -2
- package/dist/test/suites/build/esm-only-dependency.test.js +2 -2
- package/dist/test/suites/build/exports.test.js +9 -8
- package/dist/test/suites/build/get-config.test.js +4 -4
- package/dist/test/suites/build/manifest-deps.test.js +1 -1
- package/dist/test/suites/build/merge-line-files.test.js +1 -1
- package/dist/test/suites/build/omega-shell.test.js +34 -2
- package/dist/test/suites/build/omega.test.js +350 -0
- package/dist/test/suites/build/renderer-auth-bridge.test.js +211 -78
- package/dist/test/suites/build/runner.test.js +612 -5
- package/dist/test/suites/build/sentry.test.js +2 -2
- package/dist/test/suites/build/sign-windows-e2e.test.js +2 -2
- package/dist/test/suites/build/templating.test.js +3 -3
- package/dist/test/suites/build/test-stealth.test.js +7 -9
- package/dist/test/suites/build/url-helpers.test.js +55 -56
- package/dist/test/suites/build/validate-config.test.js +2 -2
- package/dist/test/suites/build/wave5-pins.test.js +2 -2
- package/dist/test/suites/main/analytics.test.js +59 -59
- package/dist/test/suites/main/app-state.test.js +66 -66
- package/dist/test/suites/main/auth-flow.test.js +41 -41
- package/dist/test/suites/main/auth-persistence.test.js +54 -43
- package/dist/test/suites/main/{client-bridge.integration.test.js → auth.integration.test.js} +10 -9
- package/dist/test/suites/main/auth.test.js +336 -0
- package/dist/test/suites/main/auto-updater.test.js +134 -134
- package/dist/test/suites/main/boot-sequence.test.js +37 -49
- package/dist/test/suites/main/context-menu.test.js +51 -50
- package/dist/test/suites/main/context.test.js +25 -25
- package/dist/test/suites/main/deep-link.test.js +74 -74
- package/dist/test/suites/main/fontawesome.test.js +27 -27
- package/dist/test/suites/main/ipc.test.js +35 -35
- package/dist/test/suites/main/menu.test.js +101 -100
- package/dist/test/suites/main/protocol.test.js +19 -19
- package/dist/test/suites/main/remote-config.test.js +63 -63
- package/dist/test/suites/main/remote-scripts.test.js +103 -103
- package/dist/test/suites/main/request.test.js +71 -0
- package/dist/test/suites/main/restart-manager.test.js +33 -33
- package/dist/test/suites/main/startup-paths-and-ua.test.js +4 -4
- package/dist/test/suites/main/startup.test.js +26 -26
- package/dist/test/suites/main/stealth-window.test.js +1 -1
- package/dist/test/suites/main/storage.test.js +25 -25
- package/dist/test/suites/main/theme.test.js +34 -34
- package/dist/test/suites/main/tray.test.js +79 -79
- package/dist/test/suites/main/url-helpers.test.js +133 -133
- package/dist/test/suites/main/usage.test.js +25 -25
- package/dist/test/suites/main/window-bounds.test.js +27 -27
- package/dist/test/suites/main/window-manager.test.js +44 -44
- package/dist/test/suites/renderer/analytics-bridge.test.js +5 -5
- package/dist/test/suites/renderer/cross-context-helpers.test.js +37 -31
- package/dist/test/suites/renderer/round-trip.test.js +3 -3
- package/dist/test/suites/renderer/tooltips.test.js +15 -15
- package/dist/test/suites/renderer/{window-em-surface.test.js → window-desktop-surface.test.js} +27 -7
- package/dist/test/utils/extended-mode-warning.js +1 -1
- package/dist/utils/boot-harness.js +56 -0
- package/dist/utils/mode-helpers.js +2 -15
- package/dist/utils/ship-keys.js +3 -3
- package/dist/utils/signing-status.js +51 -0
- package/dist/utils/test-events.js +7 -0
- package/dist/utils/test-stealth.js +6 -6
- package/dist/utils/url-helpers.js +52 -42
- package/dist/utils/user-agent.js +44 -0
- package/dist/vendor/account/engine.js +3 -3
- package/dist/vendor/account/index.js +14 -45
- package/dist/vendor/account/resolve-account.js +44 -0
- package/dist/vendor/account/schema.js +1 -1
- package/dist/vendor/account/user.js +99 -0
- package/dist/vendor/config/client-config.js +1 -1
- package/dist/vendor/config/environment.js +11 -30
- package/dist/vendor/config/index.js +13 -12
- package/dist/vendor/config/load.js +1 -2
- package/dist/vendor/config/platforms.js +1 -1
- package/dist/vendor/config/repo.js +24 -0
- package/dist/vendor/config/retired-keys.js +2 -2
- package/dist/vendor/config/schema.js +5 -8
- package/dist/vendor/config/site-global.js +2 -3
- package/dist/vendor/config/validate.js +1 -2
- package/dist/vendor/config/winback.js +1 -1
- package/dist/vendor/devkit/actions-secrets.js +1 -1
- package/dist/vendor/devkit/attach-log-file.js +1 -1
- package/dist/vendor/devkit/brand-version.js +162 -1
- package/dist/vendor/devkit/build-json.js +1 -1
- package/dist/vendor/devkit/cli-router.js +3 -4
- package/dist/vendor/devkit/defaults-engine.js +9 -11
- package/dist/vendor/devkit/deploy.js +64 -4
- package/dist/vendor/devkit/git-remote.js +78 -1
- package/dist/vendor/devkit/local.js +53 -3
- package/dist/vendor/devkit/lockfile.js +127 -0
- package/dist/vendor/devkit/merge-line-files.js +2 -3
- package/dist/vendor/devkit/pack-local.js +4 -7
- package/dist/vendor/devkit/preludes/origin-heal.js +35 -49
- package/dist/vendor/devkit/target-secrets.js +34 -45
- package/dist/vendor/devkit/test/runner-core.js +6 -6
- package/dist/vendor/monitoring/env.js +2 -2
- package/dist/vendor/monitoring/index.js +1 -1
- package/dist/vendor/monitoring/main.js +1 -1
- package/dist/vendor/monitoring/preload.js +1 -1
- package/dist/vendor/monitoring/renderer.js +1 -1
- package/docs/analytics.md +8 -8
- package/docs/app-state.md +19 -19
- package/docs/audit.md +4 -4
- package/docs/{client-bridge.md → auth.md} +88 -73
- package/docs/auto-updater.md +8 -8
- package/docs/boot-sequence.md +11 -6
- package/docs/build-system.md +1 -1
- package/docs/cdp-debugging.md +1 -1
- package/docs/common-mistakes.md +7 -7
- package/docs/config-schema.md +1 -1
- package/docs/context-menu.md +13 -13
- package/docs/context.md +11 -11
- package/docs/css.md +3 -9
- package/docs/deep-link.md +25 -25
- package/docs/environment-detection.md +16 -16
- package/docs/fontawesome.md +7 -5
- package/docs/hooks.md +8 -8
- package/docs/index.md +39 -28
- package/docs/ipc.md +10 -10
- package/docs/lib-modules.md +9 -9
- package/docs/logging.md +12 -14
- package/docs/menu.md +18 -18
- package/docs/releasing.md +4 -2
- package/docs/remote-config.md +9 -9
- package/docs/remote-scripts.md +12 -12
- package/docs/restart-manager.md +8 -8
- package/docs/runner.md +12 -10
- package/docs/sentry.md +4 -4
- package/docs/shared/analytics.md +1 -1
- package/docs/shared/brands.md +1 -1
- package/docs/shared/breaking-changes.md +79 -13
- package/docs/shared/config.md +24 -21
- package/docs/shared/deploys.md +30 -7
- package/docs/shared/local-dev.md +5 -3
- package/docs/shared/logging.md +1 -1
- package/docs/shared/monitoring.md +5 -5
- package/docs/shared/testing.md +2 -2
- package/docs/shared/theming.md +1 -1
- package/docs/shared/translation.md +19 -10
- package/docs/signing.md +1 -1
- package/docs/startup.md +16 -16
- package/docs/storage.md +11 -11
- package/docs/templating.md +3 -3
- package/docs/test-boot-layer.md +12 -12
- package/docs/test-framework.md +17 -17
- package/docs/themes.md +7 -7
- package/docs/tooltips.md +2 -2
- package/docs/tray.md +31 -31
- package/docs/usage.md +7 -7
- package/docs/verts.md +1 -1
- package/docs/windows.md +22 -22
- package/package.json +3 -4
- package/dist/lib/client-bridge.js +0 -374
- package/dist/lib/logger.js +0 -4
- package/dist/test/suites/build/manager.test.js +0 -213
- package/dist/test/suites/main/client-bridge.test.js +0 -262
package/dist/commands/runner.js
CHANGED
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
// the defaults — and the orgs it serves. How a value that
|
|
15
15
|
// is already there gets changed.
|
|
16
16
|
// register-org <org> Register the runner against one specific GH org.
|
|
17
|
-
// start
|
|
18
|
-
//
|
|
19
|
-
//
|
|
17
|
+
// start The one command: installs a bare box, refreshes a stale
|
|
18
|
+
// actions/runner download in place, registers any admin
|
|
19
|
+
// org the box does not serve yet, then brings EVERY
|
|
20
|
+
// registered org online, detached, in Startup-shortcut
|
|
21
|
+
// order. An org already alive is named and skipped; the
|
|
22
|
+
// terminal is never taken over.
|
|
20
23
|
// restart stop, wait for every listener to go, then start.
|
|
21
24
|
// stop Kill every Runner.Listener.exe under RUNNER_HOME.
|
|
22
25
|
// status Registered orgs, Startup shortcuts, live listeners.
|
|
23
26
|
// uninstall Remove everything — legacy services and tasks, and the
|
|
24
|
-
//
|
|
25
|
-
// self-update Force an immediate self-update of @omega.js/desktop (npm i -g @omega.js/desktop@latest).
|
|
27
|
+
// legacy em-runner install, included.
|
|
26
28
|
// monitor Tail the JSONL signing event log, pretty-printed.
|
|
27
29
|
//
|
|
28
|
-
// Every subcommand except `
|
|
30
|
+
// Every subcommand except `monitor` refuses on non-Windows
|
|
29
31
|
// (set OMEGA_RUNNER_FORCE=1 to override — testing only).
|
|
30
32
|
|
|
31
33
|
const path = require('path');
|
|
@@ -33,9 +35,8 @@ const fs = require('fs');
|
|
|
33
35
|
const os = require('os');
|
|
34
36
|
const jetpack = require('fs-jetpack');
|
|
35
37
|
|
|
36
|
-
const
|
|
37
|
-
const logger =
|
|
38
|
-
const { safeInstall } = require('../utils/safe-install');
|
|
38
|
+
const build = require('../build.js');
|
|
39
|
+
const logger = build.logger('runner');
|
|
39
40
|
|
|
40
41
|
const RUNNER_LABELS = ['self-hosted', 'windows', 'ev-token'];
|
|
41
42
|
|
|
@@ -62,7 +63,7 @@ const attachLogFile = require('../utils/attach-log-file.js');
|
|
|
62
63
|
const RUNNER_HOME = process.env.OMEGA_RUNNER_HOME || defaultRunnerHome();
|
|
63
64
|
loadRunnerEnv({ home: RUNNER_HOME });
|
|
64
65
|
|
|
65
|
-
// The
|
|
66
|
+
// The legacy generation of this command (`em runner`) laid the same design
|
|
66
67
|
// down under other names: the home was %LOCALAPPDATA%\em-runner (C:\actions-runners
|
|
67
68
|
// before that), and the Startup shortcuts and the GitHub-side runners were
|
|
68
69
|
// `em-runner-<host>-<org>`. An upgraded box still has all of it — live, and
|
|
@@ -103,8 +104,8 @@ function orgRunnerDir(org, home) {
|
|
|
103
104
|
}
|
|
104
105
|
const ACTIONS_RUNNER_VERSION = '2.319.1'; // pinned; bump intentionally
|
|
105
106
|
|
|
106
|
-
// The subcommands, and the
|
|
107
|
-
//
|
|
107
|
+
// The subcommands, and the one of them that runs on any platform: monitor only
|
|
108
|
+
// reads a log file. Every other one is the box's.
|
|
108
109
|
const SUBCOMMANDS = {
|
|
109
110
|
'install': install,
|
|
110
111
|
'config': configureRunner,
|
|
@@ -114,17 +115,16 @@ const SUBCOMMANDS = {
|
|
|
114
115
|
'stop': stopServices,
|
|
115
116
|
'status': statusServices,
|
|
116
117
|
'uninstall': uninstall,
|
|
117
|
-
'self-update': selfUpdate,
|
|
118
118
|
'monitor': monitor,
|
|
119
119
|
};
|
|
120
|
-
const ANY_PLATFORM_SUBCOMMANDS = new Set(['
|
|
120
|
+
const ANY_PLATFORM_SUBCOMMANDS = new Set(['monitor']);
|
|
121
121
|
|
|
122
122
|
// The ones that CHANGE the machine: they register, deregister, download, delete,
|
|
123
|
-
// kill listeners, rewrite the box's own configuration
|
|
124
|
-
//
|
|
123
|
+
// kill listeners, or rewrite the box's own configuration. A test process may
|
|
124
|
+
// only point these at a scratch home
|
|
125
125
|
// ([#337](https://github.com/Omega-JS-Stack/omega/issues/337) — the suite once
|
|
126
126
|
// ran a real install against the box). `status` and `monitor` only read.
|
|
127
|
-
const MUTATING_SUBCOMMANDS = new Set(['install', 'config', 'register-org', 'start', 'restart', 'stop', 'uninstall'
|
|
127
|
+
const MUTATING_SUBCOMMANDS = new Set(['install', 'config', 'register-org', 'start', 'restart', 'stop', 'uninstall']);
|
|
128
128
|
|
|
129
129
|
module.exports = async function (options) {
|
|
130
130
|
options = options || {};
|
|
@@ -207,7 +207,7 @@ async function install(options) {
|
|
|
207
207
|
// the calling terminal at normal user privilege.
|
|
208
208
|
|
|
209
209
|
// Idempotent by replacement: always tear down any prior install before starting —
|
|
210
|
-
// the omega one, or the
|
|
210
|
+
// the omega one, or the legacy em-runner one an upgraded box still runs.
|
|
211
211
|
if (jetpack.exists(home) || listLegacyRunnerHomes({ home }).length > 0 || listLegacyRunnerStartupShortcuts().length > 0) {
|
|
212
212
|
logger.log(`Existing runner installation detected — uninstalling first for a clean re-install...`);
|
|
213
213
|
try {
|
|
@@ -261,7 +261,7 @@ async function install(options) {
|
|
|
261
261
|
// admin orgs on a tick ran as NT AUTHORITY\NETWORK SERVICE in Session 0, so
|
|
262
262
|
// the runners it spawned could not see the user's cert store and the Startup
|
|
263
263
|
// shortcuts it wrote landed in the wrong profile. Adding a new org is a
|
|
264
|
-
// `
|
|
264
|
+
// `npx omega runner start` away; uninstall() still tears down any leftover
|
|
265
265
|
// watcher service from an older install.
|
|
266
266
|
|
|
267
267
|
// 5. Save install metadata.
|
|
@@ -304,7 +304,7 @@ async function install(options) {
|
|
|
304
304
|
logger.log('');
|
|
305
305
|
logger.log(`Bringing every registered runner (${succeeded.length}) online in the background. 'npx omega runner status' shows them, 'npx omega runner monitor' tails the log.`);
|
|
306
306
|
logger.log('');
|
|
307
|
-
await startServices({ ...options, _home: home });
|
|
307
|
+
await startServices({ ...options, _home: home, _reconcileDone: true });
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
@@ -369,8 +369,8 @@ async function registerOrg(options) {
|
|
|
369
369
|
// THIS host. Without this, re-running install accumulates orphaned runners (one per
|
|
370
370
|
// failed/aborted install, one per host rename, etc.) which causes actions/runner to
|
|
371
371
|
// auto-suffix the new runner's name (e.g. `-2872`) and breaks our ability to predict
|
|
372
|
-
// service names. Match prefix is `omega-runner-<host>-<org>` — and the
|
|
373
|
-
//
|
|
372
|
+
// service names. Match prefix is `omega-runner-<host>-<org>` — and the legacy
|
|
373
|
+
// `em-runner-<host>-<org>`, the same box's older registration — so we never touch
|
|
374
374
|
// user-created runners or runners from other hosts.
|
|
375
375
|
//
|
|
376
376
|
// We do this BEFORE fetching the registration token because the token is one-shot
|
|
@@ -416,7 +416,7 @@ async function registerOrg(options) {
|
|
|
416
416
|
const runnerDir = orgRunnerDir(org, home);
|
|
417
417
|
const templateDir = options._templateDir || path.join(home, '_template');
|
|
418
418
|
if (!jetpack.exists(path.join(templateDir, 'config.cmd'))) {
|
|
419
|
-
throw new Error(`actions/runner template not found at ${templateDir}. Run 'npx omega runner
|
|
419
|
+
throw new Error(`actions/runner template not found at ${templateDir}. Run 'npx omega runner start' first.`);
|
|
420
420
|
}
|
|
421
421
|
if (jetpack.exists(runnerDir)) {
|
|
422
422
|
logger.log(` Removing stale actions-runner-${org.toLowerCase()}/ before re-clone…`);
|
|
@@ -528,7 +528,8 @@ async function registerOrg(options) {
|
|
|
528
528
|
// What `start` settles before it touches a listener: the box's required keys —
|
|
529
529
|
// asked in a terminal and refused without one, exactly like install — and then
|
|
530
530
|
// the orgs the .env names against the orgs this install actually registered.
|
|
531
|
-
// start
|
|
531
|
+
// start only ever ADDS a named admin org (reconcileRunnerInstall); reshaping the
|
|
532
|
+
// box to the list is install's, so the mismatch names it.
|
|
532
533
|
async function startPreflight(options) {
|
|
533
534
|
const { home, env = process.env, logger: log = logger, prompt, interactive } = options || {};
|
|
534
535
|
await ensureRunnerConfig({ home, env, logger: log, prompt, interactive });
|
|
@@ -557,7 +558,7 @@ async function startPreflight(options) {
|
|
|
557
558
|
const named = parseRunnerOrgs(env.OMEGA_RUNNER_ORGS);
|
|
558
559
|
const registered = readConfig(home).registeredOrgs || [];
|
|
559
560
|
if (named.length > 0 && !sameRunnerOrgs(named, registered)) {
|
|
560
|
-
log.warn(`OMEGA_RUNNER_ORGS names ${named.join(', ')} but this install registered ${registered.join(', ') || '(none)'}.
|
|
561
|
+
log.warn(`OMEGA_RUNNER_ORGS names ${named.join(', ')} but this install registered ${registered.join(', ') || '(none)'}. \`start\` registers a named admin org it does not serve yet and keeps the rest; \`npx omega runner install\` reshapes the box to the list.`);
|
|
561
562
|
}
|
|
562
563
|
}
|
|
563
564
|
|
|
@@ -574,6 +575,92 @@ function runnerStartupTargets(home) {
|
|
|
574
575
|
});
|
|
575
576
|
}
|
|
576
577
|
|
|
578
|
+
// What `start` settles between the preflight and the spawns
|
|
579
|
+
// ([#937](https://github.com/Omega-JS-Stack/omega/issues/937)), so a box never
|
|
580
|
+
// needs a second verb to catch up:
|
|
581
|
+
// 1. a stale actions/runner download is refreshed IN PLACE: the template is
|
|
582
|
+
// re-downloaded and laid over each org dir whose listener is down. The
|
|
583
|
+
// registration (`.runner`, `.credentials`, `.env`) is never in the
|
|
584
|
+
// template, so it survives the copy. A live listener holds its binaries
|
|
585
|
+
// open, so that org is skipped and named with `restart`, and the new
|
|
586
|
+
// version is recorded only once every org dir took it. No teardown. A
|
|
587
|
+
// download or a copy that fails is one warn and a skipped refresh, never
|
|
588
|
+
// a failed start: the next start tries again.
|
|
589
|
+
// 2. an admin org the box does not serve yet (OMEGA_RUNNER_ORGS honoured) is
|
|
590
|
+
// registered, Startup shortcut and all. The only step that needs GitHub,
|
|
591
|
+
// so discovery that fails is one line and the box still comes online.
|
|
592
|
+
// GH_TOKEN is never missing here: it is a required key, and the preflight
|
|
593
|
+
// refuses a box without one. Orgs registered outside the filter stay;
|
|
594
|
+
// reshaping the box to the list is install's.
|
|
595
|
+
//
|
|
596
|
+
// `_download`, `_discoverOrgs` and `_registerOrg` are the tests' seams, the way
|
|
597
|
+
// `_spawn` is. Registration is not home-scoped (it acts on GitHub with the real
|
|
598
|
+
// token, whatever scratch home a case made), so a test run that has not
|
|
599
|
+
// injected both GitHub seams skips the org check instead of reaching it.
|
|
600
|
+
async function reconcileRunnerInstall(options) {
|
|
601
|
+
const home = options._home;
|
|
602
|
+
const env = options._env;
|
|
603
|
+
const log = options._logger;
|
|
604
|
+
const listen = options._listeners;
|
|
605
|
+
const download = options._download || downloadActionsRunner;
|
|
606
|
+
const templateDir = path.join(home, '_template');
|
|
607
|
+
|
|
608
|
+
const installed = readConfig(home).actionsRunnerVersion;
|
|
609
|
+
if (installed !== ACTIONS_RUNNER_VERSION) {
|
|
610
|
+
log.log(`actions/runner ${installed || '(unrecorded)'} is installed and ${ACTIONS_RUNNER_VERSION} is pinned: refreshing in place.`);
|
|
611
|
+
let downloaded = true;
|
|
612
|
+
try {
|
|
613
|
+
await download(templateDir, home);
|
|
614
|
+
} catch (e) {
|
|
615
|
+
log.warn(`✗ actions/runner ${ACTIONS_RUNNER_VERSION} download failed (${e.message}): refresh skipped until the next start.`);
|
|
616
|
+
downloaded = false;
|
|
617
|
+
}
|
|
618
|
+
if (downloaded) {
|
|
619
|
+
let skipped = 0;
|
|
620
|
+
for (const { org, dir } of listOrgRunnerDirs(home)) {
|
|
621
|
+
if (listen(dir).length > 0) {
|
|
622
|
+
log.warn(`· ${org} is running, so its actions/runner files are locked and were not refreshed. Run \`npx omega runner restart\` to refresh it.`);
|
|
623
|
+
skipped++;
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
try {
|
|
627
|
+
jetpack.copy(templateDir, dir, { overwrite: true });
|
|
628
|
+
log.log(`✓ ${org} refreshed to actions/runner ${ACTIONS_RUNNER_VERSION}`);
|
|
629
|
+
} catch (e) {
|
|
630
|
+
log.warn(`✗ ${org} was not refreshed (${e.message}): the next start tries again.`);
|
|
631
|
+
skipped++;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (skipped === 0) saveConfig({ actionsRunnerVersion: ACTIONS_RUNNER_VERSION }, home);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (isTestRun() && !(options._discoverOrgs && options._registerOrg)) {
|
|
639
|
+
log.log('Org check skipped: a test run never asks GitHub unless both _discoverOrgs and _registerOrg are injected.');
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
const discover = options._discoverOrgs || discoverAdminOrgs;
|
|
643
|
+
const register = options._registerOrg || registerOrg;
|
|
644
|
+
let adminOrgs;
|
|
645
|
+
try {
|
|
646
|
+
adminOrgs = await discover();
|
|
647
|
+
} catch (e) {
|
|
648
|
+
log.warn(`Org check skipped: could not list your admin orgs (${e.message}).`);
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const { orgs } = selectRunnerOrgs(adminOrgs, env.OMEGA_RUNNER_ORGS);
|
|
652
|
+
const served = new Set((readConfig(home).registeredOrgs || []).map((org) => org.toLowerCase()));
|
|
653
|
+
for (const org of orgs.filter((o) => !served.has(o.toLowerCase()))) {
|
|
654
|
+
log.log(`Registering ${org}: an admin org this box does not serve yet.`);
|
|
655
|
+
try {
|
|
656
|
+
await register({ ...options, _: ['runner', 'register-org', org], _templateDir: templateDir });
|
|
657
|
+
} catch (e) {
|
|
658
|
+
log.warn(`✗ register ${org}: ${e.message}`);
|
|
659
|
+
process.exitCode = 1;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
577
664
|
// Every registered org, brought online detached, in Startup-shortcut order.
|
|
578
665
|
//
|
|
579
666
|
// A box registers one runner per org, and `start` used to bring up exactly ONE
|
|
@@ -589,7 +676,15 @@ function runnerStartupTargets(home) {
|
|
|
589
676
|
// `_spawn` and `_listeners` are injected by the tests, the same way `_home` and
|
|
590
677
|
// `_logger` are: neither cmd.exe nor the process scan exists off Windows.
|
|
591
678
|
// `_preflightDone` is `restart`'s: it settles the box config BEFORE it kills
|
|
592
|
-
// anything, so the walk must not run a second time here.
|
|
679
|
+
// anything, so the walk must not run a second time here. The reconcile is NOT
|
|
680
|
+
// gated on it: after restart's stop is exactly when nothing is locked.
|
|
681
|
+
// `_reconcileDone` is install's alone: it just downloaded and registered, so the
|
|
682
|
+
// reconcile is skipped there.
|
|
683
|
+
//
|
|
684
|
+
// A bare box (no template to clone from) is handed to install, `_install` in
|
|
685
|
+
// the tests, which ends by calling this function again with the template in
|
|
686
|
+
// place. A test run without `_install` refuses: the real install downloads,
|
|
687
|
+
// discovers and registers against GitHub, and no scratch home scopes that.
|
|
593
688
|
async function startServices(options) {
|
|
594
689
|
options = options || {};
|
|
595
690
|
ensureWindows();
|
|
@@ -597,8 +692,23 @@ async function startServices(options) {
|
|
|
597
692
|
const log = options._logger || logger;
|
|
598
693
|
const spawnIt = options._spawn || spawnRunnerDetached;
|
|
599
694
|
const listen = options._listeners || listRunnerListenerProcessesUnder;
|
|
695
|
+
if (!jetpack.exists(path.join(home, '_template', 'config.cmd'))) {
|
|
696
|
+
if (isTestRun() && !options._install) {
|
|
697
|
+
throw new Error(
|
|
698
|
+
`Refusing to install onto the bare runner home ${home}: this is a test run `
|
|
699
|
+
+ '(OMEGA_TEST_RUNNER / OMEGA_TEST_MODE) and the call did not inject `_install`. The real install '
|
|
700
|
+
+ 'downloads actions/runner and registers every admin org against GitHub with GH_TOKEN.',
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
log.log(`No runner install under ${home}: running the full install.`);
|
|
704
|
+
return (options._install || install)(options);
|
|
705
|
+
}
|
|
706
|
+
const env = options._env || process.env;
|
|
600
707
|
if (!options._preflightDone) {
|
|
601
|
-
await startPreflight({ home, env
|
|
708
|
+
await startPreflight({ home, env, logger: log, prompt: options._prompt, interactive: options._interactive });
|
|
709
|
+
}
|
|
710
|
+
if (!options._reconcileDone) {
|
|
711
|
+
await reconcileRunnerInstall({ ...options, _home: home, _env: env, _logger: log, _listeners: listen });
|
|
602
712
|
}
|
|
603
713
|
const targets = runnerStartupTargets(home);
|
|
604
714
|
if (targets.length === 0) {
|
|
@@ -762,7 +872,7 @@ async function statusServices(options) {
|
|
|
762
872
|
logger.log('');
|
|
763
873
|
const report = orgRunnerReport({ home });
|
|
764
874
|
if (report.length === 0) {
|
|
765
|
-
logger.warn('No orgs registered. Run `npx omega runner
|
|
875
|
+
logger.warn('No orgs registered. Run `npx omega runner start`.');
|
|
766
876
|
} else {
|
|
767
877
|
logger.log(`Per-org runner state (${report.length}):`);
|
|
768
878
|
for (const { state, lines } of report) {
|
|
@@ -790,7 +900,7 @@ async function statusServices(options) {
|
|
|
790
900
|
}
|
|
791
901
|
}
|
|
792
902
|
|
|
793
|
-
// The
|
|
903
|
+
// The legacy install (`em runner`): its home, its Startup
|
|
794
904
|
// shortcuts, and any listener still running out of it. None of it answers to
|
|
795
905
|
// the omega names above, so it is named here and torn down by `uninstall`.
|
|
796
906
|
const legacyHomes = listLegacyRunnerHomes({ home });
|
|
@@ -879,7 +989,7 @@ async function uninstall(options) {
|
|
|
879
989
|
// handles asynchronously after stop).
|
|
880
990
|
await removeRunnerHomeWithRetry(new Set(failed.map((f) => f.dir)), home);
|
|
881
991
|
|
|
882
|
-
// The
|
|
992
|
+
// The legacy em-runner install, when this box still has one: the same
|
|
883
993
|
// teardown, org by org, so its GitHub-side registrations come off too.
|
|
884
994
|
const legacy = await uninstallLegacyRunnerInstalls(home);
|
|
885
995
|
const stillRegistered = [...failed, ...legacy.failed];
|
|
@@ -892,7 +1002,7 @@ async function uninstall(options) {
|
|
|
892
1002
|
logger.warn(` Their directories were kept — re-run 'npx omega runner uninstall' to retry, or delete them under each org's Settings → Actions → Runners.`);
|
|
893
1003
|
}
|
|
894
1004
|
|
|
895
|
-
// Tear down the
|
|
1005
|
+
// Tear down the legacy runner install: its `em-runner-*`
|
|
896
1006
|
// Startup shortcuts, then each legacy home — deregister every org dir through
|
|
897
1007
|
// its own config.cmd, kill what runs out of it, remove it. A registration that
|
|
898
1008
|
// did not come off keeps its directory, exactly as the omega home's does.
|
|
@@ -1161,19 +1271,6 @@ function identifyHandleHolders(targetPath) {
|
|
|
1161
1271
|
}
|
|
1162
1272
|
}
|
|
1163
1273
|
|
|
1164
|
-
// ─── self-update ────────────────────────────────────────────────────────────────
|
|
1165
|
-
async function selfUpdate() {
|
|
1166
|
-
const { execute } = require('node-powertools');
|
|
1167
|
-
logger.log('Updating @omega.js/desktop to latest…');
|
|
1168
|
-
try {
|
|
1169
|
-
const out = await safeInstall('npm i -g @omega.js/desktop@latest');
|
|
1170
|
-
logger.log(out);
|
|
1171
|
-
logger.log('✓ @omega.js/desktop updated.');
|
|
1172
|
-
} catch (e) {
|
|
1173
|
-
logger.warn(`Self-update failed: ${e.message}`);
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
1274
|
// ─── helpers ────────────────────────────────────────────────────────────────────
|
|
1178
1275
|
|
|
1179
1276
|
const WATCHER_SERVICE_NAME = 'omega-runner-watcher';
|
|
@@ -1560,7 +1657,7 @@ function listRunnerStartupShortcuts(startupDir) {
|
|
|
1560
1657
|
return listStartupShortcuts('omega-runner-', startupDir);
|
|
1561
1658
|
}
|
|
1562
1659
|
|
|
1563
|
-
// The
|
|
1660
|
+
// The legacy shortcuts: `em-runner-<host>-<org>`, which `status` names
|
|
1564
1661
|
// and `uninstall` removes — never anything `start` would launch.
|
|
1565
1662
|
function listLegacyRunnerStartupShortcuts(startupDir) {
|
|
1566
1663
|
return listStartupShortcuts(LEGACY_RUNNER_PREFIX, startupDir);
|
|
@@ -1571,8 +1668,8 @@ function listLegacyRunnerStartupShortcuts(startupDir) {
|
|
|
1571
1668
|
// wrapper that blocks for the lifetime of the listener with cwd = runnerDir;
|
|
1572
1669
|
// a long-lived cmd.exe holding cwd inside RUNNER_HOME blocks every later
|
|
1573
1670
|
// uninstall with EPERM. Bypassing run.cmd loses its self-update relaunch
|
|
1574
|
-
// path, but `
|
|
1575
|
-
//
|
|
1671
|
+
// path, but `npx omega runner start` refreshing the runner binary in place
|
|
1672
|
+
// is the update mechanism in @omega.js/desktop anyway.
|
|
1576
1673
|
//
|
|
1577
1674
|
// Detached + windowsHide + ignored stdio = no console window flashes during
|
|
1578
1675
|
// install and the listener survives the install command's exit. UAC-
|
|
@@ -1733,7 +1830,7 @@ async function monitor(options) {
|
|
|
1733
1830
|
// exactly which orgs the monitor will pick up signing events from.
|
|
1734
1831
|
const report = orgRunnerReport({ home });
|
|
1735
1832
|
if (report.length === 0) {
|
|
1736
|
-
logger.log('(no orgs registered yet
|
|
1833
|
+
logger.log('(no orgs registered yet: run `npx omega runner start` first)');
|
|
1737
1834
|
} else {
|
|
1738
1835
|
logger.log(`Monitoring signing requests across ${report.length} org(s):`);
|
|
1739
1836
|
for (const { state, lines } of report) {
|
|
@@ -21,8 +21,8 @@ const os = require('os');
|
|
|
21
21
|
const jetpack = require('fs-jetpack');
|
|
22
22
|
const { execute } = require('node-powertools');
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
const logger =
|
|
24
|
+
const build = require('../build.js');
|
|
25
|
+
const logger = build.logger('sign-windows');
|
|
26
26
|
|
|
27
27
|
// The box's own signing configuration (`<runner home>\.env`: the cert, the PIN,
|
|
28
28
|
// signtool) is read before anything below looks at process.env, so a manual
|
|
@@ -90,9 +90,9 @@ async function runSignCommand(options) {
|
|
|
90
90
|
return smokeTest();
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const strategy =
|
|
93
|
+
const strategy = build.getWindowsSignStrategy();
|
|
94
94
|
|
|
95
|
-
const config =
|
|
95
|
+
const config = build.getConfig();
|
|
96
96
|
const projectRoot = process.cwd();
|
|
97
97
|
|
|
98
98
|
// Resolve --in and --out (CLI flags) → directories of unsigned / signed artifacts.
|
|
@@ -441,7 +441,7 @@ async function signWithSigntool(targets, inDir, outDir, deps) {
|
|
|
441
441
|
// (mac/linux equivalents are produced by electron-builder during their publish step,
|
|
442
442
|
// but Windows is split into a post-build sign job so we have to write the yml here).
|
|
443
443
|
if (signedExes.length > 0) {
|
|
444
|
-
const pkg =
|
|
444
|
+
const pkg = build.getPackage('project') || {};
|
|
445
445
|
const version = pkg.version;
|
|
446
446
|
if (!version) {
|
|
447
447
|
log.warn('Could not determine version from package.json; skipping latest.yml generation.');
|
package/dist/commands/test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
-
const
|
|
5
|
-
const logger =
|
|
4
|
+
const build = require('../build.js');
|
|
5
|
+
const logger = build.logger('test');
|
|
6
6
|
const { run } = require('../test/runner.js');
|
|
7
7
|
const attachLogFile = require('../utils/attach-log-file.js');
|
|
8
8
|
const { EXTENDED_MODE_WARNING } = require('../test/utils/extended-mode-warning.js');
|
|
@@ -43,7 +43,7 @@ module.exports = async function (options) {
|
|
|
43
43
|
// Extended mode — opt into tests that hit REAL external services (Firebase, analytics,
|
|
44
44
|
// update feeds) instead of skipping them. Off by default so `npx omega test` stays fast and
|
|
45
45
|
// offline-safe. The canonical signal is the unprefixed `TEST_EXTENDED_MODE` env var — the
|
|
46
|
-
// SAME name
|
|
46
|
+
// SAME name on every framework (cross-framework parity); `--extended` is the CLI
|
|
47
47
|
// shorthand. Once set on process.env it propagates to every spawned child (electron
|
|
48
48
|
// main/renderer/boot, the gulp boot build) automatically via `{ ...process.env }`.
|
|
49
49
|
const extended = options.extended === true
|
|
@@ -58,7 +58,7 @@ module.exports = async function (options) {
|
|
|
58
58
|
// When @omega.js/desktop itself runs its own boot-layer tests (the cwd's package.json is @omega.js/desktop's), there's
|
|
59
59
|
// no real consumer app to boot. Point the boot runner at the fixture under
|
|
60
60
|
// dist/test/fixtures/consumer-app unless the caller has already set OMEGA_TEST_BOOT_PROJECT
|
|
61
|
-
// explicitly.
|
|
61
|
+
// explicitly.
|
|
62
62
|
if (!process.env.OMEGA_TEST_BOOT_PROJECT) {
|
|
63
63
|
try {
|
|
64
64
|
const cwdPkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
|
package/dist/commands/update.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* non-quarantined, non-breaking set (`--major` opts into breaking) through
|
|
6
6
|
* npu when present. The whole verb is the shared devkit implementation.
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
9
|
-
const logger =
|
|
8
|
+
const build = require('../build.js');
|
|
9
|
+
const logger = build.logger('update');
|
|
10
10
|
const { runUpdate } = require('../vendor/devkit/update.js');
|
|
11
11
|
|
|
12
12
|
module.exports = async function (options) {
|
|
@@ -38,8 +38,8 @@ const { certificateExpiry, EXPIRY_WARN_DAYS } = require('../vendor/devkit/certs.
|
|
|
38
38
|
const { signingPathCandidates } = require('../vendor/devkit/signing-env.js');
|
|
39
39
|
const { requiredWhenHolds } = require('../vendor/config/env-rules.js');
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
const logger =
|
|
41
|
+
const build = require('../build.js');
|
|
42
|
+
const logger = build.logger('validate-certs');
|
|
43
43
|
|
|
44
44
|
module.exports = async function (options) {
|
|
45
45
|
options = options || {};
|
|
@@ -48,8 +48,8 @@ module.exports = async function (options) {
|
|
|
48
48
|
logger.log('Validating signing prerequisites...');
|
|
49
49
|
|
|
50
50
|
const platform = process.platform;
|
|
51
|
-
const config =
|
|
52
|
-
const winStrategy =
|
|
51
|
+
const config = build.getConfig();
|
|
52
|
+
const winStrategy = build.getWindowsSignStrategy();
|
|
53
53
|
|
|
54
54
|
const issues = [];
|
|
55
55
|
|
package/dist/commands/version.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Libraries
|
|
2
|
-
const
|
|
3
|
-
const logger =
|
|
2
|
+
const build = require('../build.js');
|
|
3
|
+
const logger = build.logger('version');
|
|
4
4
|
|
|
5
|
-
const package =
|
|
5
|
+
const package = build.getPackage('main');
|
|
6
6
|
|
|
7
7
|
module.exports = async function (options) {
|
|
8
8
|
logger.log(package.version);
|
|
@@ -239,6 +239,8 @@ jobs:
|
|
|
239
239
|
uses: actions/upload-artifact@v7
|
|
240
240
|
with:
|
|
241
241
|
name: windows-unsigned
|
|
242
|
+
# An intermediate windows-sign consumes in this same run; the releases repo is the durable home.
|
|
243
|
+
retention-days: 1
|
|
242
244
|
# Capture installer + auto-updater feed + blockmap so windows-sign can re-upload them all.
|
|
243
245
|
path: |
|
|
244
246
|
release/*.exe
|
package/dist/defaults/AGENTS.md
CHANGED
|
@@ -19,8 +19,9 @@ This project consumes **OMEGA Desktop** (@omega.js/desktop), a comprehensive fra
|
|
|
19
19
|
|
|
20
20
|
## 🚨 READ @omega.js/client TOO
|
|
21
21
|
|
|
22
|
-
**@omega.js/desktop
|
|
22
|
+
**@omega.js/desktop's renderer instance extends `@omega.js/client`'s base class.**
|
|
23
23
|
- It powers auth, Firebase, reactive `data-omega-bind` directives, analytics, error tracking, and utilities (`escapeHTML`, etc.).
|
|
24
|
+
- `omega.auth.user` is always a `User`: `authenticated`, `plan`, `active`, `profile.displayName`; `omega.auth.listen()` delivers `{ user, denied }`.
|
|
24
25
|
- Any task that touches auth flows, Firestore reads/writes, subscription resolution, push notifications, or DOM bindings means you are working with @omega.js/client as much as with @omega.js/desktop.
|
|
25
26
|
|
|
26
27
|
**Required reading:**
|
|
@@ -71,28 +72,36 @@ npx omega install live # restore the published @omega.js/desktop from npm
|
|
|
71
72
|
|
|
72
73
|
## Per-context imports
|
|
73
74
|
|
|
75
|
+
Each entry exports ONE ready-made instance, `omega`; a consumer never writes `new`.
|
|
76
|
+
|
|
74
77
|
```js
|
|
75
78
|
// src/main.js
|
|
76
|
-
|
|
79
|
+
const omega = require('@omega.js/desktop/main');
|
|
80
|
+
omega.initialize().then(() => { const { logger, windows } = omega; }); // auto-loads JSON5 config
|
|
77
81
|
|
|
78
82
|
// src/preload.js
|
|
79
|
-
|
|
83
|
+
const omega = require('@omega.js/desktop/preload');
|
|
84
|
+
omega.initialize();
|
|
80
85
|
|
|
81
86
|
// src/assets/js/components/main/index.js
|
|
82
|
-
|
|
87
|
+
import omega from '@omega.js/desktop/renderer';
|
|
88
|
+
omega.initialize().then(() => { const { logger, desktop } = omega; });
|
|
83
89
|
```
|
|
84
90
|
|
|
85
91
|
## Available APIs at runtime
|
|
86
92
|
|
|
87
|
-
In main
|
|
93
|
+
In main, each a property of `omega`: `windows`, `tray`, `menu`, `contextMenu`, `ipc`, `storage`, `deepLink`, `autoUpdater`, `appState`, `startup`, `protocol`, `authFlow`, `theme`, `fontawesome`, `context`, `usage`, `remoteConfig`, `remoteScripts`, `restartManager`, `analytics`, `sentry`, `logger`.
|
|
94
|
+
- `omega.auth` is the signed-in account in main: `.user` (a `User`), `.listen()`, `.signOut()`, `.getIdToken()`, `.handleToken()`.
|
|
88
95
|
|
|
89
|
-
In renderer: `
|
|
96
|
+
In renderer: the @omega.js/client base (`omega.auth`, `omega.firestore`, `omega.bindings`, and `omega.storage`, the page store) plus `omega.desktop`, the preload's bridge to main.
|
|
97
|
+
- `omega.desktop.{ipc,storage,theme,fontawesome,autoUpdater,analytics,context,usage,remoteConfig}`; `omega.desktop.storage` is the app store, async over IPC.
|
|
98
|
+
- Config: `window.OMEGA_BUILD_JSON.config` (the one `build.js` the view's shell loads).
|
|
90
99
|
|
|
91
100
|
## Dependency resolution
|
|
92
101
|
|
|
93
102
|
- **Do NOT install framework dependencies directly** (`firebase`, `fs-jetpack`, `@omega.js/client`, etc.). @omega.js/desktop's bundler resolves them through the framework's own `node_modules/`. If something doesn't resolve, the issue is in @omega.js/desktop's bundle task, not your `package.json`.
|
|
94
|
-
- **@omega.js/client owns Firebase.** Never `require('firebase')` or `import('firebase/app')`.
|
|
95
|
-
- **`
|
|
103
|
+
- **@omega.js/client owns Firebase.** Never `require('firebase')` or `import('firebase/app')`. In renderers use `omega.auth` and `omega.firestore` on the renderer instance. In the main process, use `omega.auth` (the @omega.js/desktop bridge).
|
|
104
|
+
- **`omega.require(name)`** resolves from @omega.js/desktop's module context at runtime for unbundled code (gulp tasks, test fixtures).
|
|
96
105
|
|
|
97
106
|
## Testing
|
|
98
107
|
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
// App/cloud platform role (provider-discriminated). `config` is the Firebase web
|
|
72
72
|
// SDK config — copy directly from Firebase Console → Project Settings → SDK setup
|
|
73
73
|
// (Config option). Same shape every OMEGA target reads.
|
|
74
|
-
// Empty config {} disables Firebase Auth in the renderer (
|
|
74
|
+
// Empty config {} disables Firebase Auth in the renderer (the auth lib logs a warn).
|
|
75
75
|
cloud: {
|
|
76
76
|
provider: 'firebase',
|
|
77
77
|
config: {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
|
|
89
89
|
// Appearance — the app's DEFAULT theme. 'system' follows the OS preference live;
|
|
90
|
-
// 'light'/'dark' are explicit overrides. A user's runtime choice (
|
|
90
|
+
// 'light'/'dark' are explicit overrides. A user's runtime choice (omega.theme.set
|
|
91
91
|
// or the [data-omega-theme-set] controls) persists in storage and wins over this on
|
|
92
92
|
// every boot. See docs/themes.md.
|
|
93
93
|
theme: {
|
|
@@ -234,8 +234,8 @@
|
|
|
234
234
|
// src/integrations/tray/index.js
|
|
235
235
|
// src/integrations/menu/index.js
|
|
236
236
|
// src/integrations/context-menu/index.js
|
|
237
|
-
// To disable at runtime: call `
|
|
238
|
-
// `
|
|
237
|
+
// To disable at runtime: call `omega.tray.disable()` / `omega.menu.disable()` /
|
|
238
|
+
// `omega.contextMenu.disable()` from your main entry. Idempotent.
|
|
239
239
|
|
|
240
240
|
// Startup behavior — two independent knobs.
|
|
241
241
|
//
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
},
|
|
264
264
|
},
|
|
265
265
|
// No `windows` block needed — @omega.js/desktop no longer auto-creates windows. Your main.js
|
|
266
|
-
// calls `
|
|
266
|
+
// calls `omega.windows.create('main', { width: 1280, height: 800, ... })` when
|
|
267
267
|
// you want UI to surface. Defaults baked in:
|
|
268
268
|
// main → { width: 1024, height: 720, hideOnClose: true, view: 'main' }
|
|
269
269
|
// any other → { width: 800, height: 600, hideOnClose: false, view: name }
|
|
@@ -282,9 +282,9 @@
|
|
|
282
282
|
},
|
|
283
283
|
// Deep links: scheme is automatically `<brand.id>://...`. Built-in routes:
|
|
284
284
|
// auth/token → @omega.js/client auth token handoff
|
|
285
|
-
// app/show →
|
|
285
|
+
// app/show → omega.windows.show(query.window || 'main')
|
|
286
286
|
// app/quit → app.quit()
|
|
287
|
-
// Add custom routes at runtime:
|
|
287
|
+
// Add custom routes at runtime: omega.deepLink.on('my-route', (ctx) => {...}) in main.
|
|
288
288
|
|
|
289
289
|
// "Hot config" — JSON document fetched from the brand site so app behavior
|
|
290
290
|
// can be flipped without shipping a new build (e.g. force-update gate, ads
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
// changelog page on your marketing site, sending notification emails.
|
|
6
6
|
|
|
7
7
|
module.exports = async (ctx) => {
|
|
8
|
-
// ctx = {
|
|
8
|
+
// ctx = { build, projectRoot, artifacts } // artifacts: array of release/ paths
|
|
9
9
|
};
|