@makefully/adaptfully 3.12.1 → 3.13.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 +6 -0
- package/README.md +23 -2
- 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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 3.13.0 — 2026-07-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **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`.
|
|
10
|
+
|
|
5
11
|
## 3.12.1 — 2026-07-23
|
|
6
12
|
|
|
7
13
|
### Fixed
|
package/README.md
CHANGED
|
@@ -437,13 +437,13 @@ Standard npm fields (`name`, `version`, `description`) are used directly. Add a
|
|
|
437
437
|
| Field | Used by | Description |
|
|
438
438
|
|-------|---------|-------------|
|
|
439
439
|
| `title` | All | Display name shown in stores and app shells |
|
|
440
|
-
| `packageName` | Cordova, Electron, UWP | Reverse-DNS identifier (`com.company.game`) |
|
|
440
|
+
| `packageName` | Cordova, Capacitor, Electron, UWP, Play upload | Reverse-DNS identifier (`com.company.game`) |
|
|
441
441
|
| `publisherDisplayName` | Cordova, Electron, web | Short publisher name |
|
|
442
442
|
| `publisherFullName` | Electron | Legal entity name for copyright |
|
|
443
443
|
| `publisherWebsite` | Cordova, web | Company URL |
|
|
444
444
|
| `publisherEmailAddress` | Cordova | Contact email |
|
|
445
445
|
| `scope` | Web/PWA | Base URL scope for the web app |
|
|
446
|
-
| `themeColor` | Cordova, Electron, UWP, web | Loading screen / theme color |
|
|
446
|
+
| `themeColor` | Cordova, Capacitor, Electron, UWP, web | Loading screen / theme color |
|
|
447
447
|
| `twitterId` | Web | Twitter handle for meta tags |
|
|
448
448
|
| `deployFolder` | Client | Neutral deploy directory staged before prebuild (default: `deploy`) |
|
|
449
449
|
| `htmlInjections` | Prebuild | Deploy-relative HTML paths to inject (default: `["index.html"]`) |
|
|
@@ -454,8 +454,29 @@ Standard npm fields (`name`, `version`, `description`) are used directly. Add a
|
|
|
454
454
|
| `platforms.<name>.packager` | Prebuild | `web` (default), `electron`, `cordova`, or `capacitor` — selects the packager class that adds platform-specific files during prebuild |
|
|
455
455
|
| `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
456
|
| `platforms.<name>.socialLogin` | Capacitor + social-auth | Capgo provider config (`providers`, `google.webClientId`, `apple.clientId`, optional `defaultProvider`) |
|
|
457
|
+
| `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
458
|
| `properties` | Cordova | Cordova config.xml entries (plugins, allow-navigation, etc.) |
|
|
458
459
|
|
|
460
|
+
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:
|
|
461
|
+
|
|
462
|
+
```json
|
|
463
|
+
"config": {
|
|
464
|
+
"packageName": "com.example.game",
|
|
465
|
+
"title": "My Game",
|
|
466
|
+
"platforms": {
|
|
467
|
+
"android": {
|
|
468
|
+
"packager": "capacitor",
|
|
469
|
+
"packageName": "com.example.game.android"
|
|
470
|
+
},
|
|
471
|
+
"android-dev": {
|
|
472
|
+
"packager": "capacitor",
|
|
473
|
+
"packageName": "com.example.game.dev"
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
|
|
459
480
|
### `wrapfully.json`
|
|
460
481
|
|
|
461
482
|
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
|
+
}
|