@makefully/adaptfully 3.16.1 → 4.1.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.
@@ -1,5 +1,4 @@
1
1
  import { CapacitorPackager } from './capacitor.js';
2
- import { CordovaPackager } from './cordova.js';
3
2
  import { ElectronPackager } from './electron.js';
4
3
  import { Packager, VALID_PACKAGERS } from './base.js';
5
4
  import { WebPackager } from './web.js';
@@ -10,7 +9,6 @@ export {
10
9
  resolvePlatformSocialLogin,
11
10
  validateSocialLoginConfig,
12
11
  } from './capacitor.js';
13
- export { CordovaPackager } from './cordova.js';
14
12
  export {
15
13
  ElectronPackager,
16
14
  buildElectronMain,
@@ -26,7 +24,6 @@ export { WebPackager } from './web.js';
26
24
  const PACKAGER_REGISTRY = {
27
25
  web: WebPackager,
28
26
  electron: ElectronPackager,
29
- cordova: CordovaPackager,
30
27
  capacitor: CapacitorPackager,
31
28
  };
32
29
 
@@ -12,6 +12,8 @@ import {
12
12
  import { steamPublishFromCli } from './steam-publish.js';
13
13
  import { googlePublishFromCli } from './google-publish.js';
14
14
  import { applePublishFromCli } from './apple-publish.js';
15
+ import { androidKeystoreFromCli } from './android-keystore.js';
16
+ import { appleSigningFromCli } from './apple-signing.js';
15
17
 
16
18
  /** @typedef {'prebuild' | 'build' | 'deploy' | 'release'} AdaptfullyStage */
17
19
 
@@ -20,6 +22,8 @@ const PUBLISH_COMMANDS = {
20
22
  'steam-publish': steamPublishFromCli,
21
23
  'google-publish': googlePublishFromCli,
22
24
  'apple-publish': applePublishFromCli,
25
+ 'android-keystore': androidKeystoreFromCli,
26
+ 'apple-signing': appleSigningFromCli,
23
27
  };
24
28
 
25
29
  /**
@@ -202,6 +206,8 @@ export async function adaptfullyFromCli(argv = process.argv) {
202
206
  + ' adaptfully steam-publish [--username U] [--password P] [--deployment steam] [--output path]\n'
203
207
  + ' adaptfully google-publish [--from service-account.json] [--deployment android] [--output path]\n'
204
208
  + ' adaptfully apple-publish [--deployment ios] [--category C] [--identity I] [--username U] [--password P]\n'
209
+ + ' adaptfully android-keystore [--deployment android] [--debug-only] [--yes]\n'
210
+ + ' adaptfully apple-signing [--deployment ios] [--kind development|distribution] [--csr-only] [--from-cer path] [--provision path]\n'
205
211
  + '\n'
206
212
  + 'Stages:\n'
207
213
  + ' prebuild Copy deploy/ and apply platform registrations → output/<platform>-prebuild/\n'
@@ -213,9 +219,11 @@ export async function adaptfullyFromCli(argv = process.argv) {
213
219
  + ' --artifact <path> Prior build artifact directory (deploy only; default: ./output/ after build).\n'
214
220
  + '\n'
215
221
  + 'Publish credential helpers (one-time local setup):\n'
216
- + ' steam-publish Install steamcmd if needed, log in, write steam deployment steam.json\n'
217
- + ' google-publish Import a Play service-account JSON into the android deployment folder\n'
218
- + ' apple-publish Write App Store Connect credentials into the ios deployment folder',
222
+ + ' steam-publish Install steamcmd if needed, log in, write steam deployment steam.json\n'
223
+ + ' google-publish Import a Play service-account JSON into the android deployment folder\n'
224
+ + ' apple-publish Write App Store Connect credentials into the ios deployment folder\n'
225
+ + ' android-keystore Generate debug/release keystores and write android build.json\n'
226
+ + ' apple-signing Generate CSR, export .p12, place provisioning profiles under ios/apple/',
219
227
  );
220
228
  }
221
229
 
@@ -211,13 +211,33 @@ export async function promptRequired(prompt, existing) {
211
211
  }
212
212
  }
213
213
 
214
+ /**
215
+ * @param {string} prompt
216
+ * @param {boolean} [defaultYes=false]
217
+ * @returns {Promise<boolean>}
218
+ */
219
+ export async function promptConfirm(prompt, defaultYes = false) {
220
+ const rl = readline.createInterface({ input, output });
221
+ const suffix = defaultYes ? ' [Y/n] ' : ' [y/N] ';
222
+
223
+ try {
224
+ const answer = String(await rl.question(`${prompt}${suffix}`)).trim().toLowerCase();
225
+ if (!answer) {
226
+ return defaultYes;
227
+ }
228
+ return answer === 'y' || answer === 'yes';
229
+ } finally {
230
+ rl.close();
231
+ }
232
+ }
233
+
214
234
  /**
215
235
  * Parse shared CLI flags used by publish credential helpers.
216
236
  * @param {string[]} argv
217
237
  * @param {number} [startIndex=3]
218
238
  */
219
239
  export function parsePublishCredentialArgv(argv, startIndex = 3) {
220
- /** @type {Record<string, string>} */
240
+ /** @type {Record<string, string | boolean>} */
221
241
  const options = {
222
242
  projectRoot: '.',
223
243
  };
@@ -243,6 +263,32 @@ export function parsePublishCredentialArgv(argv, startIndex = 3) {
243
263
  options.username = argv[++i];
244
264
  } else if (arg === '--password' && argv[i + 1]) {
245
265
  options.password = argv[++i];
266
+ } else if (arg === '--debug-only') {
267
+ options.debugOnly = true;
268
+ } else if (arg === '--csr-only') {
269
+ options.csrOnly = true;
270
+ } else if (arg === '--yes' || arg === '-y') {
271
+ options.yes = true;
272
+ } else if (arg === '--from-cer' && argv[i + 1]) {
273
+ options.fromCer = normalizeUserPath(argv[++i]);
274
+ } else if (arg === '--kind' && argv[i + 1]) {
275
+ options.kind = argv[++i];
276
+ } else if (arg === '--provision' && argv[i + 1]) {
277
+ options.provision = normalizeUserPath(argv[++i]);
278
+ } else if (arg === '--workdir' && argv[i + 1]) {
279
+ options.workdir = normalizeUserPath(argv[++i]);
280
+ } else if (arg === '--alias' && argv[i + 1]) {
281
+ options.alias = argv[++i];
282
+ } else if (arg === '--store-password' && argv[i + 1]) {
283
+ options.storePassword = argv[++i];
284
+ } else if (arg === '--key-password' && argv[i + 1]) {
285
+ options.keyPassword = argv[++i];
286
+ } else if (arg === '--p12-password' && argv[i + 1]) {
287
+ options.p12Password = argv[++i];
288
+ } else if (arg === '--cn' && argv[i + 1]) {
289
+ options.cn = argv[++i];
290
+ } else if (arg === '--email' && argv[i + 1]) {
291
+ options.email = argv[++i];
246
292
  }
247
293
  }
248
294
 
@@ -345,7 +345,7 @@ export function resolvePublishDir(deploymentKey, metaDir = 'assets/meta') {
345
345
  return path.join(metaDir, 'deployments', deploymentKey);
346
346
  }
347
347
 
348
- const BUILD_SIGNING_PACKAGERS = new Set(['capacitor', 'cordova']);
348
+ const BUILD_SIGNING_PACKAGERS = new Set(['capacitor']);
349
349
 
350
350
  /**
351
351
  * Credential folders to ship with `adaptfully build` (zip artifact) when the
@@ -412,7 +412,10 @@ export function resolveFamily(targets, packager) {
412
412
  return 'electron';
413
413
  }
414
414
  if (packager === 'cordova') {
415
- return 'cordova';
415
+ throw new Error(
416
+ 'Cordova/PhoneGap is no longer supported. Remove packager: "cordova" '
417
+ + '(or set packager: "capacitor") and use Capacitor for android/ios builds.',
418
+ );
416
419
  }
417
420
  if (packager === 'capacitor') {
418
421
  return 'capacitor';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makefully/adaptfully",
3
- "version": "3.16.1",
3
+ "version": "4.1.0",
4
4
  "description": "Platform abstraction and Wrapfully deploy client for Makefully games",
5
5
  "type": "module",
6
6
  "main": "./lib/node/index.js",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "bin",
19
19
  "lib",
20
+ "docs",
20
21
  "CHANGELOG.md",
21
22
  "LICENSE",
22
23
  "README.md"
@@ -40,7 +41,7 @@
40
41
  "platform",
41
42
  "deploy",
42
43
  "build",
43
- "cordova",
44
+ "capacitor",
44
45
  "electron"
45
46
  ],
46
47
  "contributors": [
@@ -1,44 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { Packager } from './base.js';
4
-
5
- const CORDOVA_CSP = '<meta http-equiv="Content-Security-Policy" content="default-src * \'self\' data: gap: \'unsafe-inline\' \'unsafe-eval\'; style-src * \'self\' \'unsafe-inline\' \'unsafe-eval\' gap:; script-src * \'self\' \'unsafe-inline\' \'unsafe-eval\' gap:; frame-src *;" />';
6
-
7
- const CORDOVA_VIEWPORT = '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />';
8
-
9
- const CORDOVA_STUB = `/**
10
- * Stub for non-Cordova environments. Cordova replaces this at runtime on device builds.
11
- */
12
- window.cordova = null;
13
- `;
14
-
15
- export class CordovaPackager extends Packager {
16
- /** @type {'cordova'} */
17
- static id = 'cordova';
18
-
19
- /** @type {string[]} */
20
- static defaultPlatforms = ['ios', 'android'];
21
-
22
- needsGameConfig() {
23
- return true;
24
- }
25
-
26
- /** @param {string} dest */
27
- applyTemplates(dest) {
28
- fs.writeFileSync(path.join(dest, 'cordova.js'), CORDOVA_STUB);
29
- this.log('adaptfully: write cordova.js');
30
-
31
- super.applyTemplates(dest);
32
- }
33
-
34
- buildHtmlInjection() {
35
- const headExtras = [CORDOVA_CSP, CORDOVA_VIEWPORT];
36
- const bodyScripts = ['<script src="cordova.js"></script>'];
37
-
38
- if (this.needsGameConfig()) {
39
- bodyScripts.push('<script src="game-config.js"></script>');
40
- }
41
-
42
- return this.formatHtmlInjection(headExtras, bodyScripts);
43
- }
44
- }