@hot-updater/expo 1.0.8 → 1.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.
- package/dist/index.cjs +65 -10
- package/dist/index.d.cts +12 -2
- package/dist/index.d.mts +12 -2
- package/dist/index.mjs +58 -4
- package/package.json +5 -5
- package/plugin/build/withHotUpdater.js +20 -18
package/dist/index.cjs
CHANGED
|
@@ -926,7 +926,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
926
926
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
927
927
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
928
928
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
929
|
-
const path$
|
|
929
|
+
const path$11 = require("path");
|
|
930
930
|
const COLON = isWindows ? ";" : ":";
|
|
931
931
|
const isexe = require_isexe();
|
|
932
932
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -957,7 +957,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
957
957
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
958
958
|
const ppRaw = pathEnv[i];
|
|
959
959
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
960
|
-
const pCmd = path$
|
|
960
|
+
const pCmd = path$11.join(pathPart, cmd);
|
|
961
961
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
962
962
|
resolve(subStep(p, i, 0));
|
|
963
963
|
});
|
|
@@ -981,7 +981,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
981
981
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
982
982
|
const ppRaw = pathEnv[i];
|
|
983
983
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
984
|
-
const pCmd = path$
|
|
984
|
+
const pCmd = path$11.join(pathPart, cmd);
|
|
985
985
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
986
986
|
for (let j = 0; j < pathExt.length; j++) {
|
|
987
987
|
const cur = p + pathExt[j];
|
|
@@ -1014,7 +1014,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1014
1014
|
//#endregion
|
|
1015
1015
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
1016
1016
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1017
|
-
const path$
|
|
1017
|
+
const path$10 = require("path");
|
|
1018
1018
|
const which = require_which();
|
|
1019
1019
|
const getPathKey = require_path_key();
|
|
1020
1020
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -1029,12 +1029,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1029
1029
|
try {
|
|
1030
1030
|
resolved = which.sync(parsed.command, {
|
|
1031
1031
|
path: env[getPathKey({ env })],
|
|
1032
|
-
pathExt: withoutPathExt ? path$
|
|
1032
|
+
pathExt: withoutPathExt ? path$10.delimiter : void 0
|
|
1033
1033
|
});
|
|
1034
1034
|
} catch (e) {} finally {
|
|
1035
1035
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
1036
1036
|
}
|
|
1037
|
-
if (resolved) resolved = path$
|
|
1037
|
+
if (resolved) resolved = path$10.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
1038
1038
|
return resolved;
|
|
1039
1039
|
}
|
|
1040
1040
|
function resolveCommand(parsed) {
|
|
@@ -1101,7 +1101,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1101
1101
|
//#endregion
|
|
1102
1102
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
1103
1103
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1104
|
-
const path$
|
|
1104
|
+
const path$9 = require("path");
|
|
1105
1105
|
const resolveCommand = require_resolveCommand();
|
|
1106
1106
|
const escape = require_escape();
|
|
1107
1107
|
const readShebang = require_readShebang();
|
|
@@ -1124,7 +1124,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1124
1124
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
1125
1125
|
if (parsed.options.forceShell || needsShell) {
|
|
1126
1126
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
1127
|
-
parsed.command = path$
|
|
1127
|
+
parsed.command = path$9.normalize(parsed.command);
|
|
1128
1128
|
parsed.command = escape.command(parsed.command);
|
|
1129
1129
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
1130
1130
|
parsed.args = [
|
|
@@ -6263,9 +6263,62 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
|
6263
6263
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6264
6264
|
//#endregion
|
|
6265
6265
|
//#region src/expoConfig.ts
|
|
6266
|
-
const require$
|
|
6266
|
+
const require$2 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
6267
6267
|
const getConfig = async (...args) => {
|
|
6268
|
-
return require$
|
|
6268
|
+
return require$2(require$2.resolve("expo/config", { paths: [node_path.default.resolve(args[0])] })).getConfig(...args);
|
|
6269
|
+
};
|
|
6270
|
+
//#endregion
|
|
6271
|
+
//#region src/expoFingerprint.ts
|
|
6272
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
6273
|
+
/**
|
|
6274
|
+
* The engine settings an Expo app declares, for one platform: the JavaScript
|
|
6275
|
+
* engine and the architecture. A bare app records them in
|
|
6276
|
+
* `android/gradle.properties`; an Expo app declares them in the app config,
|
|
6277
|
+
* which prebuild writes into the native projects.
|
|
6278
|
+
*/
|
|
6279
|
+
const readExpoSettings = (exp, platform) => {
|
|
6280
|
+
const own = exp[platform];
|
|
6281
|
+
const settings = { "expo.jsEngine": String(own?.jsEngine ?? exp.jsEngine ?? "hermes") };
|
|
6282
|
+
const newArchEnabled = own?.newArchEnabled ?? exp.newArchEnabled;
|
|
6283
|
+
if (newArchEnabled !== void 0) settings["expo.newArchEnabled"] = String(newArchEnabled);
|
|
6284
|
+
return settings;
|
|
6285
|
+
};
|
|
6286
|
+
/**
|
|
6287
|
+
* The command that lists the React Native packages a build links, chosen as
|
|
6288
|
+
* Expo and @expo/fingerprint choose it: Expo's autolinking from
|
|
6289
|
+
* expo-modules-autolinking 1.12 (SDK 52), else React Native CLI. The native
|
|
6290
|
+
* templates also fall back to React Native CLI when
|
|
6291
|
+
* `EXPO_USE_COMMUNITY_AUTOLINKING=1`, as Expo documents.
|
|
6292
|
+
*/
|
|
6293
|
+
const reactNativeConfigCommand = (cwd, platform, env = process.env) => {
|
|
6294
|
+
const autolinking = (0, _hot_updater_cli_tools.resolveExpoAutolinking)(cwd);
|
|
6295
|
+
if (autolinking.linksReactNative && env["EXPO_USE_COMMUNITY_AUTOLINKING"] !== "1") return [
|
|
6296
|
+
autolinking.bin,
|
|
6297
|
+
"react-native-config",
|
|
6298
|
+
"--platform",
|
|
6299
|
+
platform,
|
|
6300
|
+
"--json"
|
|
6301
|
+
];
|
|
6302
|
+
return [node_path.default.join(node_path.default.dirname(require$1.resolve("react-native/package.json", { paths: [cwd] })), "cli.js"), "config"];
|
|
6303
|
+
};
|
|
6304
|
+
/**
|
|
6305
|
+
* The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
|
|
6306
|
+
* fed the native packages Expo's autolinking links and the engine settings
|
|
6307
|
+
* the app config declares. Neither needs the generated ios/ and android/
|
|
6308
|
+
* folders, so `fingerprint create` before prebuild and the native build
|
|
6309
|
+
* after it compute the same one.
|
|
6310
|
+
*/
|
|
6311
|
+
const expoFingerprint = async (cwd, options) => {
|
|
6312
|
+
const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
|
|
6313
|
+
const settings = readExpoSettings(exp, options.platform);
|
|
6314
|
+
const nativeInterface = await (0, _hot_updater_cli_tools.readReactNativeInterface)({
|
|
6315
|
+
cwd,
|
|
6316
|
+
command: process.execPath,
|
|
6317
|
+
args: reactNativeConfigCommand(cwd, options.platform),
|
|
6318
|
+
platform: options.platform,
|
|
6319
|
+
settings
|
|
6320
|
+
});
|
|
6321
|
+
return (0, _hot_updater_cli_tools.createInterfaceFingerprint)(cwd, options, nativeInterface);
|
|
6269
6322
|
};
|
|
6270
6323
|
//#endregion
|
|
6271
6324
|
//#region src/resolveMain.ts
|
|
@@ -6409,6 +6462,7 @@ const expo = (config = {
|
|
|
6409
6462
|
const { outDir = "dist", sourcemap = false, resetCache = true } = config;
|
|
6410
6463
|
return {
|
|
6411
6464
|
nativeBuild: {
|
|
6465
|
+
fingerprint: (options) => expoFingerprint(cwd, options),
|
|
6412
6466
|
getBundleSigningPublicKey: () => getExpoBundleSigningPublicKey(cwd),
|
|
6413
6467
|
getFingerprintExtraSources: async () => getExpoFingerprintExtraSources(cwd),
|
|
6414
6468
|
prebuild: async ({ platform }) => {
|
|
@@ -6440,5 +6494,6 @@ const expo = (config = {
|
|
|
6440
6494
|
};
|
|
6441
6495
|
//#endregion
|
|
6442
6496
|
exports.expo = expo;
|
|
6497
|
+
exports.expoFingerprint = expoFingerprint;
|
|
6443
6498
|
exports.getExpoBundleSigningPublicKey = getExpoBundleSigningPublicKey;
|
|
6444
6499
|
exports.getExpoFingerprintExtraSources = getExpoFingerprintExtraSources;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig } from "@hot-updater/plugin-core";
|
|
1
|
+
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions } from "@hot-updater/plugin-core";
|
|
2
2
|
//#region src/expo.d.ts
|
|
3
3
|
declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
|
|
4
4
|
declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
|
|
@@ -18,4 +18,14 @@ interface ExpoAdapterConfig extends BuildAdapterConfig {
|
|
|
18
18
|
}
|
|
19
19
|
declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs) => BuildAdapter;
|
|
20
20
|
//#endregion
|
|
21
|
-
|
|
21
|
+
//#region src/expoFingerprint.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
|
|
24
|
+
* fed the native packages Expo's autolinking links and the engine settings
|
|
25
|
+
* the app config declares. Neither needs the generated ios/ and android/
|
|
26
|
+
* folders, so `fingerprint create` before prebuild and the native build
|
|
27
|
+
* after it compute the same one.
|
|
28
|
+
*/
|
|
29
|
+
declare const expoFingerprint: (cwd: string, options: NativeFingerprintOptions) => Promise<import("@hot-updater/plugin-core").NativeFingerprint>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig } from "@hot-updater/plugin-core";
|
|
1
|
+
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions } from "@hot-updater/plugin-core";
|
|
2
2
|
//#region src/expo.d.ts
|
|
3
3
|
declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
|
|
4
4
|
declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
|
|
@@ -18,4 +18,14 @@ interface ExpoAdapterConfig extends BuildAdapterConfig {
|
|
|
18
18
|
}
|
|
19
19
|
declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs) => BuildAdapter;
|
|
20
20
|
//#endregion
|
|
21
|
-
|
|
21
|
+
//#region src/expoFingerprint.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
|
|
24
|
+
* fed the native packages Expo's autolinking links and the engine settings
|
|
25
|
+
* the app config declares. Neither needs the generated ios/ and android/
|
|
26
|
+
* folders, so `fingerprint create` before prebuild and the native build
|
|
27
|
+
* after it compute the same one.
|
|
28
|
+
*/
|
|
29
|
+
declare const expoFingerprint: (cwd: string, options: NativeFingerprintOptions) => Promise<import("@hot-updater/plugin-core").NativeFingerprint>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import fs from "fs";
|
|
|
4
4
|
import * as path$2 from "path";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import { compileHermes } from "@hot-updater/bare";
|
|
7
|
-
import { log, p, readBundleSigningPublicKeyFile } from "@hot-updater/cli-tools";
|
|
7
|
+
import { createInterfaceFingerprint, log, p, readBundleSigningPublicKeyFile, readReactNativeInterface, resolveExpoAutolinking } from "@hot-updater/cli-tools";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
10
10
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -6259,9 +6259,62 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
|
6259
6259
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6260
6260
|
//#endregion
|
|
6261
6261
|
//#region src/expoConfig.ts
|
|
6262
|
-
const require$
|
|
6262
|
+
const require$2 = createRequire(import.meta.url);
|
|
6263
6263
|
const getConfig = async (...args) => {
|
|
6264
|
-
return require$
|
|
6264
|
+
return require$2(require$2.resolve("expo/config", { paths: [path$1.resolve(args[0])] })).getConfig(...args);
|
|
6265
|
+
};
|
|
6266
|
+
//#endregion
|
|
6267
|
+
//#region src/expoFingerprint.ts
|
|
6268
|
+
const require$1 = createRequire(import.meta.url);
|
|
6269
|
+
/**
|
|
6270
|
+
* The engine settings an Expo app declares, for one platform: the JavaScript
|
|
6271
|
+
* engine and the architecture. A bare app records them in
|
|
6272
|
+
* `android/gradle.properties`; an Expo app declares them in the app config,
|
|
6273
|
+
* which prebuild writes into the native projects.
|
|
6274
|
+
*/
|
|
6275
|
+
const readExpoSettings = (exp, platform) => {
|
|
6276
|
+
const own = exp[platform];
|
|
6277
|
+
const settings = { "expo.jsEngine": String(own?.jsEngine ?? exp.jsEngine ?? "hermes") };
|
|
6278
|
+
const newArchEnabled = own?.newArchEnabled ?? exp.newArchEnabled;
|
|
6279
|
+
if (newArchEnabled !== void 0) settings["expo.newArchEnabled"] = String(newArchEnabled);
|
|
6280
|
+
return settings;
|
|
6281
|
+
};
|
|
6282
|
+
/**
|
|
6283
|
+
* The command that lists the React Native packages a build links, chosen as
|
|
6284
|
+
* Expo and @expo/fingerprint choose it: Expo's autolinking from
|
|
6285
|
+
* expo-modules-autolinking 1.12 (SDK 52), else React Native CLI. The native
|
|
6286
|
+
* templates also fall back to React Native CLI when
|
|
6287
|
+
* `EXPO_USE_COMMUNITY_AUTOLINKING=1`, as Expo documents.
|
|
6288
|
+
*/
|
|
6289
|
+
const reactNativeConfigCommand = (cwd, platform, env = process.env) => {
|
|
6290
|
+
const autolinking = resolveExpoAutolinking(cwd);
|
|
6291
|
+
if (autolinking.linksReactNative && env["EXPO_USE_COMMUNITY_AUTOLINKING"] !== "1") return [
|
|
6292
|
+
autolinking.bin,
|
|
6293
|
+
"react-native-config",
|
|
6294
|
+
"--platform",
|
|
6295
|
+
platform,
|
|
6296
|
+
"--json"
|
|
6297
|
+
];
|
|
6298
|
+
return [path$1.join(path$1.dirname(require$1.resolve("react-native/package.json", { paths: [cwd] })), "cli.js"), "config"];
|
|
6299
|
+
};
|
|
6300
|
+
/**
|
|
6301
|
+
* The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
|
|
6302
|
+
* fed the native packages Expo's autolinking links and the engine settings
|
|
6303
|
+
* the app config declares. Neither needs the generated ios/ and android/
|
|
6304
|
+
* folders, so `fingerprint create` before prebuild and the native build
|
|
6305
|
+
* after it compute the same one.
|
|
6306
|
+
*/
|
|
6307
|
+
const expoFingerprint = async (cwd, options) => {
|
|
6308
|
+
const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
|
|
6309
|
+
const settings = readExpoSettings(exp, options.platform);
|
|
6310
|
+
const nativeInterface = await readReactNativeInterface({
|
|
6311
|
+
cwd,
|
|
6312
|
+
command: process.execPath,
|
|
6313
|
+
args: reactNativeConfigCommand(cwd, options.platform),
|
|
6314
|
+
platform: options.platform,
|
|
6315
|
+
settings
|
|
6316
|
+
});
|
|
6317
|
+
return createInterfaceFingerprint(cwd, options, nativeInterface);
|
|
6265
6318
|
};
|
|
6266
6319
|
//#endregion
|
|
6267
6320
|
//#region src/resolveMain.ts
|
|
@@ -6405,6 +6458,7 @@ const expo = (config = {
|
|
|
6405
6458
|
const { outDir = "dist", sourcemap = false, resetCache = true } = config;
|
|
6406
6459
|
return {
|
|
6407
6460
|
nativeBuild: {
|
|
6461
|
+
fingerprint: (options) => expoFingerprint(cwd, options),
|
|
6408
6462
|
getBundleSigningPublicKey: () => getExpoBundleSigningPublicKey(cwd),
|
|
6409
6463
|
getFingerprintExtraSources: async () => getExpoFingerprintExtraSources(cwd),
|
|
6410
6464
|
prebuild: async ({ platform }) => {
|
|
@@ -6435,4 +6489,4 @@ const expo = (config = {
|
|
|
6435
6489
|
};
|
|
6436
6490
|
};
|
|
6437
6491
|
//#endregion
|
|
6438
|
-
export { expo, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
|
6492
|
+
export { expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/expo",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Hot Updater build and config plugin for Expo",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"@babel/core": "7.26.0",
|
|
29
29
|
"@babel/types": "7.26.0",
|
|
30
30
|
"uuidv7": "^1.0.2",
|
|
31
|
-
"@hot-updater/
|
|
32
|
-
"@hot-updater/
|
|
33
|
-
"@hot-updater/
|
|
31
|
+
"@hot-updater/cli-tools": "1.1.0",
|
|
32
|
+
"@hot-updater/plugin-core": "1.1.0",
|
|
33
|
+
"@hot-updater/bare": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20",
|
|
37
37
|
"expo": "^50.0.0",
|
|
38
38
|
"execa": "9.5.2",
|
|
39
39
|
"vitest": "4.1.4",
|
|
40
|
-
"hot-updater": "1.0
|
|
40
|
+
"hot-updater": "1.1.0"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPublicKeyFromConfig = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
7
9
|
const config_plugins_1 = require("expo/config-plugins");
|
|
8
10
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
9
11
|
const transformers_1 = require("./transformers");
|
|
@@ -109,20 +111,27 @@ const withHotUpdaterConfigAsync = (props) => (config) => {
|
|
|
109
111
|
return publicKeyPromise;
|
|
110
112
|
};
|
|
111
113
|
let modifiedConfig = config;
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
// fingerprint.json, which the native build reads to embed each
|
|
115
|
+
// platform's fingerprint. Under appVersion a fingerprint.json left from
|
|
116
|
+
// the fingerprint strategy would still be embedded, so it goes.
|
|
117
|
+
const writeFingerprintJson = async (projectRoot) => {
|
|
115
118
|
const hotUpdaterConfig = await getHotUpdaterConfig();
|
|
116
119
|
if (hotUpdaterConfig.updateStrategy !== "appVersion") {
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
await getFingerprint(props.publicKeyPath);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
await promises_1.default.rm(node_path_1.default.join(projectRoot, "fingerprint.json"), {
|
|
124
|
+
force: true,
|
|
125
|
+
});
|
|
119
126
|
}
|
|
127
|
+
};
|
|
128
|
+
// === iOS: Add channel to Info.plist ===
|
|
129
|
+
modifiedConfig = (0, config_plugins_1.withInfoPlist)(modifiedConfig, async (cfg) => {
|
|
130
|
+
await writeFingerprintJson(cfg.modRequest.projectRoot);
|
|
120
131
|
// Load public key if signing is enabled
|
|
121
132
|
const publicKey = await getPublicKey(cfg.modRequest.projectRoot);
|
|
122
133
|
cfg.modResults.HOT_UPDATER_CHANNEL = channel;
|
|
123
|
-
|
|
124
|
-
cfg.modResults.HOT_UPDATER_FINGERPRINT_HASH = fingerprintHash;
|
|
125
|
-
}
|
|
134
|
+
delete cfg.modResults.HOT_UPDATER_FINGERPRINT_HASH;
|
|
126
135
|
if (publicKey) {
|
|
127
136
|
cfg.modResults.HOT_UPDATER_PUBLIC_KEY = publicKey;
|
|
128
137
|
}
|
|
@@ -131,14 +140,9 @@ const withHotUpdaterConfigAsync = (props) => (config) => {
|
|
|
131
140
|
}
|
|
132
141
|
return cfg;
|
|
133
142
|
});
|
|
134
|
-
// === Android: Add channel
|
|
143
|
+
// === Android: Add channel to AndroidManifest.xml ===
|
|
135
144
|
modifiedConfig = (0, config_plugins_1.withAndroidManifest)(modifiedConfig, async (cfg) => {
|
|
136
|
-
|
|
137
|
-
const hotUpdaterConfig = await getHotUpdaterConfig();
|
|
138
|
-
if (hotUpdaterConfig.updateStrategy !== "appVersion") {
|
|
139
|
-
const fingerprint = await getFingerprint(props.publicKeyPath);
|
|
140
|
-
fingerprintHash = fingerprint.android.hash;
|
|
141
|
-
}
|
|
145
|
+
await writeFingerprintJson(cfg.modRequest.projectRoot);
|
|
142
146
|
// Load public key if signing is enabled
|
|
143
147
|
const publicKey = await getPublicKey(cfg.modRequest.projectRoot);
|
|
144
148
|
const application = cfg.modResults.manifest.application?.[0];
|
|
@@ -146,9 +150,7 @@ const withHotUpdaterConfigAsync = (props) => (config) => {
|
|
|
146
150
|
return cfg;
|
|
147
151
|
}
|
|
148
152
|
upsertAndroidMetaData(application, ANDROID_META_DATA_KEYS.channel, channel);
|
|
149
|
-
|
|
150
|
-
upsertAndroidMetaData(application, ANDROID_META_DATA_KEYS.fingerprintHash, fingerprintHash);
|
|
151
|
-
}
|
|
153
|
+
removeAndroidMetaData(application, ANDROID_META_DATA_KEYS.fingerprintHash);
|
|
152
154
|
if (publicKey) {
|
|
153
155
|
upsertAndroidMetaData(application, ANDROID_META_DATA_KEYS.publicKey, config_plugins_1.XML.escapeAndroidString(publicKey));
|
|
154
156
|
}
|