@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// The policy itself — config gating, the dev/kill switches, user normalization,
|
|
4
4
|
// release tagging — is @omega.js/monitoring's, proven by its own suite
|
|
5
5
|
// (packages/monitoring/test/). What belongs here is the desktop half: the
|
|
6
|
-
// package entry resolves in a main-process context, the
|
|
6
|
+
// package entry resolves in a main-process context, the omega instance's `sentry`
|
|
7
7
|
// surface is the one every lib calls, and a brand with no DSN gets a silent
|
|
8
8
|
// no-op instead of a crash.
|
|
9
9
|
|
|
@@ -47,7 +47,7 @@ module.exports = defineCases({
|
|
|
47
47
|
try {
|
|
48
48
|
main.captureException(new Error('test'));
|
|
49
49
|
main.captureMessage('test');
|
|
50
|
-
//
|
|
50
|
+
// lib/auth.js calls this on every auth change, a documented no-op when off.
|
|
51
51
|
main.setUser({ uid: 'abc', email: 'user@example.com' });
|
|
52
52
|
} catch (e) {
|
|
53
53
|
threw = e;
|
|
@@ -27,7 +27,7 @@ const defineCases = require('../../../vendor/devkit/test/define-cases.js');
|
|
|
27
27
|
const signerPath = path.join(__dirname, '..', '..', '..', 'commands', 'sign-windows.js');
|
|
28
28
|
const eventsPath = path.join(__dirname, '..', '..', '..', 'lib', 'sign-helpers', 'sign-events.js');
|
|
29
29
|
const signWindows = require(signerPath);
|
|
30
|
-
const
|
|
30
|
+
const build = require(path.join(__dirname, '..', '..', '..', 'build.js'));
|
|
31
31
|
|
|
32
32
|
const NOT_WINDOWS = 'Windows-only: signtool + the EV token live on the signing box';
|
|
33
33
|
const NO_SIGNTOOL = 'signtool is not reachable — install the Windows SDK / VS Build Tools, or set SIGNTOOL_PATH';
|
|
@@ -76,7 +76,7 @@ function currentGate() {
|
|
|
76
76
|
// The strategy comes from the project's own config — the same call the signer
|
|
77
77
|
// makes — and is only worth resolving where the rest of the gate has passed.
|
|
78
78
|
if (process.platform !== 'win32') return gateReason(process.platform, process.env, false, null);
|
|
79
|
-
return gateReason(process.platform, process.env, signtoolOnPath(process.env),
|
|
79
|
+
return gateReason(process.platform, process.env, signtoolOnPath(process.env), build.getWindowsSignStrategy());
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// The signer, loaded with its event log pointed inside this suite's scratch
|
|
@@ -52,11 +52,11 @@ module.exports = defineCases({
|
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
name: 'buildPageVars produces brand/app/page/theme/cacheBust from
|
|
55
|
+
name: 'buildPageVars produces brand/app/page/theme/cacheBust from an omega-like object',
|
|
56
56
|
run: (ctx) => {
|
|
57
57
|
const t = require(path.join(__dirname, '..', '..', '..', 'lib', 'templating.js'));
|
|
58
|
-
const
|
|
59
|
-
const vars = t.buildPageVars('settings', { cacheBust: '12345' },
|
|
58
|
+
const fakeOmega = { config: { brand: { name: 'MyApp', id: 'myapp' }, app: { productName: 'MyApp' } } };
|
|
59
|
+
const vars = t.buildPageVars('settings', { cacheBust: '12345' }, fakeOmega);
|
|
60
60
|
ctx.expect(vars.page.name).toBe('settings');
|
|
61
61
|
ctx.expect(vars.page.title).toBe('MyApp');
|
|
62
62
|
ctx.expect(vars.brand.id).toBe('myapp');
|
|
@@ -68,19 +68,17 @@ module.exports = defineCases({
|
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
|
-
name: 'a provided
|
|
71
|
+
name: 'a provided instance answers from the config IT was baked with',
|
|
72
72
|
run: (ctx) => {
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
// the baked `config.environment` when the process has none.
|
|
76
|
-
const
|
|
73
|
+
// An instance carrying the shared isTesting() answers like the runtime
|
|
74
|
+
// `omega` instances: since #817 they all read the ONE input, the process
|
|
75
|
+
// variable, or the baked `config.environment` when the process has none.
|
|
76
|
+
const { isTesting } = require('../../../utils/mode-helpers.js');
|
|
77
77
|
withEnv({ OMEGA_ENVIRONMENT: undefined, OMEGA_TEST_SHOW: undefined }, () => {
|
|
78
|
-
const testing =
|
|
79
|
-
testing.config = { environment: 'testing' };
|
|
78
|
+
const testing = { isTesting, config: { environment: 'testing' } };
|
|
80
79
|
ctx.expect(isTestStealth(testing)).toBe(true);
|
|
81
80
|
|
|
82
|
-
const production =
|
|
83
|
-
production.config = { environment: 'production' };
|
|
81
|
+
const production = { isTesting, config: { environment: 'production' } };
|
|
84
82
|
ctx.expect(isTestStealth(production)).toBe(false);
|
|
85
83
|
});
|
|
86
84
|
},
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
// published, then composes OMEGA_WEBSITE_PORT / the baked port over https, then
|
|
12
12
|
// the classic dev origin ([#747](https://github.com/Omega-JS-Stack/omega/issues/747)).
|
|
13
13
|
//
|
|
14
|
-
// The last case pins the auth emulator port
|
|
14
|
+
// The last case pins the auth emulator port lib/auth.js connects a testing
|
|
15
15
|
// run to: the same three-step chain, off the same baked map.
|
|
16
16
|
|
|
17
17
|
const path = require('path');
|
|
18
18
|
|
|
19
19
|
const helpers = require(path.join(__dirname, '..', '..', '..', 'utils', 'url-helpers.js'));
|
|
20
|
-
const
|
|
20
|
+
const auth = require(path.join(__dirname, '..', '..', '..', 'lib', 'auth.js'));
|
|
21
21
|
const defineCases = require('../../../vendor/devkit/test/define-cases.js');
|
|
22
22
|
|
|
23
23
|
function withEnv(overrides, fn) {
|
|
@@ -35,9 +35,9 @@ function withEnv(overrides, fn) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
// The shape the helpers see at runtime:
|
|
38
|
+
// The shape the helpers see at runtime: an omega instance carrying the resolved config
|
|
39
39
|
// (OMEGA_BUILD_JSON.config, `dev` block and all) plus mode-helpers' getEnvironment().
|
|
40
|
-
function
|
|
40
|
+
function fakeOmega(environment, ports, origin) {
|
|
41
41
|
return {
|
|
42
42
|
getEnvironment: () => environment,
|
|
43
43
|
isTesting: () => environment === 'testing',
|
|
@@ -51,11 +51,11 @@ function fakeManager(environment, ports, origin) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// Run `fn` with
|
|
55
|
-
function
|
|
56
|
-
const original =
|
|
57
|
-
|
|
58
|
-
try { return fn(); } finally {
|
|
54
|
+
// Run `fn` with auth pointed at a stand-in instance, then put the real one back.
|
|
55
|
+
function withAuthOmega(omega, fn) {
|
|
56
|
+
const original = auth._omega;
|
|
57
|
+
auth._omega = omega;
|
|
58
|
+
try { return fn(); } finally { auth._omega = original; }
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// No env channel published: the state a packaged main process is in.
|
|
@@ -72,9 +72,11 @@ module.exports = defineCases({
|
|
|
72
72
|
description: 'utils/url-helpers: every local helper resolves env, then the baked dev.ports, then throws',
|
|
73
73
|
tests: [
|
|
74
74
|
{
|
|
75
|
-
|
|
75
|
+
// Plain functions the `Omega` classes call with themselves as `context`:
|
|
76
|
+
// no mixin onto a constructor any more
|
|
77
|
+
name: 'exports { getApiUrl, localPort, requiredPort } and no attachTo',
|
|
76
78
|
run: (ctx) => {
|
|
77
|
-
ctx.expect(
|
|
79
|
+
ctx.expect(helpers.attachTo).toBeUndefined();
|
|
78
80
|
ctx.expect(typeof helpers.getApiUrl).toBe('function');
|
|
79
81
|
ctx.expect(typeof helpers.localPort).toBe('function');
|
|
80
82
|
ctx.expect(typeof helpers.requiredPort).toBe('function');
|
|
@@ -84,8 +86,8 @@ module.exports = defineCases({
|
|
|
84
86
|
name: 'a BUMPED baked dev.ports.hosting is the api base in testing',
|
|
85
87
|
run: (ctx) => {
|
|
86
88
|
withEnv(NO_ENV, () => {
|
|
87
|
-
const
|
|
88
|
-
ctx.expect(helpers.getApiUrl
|
|
89
|
+
const omega = fakeOmega('testing', { hosting: 5012, auth: 9109 });
|
|
90
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5012');
|
|
89
91
|
});
|
|
90
92
|
},
|
|
91
93
|
},
|
|
@@ -93,8 +95,8 @@ module.exports = defineCases({
|
|
|
93
95
|
name: 'a BUMPED baked dev.ports.hosting is the api base in development too',
|
|
94
96
|
run: (ctx) => {
|
|
95
97
|
withEnv(NO_ENV, () => {
|
|
96
|
-
const
|
|
97
|
-
ctx.expect(helpers.getApiUrl
|
|
98
|
+
const omega = fakeOmega('development', { hosting: 5012 });
|
|
99
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5012');
|
|
98
100
|
});
|
|
99
101
|
},
|
|
100
102
|
},
|
|
@@ -102,8 +104,8 @@ module.exports = defineCases({
|
|
|
102
104
|
name: 'OMEGA_HOSTING_PORT wins over the baked value',
|
|
103
105
|
run: (ctx) => {
|
|
104
106
|
withEnv({ ...NO_ENV, OMEGA_HOSTING_PORT: '5022' }, () => {
|
|
105
|
-
const
|
|
106
|
-
ctx.expect(helpers.getApiUrl
|
|
107
|
+
const omega = fakeOmega('testing', { hosting: 5012 });
|
|
108
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('http://localhost:5022');
|
|
107
109
|
});
|
|
108
110
|
},
|
|
109
111
|
},
|
|
@@ -116,9 +118,9 @@ module.exports = defineCases({
|
|
|
116
118
|
run: (ctx) => {
|
|
117
119
|
withEnv(NO_ENV, () => {
|
|
118
120
|
for (const environment of ['testing', 'development']) {
|
|
119
|
-
ctx.expect(() => helpers.getApiUrl
|
|
121
|
+
ctx.expect(() => helpers.getApiUrl(fakeOmega(environment)))
|
|
120
122
|
.toThrow(/dev port for `hosting`/);
|
|
121
|
-
ctx.expect(() => helpers.getApiUrl
|
|
123
|
+
ctx.expect(() => helpers.getApiUrl(fakeOmega(environment)))
|
|
122
124
|
.toThrow(/bundle task/);
|
|
123
125
|
}
|
|
124
126
|
});
|
|
@@ -128,8 +130,8 @@ module.exports = defineCases({
|
|
|
128
130
|
name: 'OMEGA_HTTPS_PORT means the mkcert proxy is up: https, not hosting',
|
|
129
131
|
run: (ctx) => {
|
|
130
132
|
withEnv({ ...NO_ENV, OMEGA_HTTPS_PORT: '5003' }, () => {
|
|
131
|
-
const
|
|
132
|
-
ctx.expect(helpers.getApiUrl
|
|
133
|
+
const omega = fakeOmega('testing', { hosting: 5012 });
|
|
134
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('https://localhost:5003');
|
|
133
135
|
});
|
|
134
136
|
},
|
|
135
137
|
},
|
|
@@ -137,8 +139,8 @@ module.exports = defineCases({
|
|
|
137
139
|
name: 'a baked dev.ports.https does the same with no env published',
|
|
138
140
|
run: (ctx) => {
|
|
139
141
|
withEnv(NO_ENV, () => {
|
|
140
|
-
const
|
|
141
|
-
ctx.expect(helpers.getApiUrl
|
|
142
|
+
const omega = fakeOmega('testing', { https: 5003, hosting: 5443 });
|
|
143
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('https://localhost:5003');
|
|
142
144
|
});
|
|
143
145
|
},
|
|
144
146
|
},
|
|
@@ -146,8 +148,8 @@ module.exports = defineCases({
|
|
|
146
148
|
name: 'production ignores every local channel, giving api.<brand host>',
|
|
147
149
|
run: (ctx) => {
|
|
148
150
|
withEnv({ ...NO_ENV, OMEGA_HOSTING_PORT: '5022' }, () => {
|
|
149
|
-
const
|
|
150
|
-
ctx.expect(helpers.getApiUrl
|
|
151
|
+
const omega = fakeOmega('production', { hosting: 5012 });
|
|
152
|
+
ctx.expect(helpers.getApiUrl(omega)).toBe('https://api.playground.omegajs.dev');
|
|
151
153
|
});
|
|
152
154
|
},
|
|
153
155
|
},
|
|
@@ -155,8 +157,8 @@ module.exports = defineCases({
|
|
|
155
157
|
name: 'getFunctionsUrl: a BUMPED baked dev.ports.functions is the functions base',
|
|
156
158
|
run: (ctx) => {
|
|
157
159
|
withEnv(NO_ENV, () => {
|
|
158
|
-
const
|
|
159
|
-
ctx.expect(helpers.getFunctionsUrl
|
|
160
|
+
const omega = fakeOmega('development', { functions: 5011 });
|
|
161
|
+
ctx.expect(helpers.getFunctionsUrl(omega))
|
|
160
162
|
.toBe('http://localhost:5011/demo-app/us-central1');
|
|
161
163
|
});
|
|
162
164
|
},
|
|
@@ -165,8 +167,8 @@ module.exports = defineCases({
|
|
|
165
167
|
name: 'getFunctionsUrl: OMEGA_FUNCTIONS_PORT wins over the baked value',
|
|
166
168
|
run: (ctx) => {
|
|
167
169
|
withEnv({ ...NO_ENV, OMEGA_FUNCTIONS_PORT: '5021' }, () => {
|
|
168
|
-
const
|
|
169
|
-
ctx.expect(helpers.getFunctionsUrl
|
|
170
|
+
const omega = fakeOmega('testing', { functions: 5011 });
|
|
171
|
+
ctx.expect(helpers.getFunctionsUrl(omega))
|
|
170
172
|
.toBe('http://localhost:5021/demo-app/us-central1');
|
|
171
173
|
});
|
|
172
174
|
},
|
|
@@ -175,7 +177,7 @@ module.exports = defineCases({
|
|
|
175
177
|
name: 'getFunctionsUrl: neither channel → a throw naming the port (#834)',
|
|
176
178
|
run: (ctx) => {
|
|
177
179
|
withEnv(NO_ENV, () => {
|
|
178
|
-
ctx.expect(() => helpers.getFunctionsUrl
|
|
180
|
+
ctx.expect(() => helpers.getFunctionsUrl(fakeOmega('development')))
|
|
179
181
|
.toThrow(/dev port for `functions`/);
|
|
180
182
|
});
|
|
181
183
|
},
|
|
@@ -184,8 +186,8 @@ module.exports = defineCases({
|
|
|
184
186
|
name: 'getFunctionsUrl: production ignores every local channel',
|
|
185
187
|
run: (ctx) => {
|
|
186
188
|
withEnv({ ...NO_ENV, OMEGA_FUNCTIONS_PORT: '5021' }, () => {
|
|
187
|
-
const
|
|
188
|
-
ctx.expect(helpers.getFunctionsUrl
|
|
189
|
+
const omega = fakeOmega('production', { functions: 5011 });
|
|
190
|
+
ctx.expect(helpers.getFunctionsUrl(omega))
|
|
189
191
|
.toBe('https://us-central1-demo-app.cloudfunctions.net');
|
|
190
192
|
});
|
|
191
193
|
},
|
|
@@ -194,8 +196,8 @@ module.exports = defineCases({
|
|
|
194
196
|
name: 'getWebsiteUrl: a BUMPED baked dev.ports.website is the website base',
|
|
195
197
|
run: (ctx) => {
|
|
196
198
|
withEnv(NO_ENV, () => {
|
|
197
|
-
const
|
|
198
|
-
ctx.expect(helpers.getWebsiteUrl
|
|
199
|
+
const omega = fakeOmega('development', { website: 4001 });
|
|
200
|
+
ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4001');
|
|
199
201
|
});
|
|
200
202
|
},
|
|
201
203
|
},
|
|
@@ -203,8 +205,8 @@ module.exports = defineCases({
|
|
|
203
205
|
name: 'getWebsiteUrl: OMEGA_WEBSITE_PORT wins over the baked value',
|
|
204
206
|
run: (ctx) => {
|
|
205
207
|
withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
|
|
206
|
-
const
|
|
207
|
-
ctx.expect(helpers.getWebsiteUrl
|
|
208
|
+
const omega = fakeOmega('testing', { website: 4001 });
|
|
209
|
+
ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4002');
|
|
208
210
|
});
|
|
209
211
|
},
|
|
210
212
|
},
|
|
@@ -212,7 +214,7 @@ module.exports = defineCases({
|
|
|
212
214
|
name: 'getWebsiteUrl: neither channel → a throw naming the port (#834)',
|
|
213
215
|
run: (ctx) => {
|
|
214
216
|
withEnv(NO_ENV, () => {
|
|
215
|
-
ctx.expect(() => helpers.getWebsiteUrl
|
|
217
|
+
ctx.expect(() => helpers.getWebsiteUrl(fakeOmega('development')))
|
|
216
218
|
.toThrow(/dev port for `website`/);
|
|
217
219
|
});
|
|
218
220
|
},
|
|
@@ -224,8 +226,8 @@ module.exports = defineCases({
|
|
|
224
226
|
name: 'getWebsiteUrl: a baked dev.origin wins over OMEGA_WEBSITE_PORT',
|
|
225
227
|
run: (ctx) => {
|
|
226
228
|
withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
|
|
227
|
-
const
|
|
228
|
-
ctx.expect(helpers.getWebsiteUrl
|
|
229
|
+
const omega = fakeOmega('development', { website: 4001 }, 'https://localhost:4123');
|
|
230
|
+
ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://localhost:4123');
|
|
229
231
|
});
|
|
230
232
|
},
|
|
231
233
|
},
|
|
@@ -233,7 +235,7 @@ module.exports = defineCases({
|
|
|
233
235
|
name: 'getWebsiteUrl: OMEGA_WEBSITE_PORT with no baked origin composes over https',
|
|
234
236
|
run: (ctx) => {
|
|
235
237
|
withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4321' }, () => {
|
|
236
|
-
ctx.expect(helpers.getWebsiteUrl
|
|
238
|
+
ctx.expect(helpers.getWebsiteUrl(fakeOmega('development'))).toBe('https://localhost:4321');
|
|
237
239
|
});
|
|
238
240
|
},
|
|
239
241
|
},
|
|
@@ -258,11 +260,8 @@ module.exports = defineCases({
|
|
|
258
260
|
name: 'getAuthUrl: dev builds /signin and /token on the https dev origin',
|
|
259
261
|
run: (ctx) => {
|
|
260
262
|
withEnv(NO_ENV, () => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const manager = fakeManager('development', { website: 4000 });
|
|
264
|
-
manager.getWebsiteUrl = helpers.getWebsiteUrl;
|
|
265
|
-
const url = new URL(helpers.getAuthUrl.call(manager));
|
|
263
|
+
const omega = fakeOmega('development', { website: 4000 });
|
|
264
|
+
const url = new URL(helpers.getAuthUrl(omega));
|
|
266
265
|
ctx.expect(url.origin).toBe('https://localhost:4000');
|
|
267
266
|
ctx.expect(url.pathname).toBe('/signin');
|
|
268
267
|
const tokenUrl = new URL(url.searchParams.get('authReturnUrl'));
|
|
@@ -276,31 +275,31 @@ module.exports = defineCases({
|
|
|
276
275
|
name: 'getWebsiteUrl: production ignores every local channel',
|
|
277
276
|
run: (ctx) => {
|
|
278
277
|
withEnv({ ...NO_ENV, OMEGA_WEBSITE_PORT: '4002' }, () => {
|
|
279
|
-
const
|
|
280
|
-
ctx.expect(helpers.getWebsiteUrl
|
|
278
|
+
const omega = fakeOmega('production', { website: 4001 });
|
|
279
|
+
ctx.expect(helpers.getWebsiteUrl(omega)).toBe('https://playground.omegajs.dev');
|
|
281
280
|
});
|
|
282
281
|
},
|
|
283
282
|
},
|
|
284
283
|
{
|
|
285
|
-
//
|
|
284
|
+
// lib/auth.js connects a TESTING run's auth to the emulator. Same chain:
|
|
286
285
|
// env, then the baked map, then classic 9099.
|
|
287
|
-
name: 'the auth emulator port rides the same chain (
|
|
286
|
+
name: 'the auth emulator port rides the same chain (lib/auth.js)',
|
|
288
287
|
run: (ctx) => {
|
|
289
288
|
withEnv({ OMEGA_AUTH_PORT: null }, () => {
|
|
290
|
-
|
|
291
|
-
ctx.expect(
|
|
289
|
+
withAuthOmega(fakeOmega('testing', { auth: 9109 }), () => {
|
|
290
|
+
ctx.expect(auth._authEmulatorPort()).toBe(9109);
|
|
292
291
|
});
|
|
293
292
|
// The classic 9099 used to answer here (#834): nothing identity-checks
|
|
294
293
|
// what holds that port, so a neighbouring project's emulator read as
|
|
295
294
|
// an auth mystery instead of a port problem.
|
|
296
|
-
|
|
297
|
-
ctx.expect(() =>
|
|
298
|
-
ctx.expect(() =>
|
|
295
|
+
withAuthOmega(fakeOmega('testing'), () => {
|
|
296
|
+
ctx.expect(() => auth._authEmulatorPort()).toThrow(/dev port for `auth`/);
|
|
297
|
+
ctx.expect(() => auth._authEmulatorPort()).toThrow(/bundle task/);
|
|
299
298
|
});
|
|
300
299
|
});
|
|
301
300
|
withEnv({ OMEGA_AUTH_PORT: '9119' }, () => {
|
|
302
|
-
|
|
303
|
-
ctx.expect(
|
|
301
|
+
withAuthOmega(fakeOmega('testing', { auth: 9109 }), () => {
|
|
302
|
+
ctx.expect(auth._authEmulatorPort()).toBe('9119');
|
|
304
303
|
});
|
|
305
304
|
});
|
|
306
305
|
},
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
const { validateConfig, runSchema, formatErrors, loadConfig } = require('../../../vendor/config/index.js');
|
|
8
8
|
|
|
9
9
|
const path = require('path');
|
|
10
|
-
const
|
|
10
|
+
const build = require('../../../build.js');
|
|
11
11
|
const defineCases = require('../../../vendor/devkit/test/define-cases.js');
|
|
12
|
-
const root =
|
|
12
|
+
const root = build.getRootPath('main');
|
|
13
13
|
|
|
14
14
|
// Minimal "good" config — passes every required check.
|
|
15
15
|
const VALID = {
|
|
@@ -25,10 +25,10 @@ module.exports = defineCases({
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
// wave-5 F1: main.js must release the deep-link boot queue after full init.
|
|
28
|
-
name: 'main.js drains the deep-link boot queue via
|
|
28
|
+
name: 'main.js drains the deep-link boot queue via markOmegaReady()',
|
|
29
29
|
run: (ctx) => {
|
|
30
30
|
const source = fs.readFileSync(path.join(SRC, 'main.js'), 'utf8');
|
|
31
|
-
ctx.expect(source.includes('deepLink.
|
|
31
|
+
ctx.expect(source.includes('deepLink.markOmegaReady()')).toBe(true);
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
],
|