@makefully/adaptfully 3.12.1 → 3.14.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/CHANGELOG.md +13 -0
- package/README.md +27 -3
- package/lib/node/index.js +6 -0
- package/lib/node/packagers/base.js +5 -2
- package/lib/node/packagers/electron.js +5 -2
- package/lib/node/platform-config.js +81 -0
- package/lib/runtime/auth/_helpers.js +2 -0
- package/lib/runtime/auth/dev-auth.js +8 -0
- package/lib/runtime/auth/google-auth.js +8 -0
- package/lib/runtime/auth/social-auth.js +8 -0
- package/lib/runtime/auth/steam-auth.js +8 -0
- package/lib/runtime/platform.js +21 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 3.14.0 — 2026-08-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`platform.supportsLogout()`** — whether `logout()` yields a durable signed-out state. Google, social, and dev return `true`; Steam returns `false` (Steamworks identity returns on `autoLogin`). Defaults to `false` when the auth plugin omits the method. Games should hide Sign out UI when this is false.
|
|
10
|
+
- **`platform.requiresEmail()`** — whether a complete identity needs email in addition to id. Google, social, and dev return `true`; Steam returns `false`. Defaults to `true` when unimplemented. Use instead of branching on `auth.name === 'steam'` for session completeness and account-sync routing.
|
|
11
|
+
|
|
12
|
+
## 3.13.0 — 2026-07-24
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Per-platform `config.*` overrides** — `config.platforms.<key>.packageName` (and other identity/branding fields) override top-level `config.*` defaults for that platform. Control fields (`packager`, `registrations`, `builder`, `deployments`, `steamId`, `socialLogin`, `steamworks`) are unchanged. Helpers: `resolvePlatformConfig`, `getConfigValue`, `resolveConfigForBuild`.
|
|
17
|
+
|
|
5
18
|
## 3.12.1 — 2026-07-23
|
|
6
19
|
|
|
7
20
|
### Fixed
|
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ When `steam-auth` is registered on an **`electron`** platform, Adaptfully prebui
|
|
|
185
185
|
- **`main.js`** — Electron shell with Steam overlay enabled and a preload script wired in
|
|
186
186
|
- **`preload.js`** — initializes [steamworks.js](https://github.com/ceifa/steamworks.js) with `platforms.<name>.steamId` and exposes `window.__ADAPTFULLY_STEAMWORKS__`
|
|
187
187
|
|
|
188
|
-
The renderer `steam-auth` plugin reads the Steam ID from that bridge. When Steam is available, `autoLogin()` succeeds immediately with `{ id: steamId64, email: '' }`. Optional config keys:
|
|
188
|
+
The renderer `steam-auth` plugin reads the Steam ID from that bridge. When Steam is available, `autoLogin()` succeeds immediately with `{ id: steamId64, email: '' }`. `supportsLogout()` is `false` and `requiresEmail()` is `false` — games should not offer Sign out, and should treat id-only identity as complete. Optional config keys:
|
|
189
189
|
|
|
190
190
|
| Key | Default | Purpose |
|
|
191
191
|
|-----|---------|---------|
|
|
@@ -229,6 +229,9 @@ import {
|
|
|
229
229
|
- **`runAdaptfullyStage('prebuild' | 'build' | 'deploy', platformKey, options)`** — run a pipeline stage programmatically.
|
|
230
230
|
- **`platform.autoLogin(callback)`** — restore a prior session without UI when the auth plugin supports it (Google uses `lastLoggedIn` in storage and a cached OAuth token).
|
|
231
231
|
- **`platform.supportsAutoLogin()`** — whether the active auth plugin can attempt automatic sign-in.
|
|
232
|
+
- **`platform.logout(callback)`** — clear / revoke the platform session when supported.
|
|
233
|
+
- **`platform.supportsLogout()`** — whether logout is a durable user-facing action. Steam returns `false` (identity is bound to the Steam client); Google, social, and dev return `true`. Prefer this over checking `auth.name` when showing Sign out UI.
|
|
234
|
+
- **`platform.requiresEmail()`** — whether `getUser()` must include email for a complete session. Steam returns `false` (SteamID64 alone); Google, social, and dev return `true`. Prefer this over checking `auth.name` for session sync and account-link routing.
|
|
232
235
|
|
|
233
236
|
---
|
|
234
237
|
|
|
@@ -437,13 +440,13 @@ Standard npm fields (`name`, `version`, `description`) are used directly. Add a
|
|
|
437
440
|
| Field | Used by | Description |
|
|
438
441
|
|-------|---------|-------------|
|
|
439
442
|
| `title` | All | Display name shown in stores and app shells |
|
|
440
|
-
| `packageName` | Cordova, Electron, UWP | Reverse-DNS identifier (`com.company.game`) |
|
|
443
|
+
| `packageName` | Cordova, Capacitor, Electron, UWP, Play upload | Reverse-DNS identifier (`com.company.game`) |
|
|
441
444
|
| `publisherDisplayName` | Cordova, Electron, web | Short publisher name |
|
|
442
445
|
| `publisherFullName` | Electron | Legal entity name for copyright |
|
|
443
446
|
| `publisherWebsite` | Cordova, web | Company URL |
|
|
444
447
|
| `publisherEmailAddress` | Cordova | Contact email |
|
|
445
448
|
| `scope` | Web/PWA | Base URL scope for the web app |
|
|
446
|
-
| `themeColor` | Cordova, Electron, UWP, web | Loading screen / theme color |
|
|
449
|
+
| `themeColor` | Cordova, Capacitor, Electron, UWP, web | Loading screen / theme color |
|
|
447
450
|
| `twitterId` | Web | Twitter handle for meta tags |
|
|
448
451
|
| `deployFolder` | Client | Neutral deploy directory staged before prebuild (default: `deploy`) |
|
|
449
452
|
| `htmlInjections` | Prebuild | Deploy-relative HTML paths to inject (default: `["index.html"]`) |
|
|
@@ -454,8 +457,29 @@ Standard npm fields (`name`, `version`, `description`) are used directly. Add a
|
|
|
454
457
|
| `platforms.<name>.packager` | Prebuild | `web` (default), `electron`, `cordova`, or `capacitor` — selects the packager class that adds platform-specific files during prebuild |
|
|
455
458
|
| `platforms.<name>.steamId` | Electron + steam-auth | Steamworks app ID baked into `preload.js` (client). Upload app IDs belong in the Steam deployment `manifest.json` |
|
|
456
459
|
| `platforms.<name>.socialLogin` | Capacitor + social-auth | Capgo provider config (`providers`, `google.webClientId`, `apple.clientId`, optional `defaultProvider`) |
|
|
460
|
+
| `platforms.<name>.<configField>` | Build/deploy | Overrides the matching top-level `config.*` default for that platform only (e.g. `platforms.android.packageName`, `platforms.ios.title`). Does not apply to control fields: `packager`, `registrations`, `builder`, `builders`, `deployments`, `steamId`, `socialLogin`, `steamworks` |
|
|
457
461
|
| `properties` | Cordova | Cordova config.xml entries (plugins, allow-navigation, etc.) |
|
|
458
462
|
|
|
463
|
+
Top-level `config.*` values are **defaults**. Any non-control field on `config.platforms.<name>` overrides the default when that platform is built or deployed. Example:
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
"config": {
|
|
467
|
+
"packageName": "com.example.game",
|
|
468
|
+
"title": "My Game",
|
|
469
|
+
"platforms": {
|
|
470
|
+
"android": {
|
|
471
|
+
"packager": "capacitor",
|
|
472
|
+
"packageName": "com.example.game.android"
|
|
473
|
+
},
|
|
474
|
+
"android-dev": {
|
|
475
|
+
"packager": "capacitor",
|
|
476
|
+
"packageName": "com.example.game.dev"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
|
|
459
483
|
### `wrapfully.json`
|
|
460
484
|
|
|
461
485
|
Optional. Fields are shallow-merged into `package.json`'s `config`:
|
package/lib/node/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export { buildOutputDir, clearStaleBuildExtract, resolveBuildArtifactDir } from './artifacts.js';
|
|
2
2
|
export { createArchive, createDeployArchive, createReleaseArchive, createSourceArchive } from './archive.js';
|
|
3
3
|
export { loadProjectConfig, resolveServerUrl } from './config.js';
|
|
4
|
+
export {
|
|
5
|
+
getConfigValue,
|
|
6
|
+
PLATFORM_CONTROL_KEYS,
|
|
7
|
+
resolveConfigForBuild,
|
|
8
|
+
resolvePlatformConfig,
|
|
9
|
+
} from './platform-config.js';
|
|
4
10
|
export { send } from './deploy.js';
|
|
5
11
|
export {
|
|
6
12
|
appendMetaIcons,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { STANDARD_PLUGINS } from '../registrations.js';
|
|
4
|
+
import { resolvePlatformConfig } from '../platform-config.js';
|
|
4
5
|
|
|
5
6
|
/** @typedef {import('../registrations.js').RegistrationMap} RegistrationMap */
|
|
6
7
|
/** @typedef {'web' | 'electron' | 'cordova' | 'capacitor'} PackagerName */
|
|
@@ -38,15 +39,17 @@ function gameConfigPlatform(platformKey) {
|
|
|
38
39
|
/**
|
|
39
40
|
* @param {string} dest
|
|
40
41
|
* @param {string} platformKey
|
|
41
|
-
* @param {{ name: string, version: string, config?:
|
|
42
|
+
* @param {{ name: string, version: string, config?: object }} pkg
|
|
42
43
|
* @param {(message: string) => void} log
|
|
43
44
|
*/
|
|
44
45
|
function writeGameConfig(dest, platformKey, pkg, log) {
|
|
46
|
+
const config = resolvePlatformConfig(pkg, platformKey);
|
|
45
47
|
const content = `window.gameConfig = ${JSON.stringify({
|
|
46
|
-
title:
|
|
48
|
+
title: config.title,
|
|
47
49
|
version: pkg.version,
|
|
48
50
|
id: pkg.name,
|
|
49
51
|
platform: gameConfigPlatform(platformKey),
|
|
52
|
+
packageName: config.packageName,
|
|
50
53
|
}, null, 4)};`;
|
|
51
54
|
|
|
52
55
|
fs.writeFileSync(path.join(dest, 'game-config.js'), content);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { Packager } from './base.js';
|
|
4
|
+
import { resolvePlatformConfig } from '../platform-config.js';
|
|
4
5
|
|
|
5
6
|
const STEAM_INIT = `const path = require('path');
|
|
6
7
|
|
|
@@ -221,8 +222,10 @@ export class ElectronPackager extends Packager {
|
|
|
221
222
|
|
|
222
223
|
/** @param {string} dest */
|
|
223
224
|
writeElectronMain(dest) {
|
|
224
|
-
const
|
|
225
|
-
|
|
225
|
+
const
|
|
226
|
+
withSteam = this.usesPlugin('steam-auth'),
|
|
227
|
+
config = resolvePlatformConfig(this.pkg, this.platformKey),
|
|
228
|
+
mainContent = buildElectronMain(withSteam, config.themeColor);
|
|
226
229
|
|
|
227
230
|
if (withSteam) {
|
|
228
231
|
const steamId = resolvePlatformSteamId(this.platformKey, this.pkg);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keys that configure platform behavior (not inherited identity/defaults).
|
|
3
|
+
* These stay on `platforms.<key>` and are not treated as config.* overrides.
|
|
4
|
+
*/
|
|
5
|
+
export const PLATFORM_CONTROL_KEYS = new Set([
|
|
6
|
+
'registrations',
|
|
7
|
+
'builder',
|
|
8
|
+
'builders',
|
|
9
|
+
'packager',
|
|
10
|
+
'deployments',
|
|
11
|
+
'steamId',
|
|
12
|
+
'socialLogin',
|
|
13
|
+
'steamworks',
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve effective `config` for a platform: top-level `config.*` are defaults;
|
|
18
|
+
* any non-control field on `config.platforms.<platformKey>` overrides them.
|
|
19
|
+
*
|
|
20
|
+
* @param {{ config?: Record<string, unknown> }} pkg
|
|
21
|
+
* @param {string | null | undefined} platformKey
|
|
22
|
+
* @returns {Record<string, unknown>}
|
|
23
|
+
*/
|
|
24
|
+
export function resolvePlatformConfig(pkg, platformKey) {
|
|
25
|
+
const root = pkg?.config && typeof pkg.config === 'object' ? pkg.config : {};
|
|
26
|
+
/** @type {Record<string, unknown>} */
|
|
27
|
+
const resolved = { ...root };
|
|
28
|
+
delete resolved.platforms;
|
|
29
|
+
|
|
30
|
+
if (!platformKey || typeof platformKey !== 'string') {
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const platform = root.platforms?.[platformKey];
|
|
35
|
+
if (!platform || typeof platform !== 'object' || Array.isArray(platform)) {
|
|
36
|
+
return resolved;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (const [key, value] of Object.entries(platform)) {
|
|
40
|
+
if (PLATFORM_CONTROL_KEYS.has(key) || value === undefined) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
resolved[key] = value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return resolved;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {{ config?: Record<string, unknown> }} pkg
|
|
51
|
+
* @param {string | null | undefined} platformKey
|
|
52
|
+
* @param {string} key
|
|
53
|
+
* @param {unknown} [fallback]
|
|
54
|
+
*/
|
|
55
|
+
export function getConfigValue(pkg, platformKey, key, fallback) {
|
|
56
|
+
const resolved = resolvePlatformConfig(pkg, platformKey);
|
|
57
|
+
return resolved[key] !== undefined ? resolved[key] : fallback;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Prefer a platform whose key matches the deployment key (e.g. deploy "android"
|
|
62
|
+
* → platforms.android), else the build's platformKey.
|
|
63
|
+
*
|
|
64
|
+
* @param {{ config?: Record<string, unknown> }} pkg
|
|
65
|
+
* @param {{ platformKey?: string | null, deploymentKey?: string | null }} [context]
|
|
66
|
+
*/
|
|
67
|
+
export function resolveConfigForBuild(pkg, context = {}) {
|
|
68
|
+
const { platformKey = null, deploymentKey = null } = context;
|
|
69
|
+
const platforms = pkg?.config?.platforms;
|
|
70
|
+
|
|
71
|
+
if (
|
|
72
|
+
deploymentKey
|
|
73
|
+
&& platforms
|
|
74
|
+
&& typeof platforms === 'object'
|
|
75
|
+
&& platforms[deploymentKey]
|
|
76
|
+
) {
|
|
77
|
+
return resolvePlatformConfig(pkg, deploymentKey);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return resolvePlatformConfig(pkg, platformKey);
|
|
81
|
+
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* @property {(callback: AuthCallback) => void} login
|
|
12
12
|
* @property {(callback: AuthCallback) => void} autoLogin
|
|
13
13
|
* @property {() => boolean} [supportsAutoLogin]
|
|
14
|
+
* @property {() => boolean} [supportsLogout] — durable signed-out state (false for Steamworks-bound identity)
|
|
15
|
+
* @property {() => boolean} [requiresEmail] — whether getUser() must include email for a complete session
|
|
14
16
|
* @property {(callback: () => void) => void} logout
|
|
15
17
|
* @property {() => AuthUser | null} getUser
|
|
16
18
|
* @property {() => boolean} isAuthenticated
|
package/lib/runtime/platform.js
CHANGED
|
@@ -78,6 +78,27 @@
|
|
|
78
78
|
: typeof this.auth.autoLogin === 'function';
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Whether logout() yields a durable signed-out state for this auth backend.
|
|
83
|
+
* Games should hide Sign out UI when this is false (e.g. Steam).
|
|
84
|
+
* Defaults to false when the plugin does not implement the method.
|
|
85
|
+
*/
|
|
86
|
+
supportsLogout() {
|
|
87
|
+
return typeof this.auth.supportsLogout === 'function'
|
|
88
|
+
? this.auth.supportsLogout()
|
|
89
|
+
: false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether a complete identity requires email in addition to id.
|
|
94
|
+
* Id-only backends (Steam) return false. Defaults to true when unimplemented.
|
|
95
|
+
*/
|
|
96
|
+
requiresEmail() {
|
|
97
|
+
return typeof this.auth.requiresEmail === 'function'
|
|
98
|
+
? this.auth.requiresEmail()
|
|
99
|
+
: true;
|
|
100
|
+
}
|
|
101
|
+
|
|
81
102
|
logout(callback) {
|
|
82
103
|
this.whenReady(() => {
|
|
83
104
|
this.auth.logout(() => {
|