@makefully/adaptfully 3.0.0 → 3.0.1

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 CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 3.0.1 — 2026-06-17
6
+
7
+ ### Added
8
+
9
+ - `config.htmlInjections` — list of deploy-relative HTML paths to inject during prebuild (default: `["index.html"]`).
10
+
11
+ ### Fixed
12
+
13
+ - Prebuild injects only configured HTML files instead of scanning every `.html` in the deploy folder.
14
+
5
15
  ## 3.0.0 — 2026-06-17
6
16
 
7
17
  ### Added
package/README.md CHANGED
@@ -28,7 +28,7 @@ adaptfully deploy steam # build + platform release when credentials are pres
28
28
 
29
29
  | Stage | What it does |
30
30
  |-------|----------------|
31
- | `prebuild` | Copy `deploy/` to `output/<platform>-prebuild/` and inject registrations |
31
+ | `prebuild` | Copy `deploy/` to `output/<platform>-prebuild/` and inject registrations into `config.htmlInjections` |
32
32
  | `build` | Prebuild, then POST the result to Wrapfully |
33
33
  | `deploy` | Build, then release to the target platform (Steam upload, webapp SFTP, etc. via Wrapfully when credentials are in `assets/meta/publish/`) |
34
34
 
@@ -41,7 +41,7 @@ Place `<!-- adaptfully -->` / `<!-- /adaptfully -->` markers in your HTML templa
41
41
  adaptfully.register('auth', adaptfully.auth.Google);
42
42
 
43
43
  // In-game:
44
- var platform = adaptfully.get('auth');
44
+ const platform = adaptfully.get('auth');
45
45
  platform.login(function (result) { /* ... */ });
46
46
  ```
47
47
 
@@ -90,6 +90,7 @@ Wrapfully builders (`steam`, `win`, `mac`, `android`, etc.) map to platform keys
90
90
  ```javascript
91
91
  import {
92
92
  prebuildPlatform,
93
+ resolveHtmlInjections,
93
94
  runAdaptfullyStage,
94
95
  buildAdaptfullyInjection,
95
96
  injectAdaptfullyRegistrations,
@@ -103,7 +104,7 @@ import {
103
104
  } from '@makefully/adaptfully';
104
105
  ```
105
106
 
106
- - **`prebuildPlatform(deployFolder, platformKey, pkg)`** — copy `deploy/` to `output/<platform>-prebuild/` and inject registrations into all HTML files.
107
+ - **`prebuildPlatform(deployFolder, platformKey, pkg)`** — copy `deploy/` to `output/<platform>-prebuild/` and inject registrations into `config.htmlInjections` (default: `index.html`).
107
108
  - **`resolveRegistrationAssets(registrations)`** — resolve runtime script paths, inline registration JS, and external script tags for a registration map (useful for Vite dev servers).
108
109
  - **`runAdaptfullyStage('prebuild' | 'build' | 'deploy', platformKey, options)`** — run a pipeline stage programmatically.
109
110
 
@@ -139,7 +140,7 @@ npx adaptfully <prebuild|build|deploy> <platform> [server] [mode]
139
140
 
140
141
  | Stage | Description |
141
142
  |-------|-------------|
142
- | `prebuild` | Copy `deploy/` → `output/<platform>-prebuild/` with registrations injected |
143
+ | `prebuild` | Copy `deploy/` → `output/<platform>-prebuild/` with registrations injected into `config.htmlInjections` |
143
144
  | `build` | Prebuild, then POST to Wrapfully (no platform release) |
144
145
  | `deploy` | Prebuild, POST to Wrapfully, then release when credentials are present |
145
146
 
@@ -314,6 +315,7 @@ Standard npm fields (`name`, `version`, `description`) are used directly. Add a
314
315
  | `twitterId` | Web | Twitter handle for meta tags |
315
316
  | `steamId` | Steam | Steam app ID |
316
317
  | `deployFolder` | Client | Neutral deploy directory staged before prebuild (default: `deploy`) |
318
+ | `htmlInjections` | Prebuild | Deploy-relative HTML paths to inject (default: `["index.html"]`) |
317
319
  | `outputFolder` | Client | Prebuild output root (default: `output`) |
318
320
  | `platforms` | Prebuild | Per-platform registration maps (see [Adaptfully runtime](#adaptfully-runtime)) |
319
321
  | `platforms.<name>.builder` | Build/deploy | Override Wrapfully builder for a platform (default: `web` → `webapp`, others match platform key) |
package/lib/node/index.js CHANGED
@@ -2,7 +2,7 @@ export { createArchive } from './archive.js';
2
2
  export { loadProjectConfig, resolveServerUrl } from './config.js';
3
3
  export { send } from './deploy.js';
4
4
  export { adaptfullyFromCli, runAdaptfullyStage } from './pipeline.js';
5
- export { prebuildPlatform, prebuildOutputDir } from './prebuild.js';
5
+ export { prebuildPlatform, prebuildOutputDir, resolveHtmlInjections } from './prebuild.js';
6
6
  export { getPackageRoot, getRuntimeDir, resolveRuntimeScript } from './paths.js';
7
7
  export {
8
8
  STANDARD_PLUGINS,
@@ -4,10 +4,32 @@ import {
4
4
  adaptfullyInjectionForPlatform,
5
5
  injectAdaptfullyRegistrations,
6
6
  } from './registrations.js';
7
- import { copyRecursiveSync, emptyDirSync, listHtmlFilesRecursive } from './fs-utils.js';
7
+ import { copyRecursiveSync, emptyDirSync } from './fs-utils.js';
8
8
 
9
9
  /** @typedef {'prebuild' | 'build' | 'deploy'} AdaptfullyStage */
10
10
 
11
+ const DEFAULT_HTML_INJECTIONS = ['index.html'];
12
+
13
+ /**
14
+ * @param {{ config?: { htmlInjections?: string[] } }} pkg
15
+ * @returns {string[]}
16
+ */
17
+ export function resolveHtmlInjections(pkg) {
18
+ const injections = pkg.config?.htmlInjections;
19
+ if (injections === undefined) {
20
+ return DEFAULT_HTML_INJECTIONS;
21
+ }
22
+ if (!Array.isArray(injections) || injections.length === 0) {
23
+ throw new Error('config.htmlInjections must be a non-empty array of paths relative to the deploy folder');
24
+ }
25
+ for (const entry of injections) {
26
+ if (typeof entry !== 'string' || !entry.length) {
27
+ throw new Error('config.htmlInjections entries must be non-empty strings');
28
+ }
29
+ }
30
+ return injections;
31
+ }
32
+
11
33
  /**
12
34
  * @param {string} platformKey
13
35
  * @param {{ config?: { platforms?: Record<string, unknown>, outputFolder?: string } }} pkg
@@ -53,7 +75,12 @@ export function prebuildPlatform(deployFolder, platformKey, pkg, options = {}) {
53
75
 
54
76
  const injection = adaptfullyInjectionForPlatform(platformKey, pkg, { log });
55
77
  if (injection) {
56
- for (const htmlPath of listHtmlFilesRecursive(dest)) {
78
+ for (const relativePath of resolveHtmlInjections(pkg)) {
79
+ const htmlPath = path.join(dest, relativePath);
80
+ if (!fs.existsSync(htmlPath)) {
81
+ throw new Error(`htmlInjections file not found in deploy output: ${relativePath}`);
82
+ }
83
+ log(`adaptfully: inject ${relativePath}`);
57
84
  injectAdaptfullyIntoHtmlFile(htmlPath, injection);
58
85
  }
59
86
  }
@@ -233,7 +233,7 @@ export function injectAdaptfullyRegistrations(html, injection) {
233
233
  }
234
234
 
235
235
  throw new Error(
236
- 'Cannot inject Adaptfully registrations: index.html needs '
236
+ 'Cannot inject Adaptfully registrations: HTML needs '
237
237
  + '<!-- adaptfully -->…<!-- /adaptfully -->, <!-- scripts -->, or </head>',
238
238
  );
239
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makefully/adaptfully",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Platform abstraction and Wrapfully deploy client for Makefully games",
5
5
  "type": "module",
6
6
  "main": "./lib/node/index.js",