hot-updater 0.18.0 → 0.18.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/dist/index.cjs CHANGED
@@ -21247,6 +21247,28 @@ fingerprintCommand.action(async () => {
21247
21247
  __clack_prompts.log.success("Fingerprint matched");
21248
21248
  });
21249
21249
  fingerprintCommand.command("create").description("Create fingerprint").action(async () => {
21250
+ const FINGERPRINT_FILE_PATH = path.default.join((0, __hot_updater_plugin_core.getCwd)(), "fingerprint.json");
21251
+ const createFingerprintData = async (config) => {
21252
+ const [ios, android] = await Promise.all([(0, __rnef_tools.nativeFingerprint)((0, __hot_updater_plugin_core.getCwd)(), {
21253
+ platform: "ios",
21254
+ ...config.fingerprint
21255
+ }), (0, __rnef_tools.nativeFingerprint)((0, __hot_updater_plugin_core.getCwd)(), {
21256
+ platform: "android",
21257
+ ...config.fingerprint
21258
+ })]);
21259
+ return {
21260
+ ios,
21261
+ android
21262
+ };
21263
+ };
21264
+ const readLocalFingerprint = async () => {
21265
+ try {
21266
+ const content = await fs.default.promises.readFile(FINGERPRINT_FILE_PATH, "utf-8");
21267
+ return JSON.parse(content);
21268
+ } catch {
21269
+ return null;
21270
+ }
21271
+ };
21250
21272
  let diffChanged = false;
21251
21273
  await __clack_prompts.tasks([{
21252
21274
  title: "Creating fingerprint.json",
@@ -21256,22 +21278,10 @@ fingerprintCommand.command("create").description("Create fingerprint").action(as
21256
21278
  __clack_prompts.log.error("The updateStrategy in hot-updater.config.ts is set to 'appVersion'. This command only works with 'fingerprint' strategy.");
21257
21279
  process.exit(1);
21258
21280
  }
21259
- const [ios, android] = await Promise.all([(0, __rnef_tools.nativeFingerprint)((0, __hot_updater_plugin_core.getCwd)(), {
21260
- platform: "ios",
21261
- ...config.fingerprint
21262
- }), (0, __rnef_tools.nativeFingerprint)((0, __hot_updater_plugin_core.getCwd)(), {
21263
- platform: "android",
21264
- ...config.fingerprint
21265
- })]);
21266
- const fingerprint = {
21267
- ios,
21268
- android
21269
- };
21270
- const readFingerprint = await fs.default.promises.readFile(path.default.join((0, __hot_updater_plugin_core.getCwd)(), "fingerprint.json"), "utf-8");
21271
- const localFingerprint = JSON.parse(readFingerprint);
21272
- if (localFingerprint.ios.hash !== fingerprint.ios.hash) diffChanged = true;
21273
- if (localFingerprint.android.hash !== fingerprint.android.hash) diffChanged = true;
21274
- await fs.default.promises.writeFile(path.default.join((0, __hot_updater_plugin_core.getCwd)(), "fingerprint.json"), JSON.stringify(fingerprint, null, 2));
21281
+ const newFingerprint = await createFingerprintData(config);
21282
+ const localFingerprint = await readLocalFingerprint();
21283
+ if (!localFingerprint || localFingerprint?.ios?.hash !== newFingerprint.ios.hash || localFingerprint?.android?.hash !== newFingerprint.android.hash) diffChanged = true;
21284
+ await fs.default.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(newFingerprint, null, 2));
21275
21285
  return "Created fingerprint.json";
21276
21286
  }
21277
21287
  }]);
package/dist/index.js CHANGED
@@ -21257,6 +21257,28 @@ fingerprintCommand.action(async () => {
21257
21257
  p.log.success("Fingerprint matched");
21258
21258
  });
21259
21259
  fingerprintCommand.command("create").description("Create fingerprint").action(async () => {
21260
+ const FINGERPRINT_FILE_PATH = path.join(getCwd(), "fingerprint.json");
21261
+ const createFingerprintData = async (config) => {
21262
+ const [ios, android] = await Promise.all([nativeFingerprint(getCwd(), {
21263
+ platform: "ios",
21264
+ ...config.fingerprint
21265
+ }), nativeFingerprint(getCwd(), {
21266
+ platform: "android",
21267
+ ...config.fingerprint
21268
+ })]);
21269
+ return {
21270
+ ios,
21271
+ android
21272
+ };
21273
+ };
21274
+ const readLocalFingerprint = async () => {
21275
+ try {
21276
+ const content = await fs.promises.readFile(FINGERPRINT_FILE_PATH, "utf-8");
21277
+ return JSON.parse(content);
21278
+ } catch {
21279
+ return null;
21280
+ }
21281
+ };
21260
21282
  let diffChanged = false;
21261
21283
  await p.tasks([{
21262
21284
  title: "Creating fingerprint.json",
@@ -21266,22 +21288,10 @@ fingerprintCommand.command("create").description("Create fingerprint").action(as
21266
21288
  p.log.error("The updateStrategy in hot-updater.config.ts is set to 'appVersion'. This command only works with 'fingerprint' strategy.");
21267
21289
  process.exit(1);
21268
21290
  }
21269
- const [ios, android] = await Promise.all([nativeFingerprint(getCwd(), {
21270
- platform: "ios",
21271
- ...config.fingerprint
21272
- }), nativeFingerprint(getCwd(), {
21273
- platform: "android",
21274
- ...config.fingerprint
21275
- })]);
21276
- const fingerprint = {
21277
- ios,
21278
- android
21279
- };
21280
- const readFingerprint = await fs.promises.readFile(path.join(getCwd(), "fingerprint.json"), "utf-8");
21281
- const localFingerprint = JSON.parse(readFingerprint);
21282
- if (localFingerprint.ios.hash !== fingerprint.ios.hash) diffChanged = true;
21283
- if (localFingerprint.android.hash !== fingerprint.android.hash) diffChanged = true;
21284
- await fs.promises.writeFile(path.join(getCwd(), "fingerprint.json"), JSON.stringify(fingerprint, null, 2));
21291
+ const newFingerprint = await createFingerprintData(config);
21292
+ const localFingerprint = await readLocalFingerprint();
21293
+ if (!localFingerprint || localFingerprint?.ios?.hash !== newFingerprint.ios.hash || localFingerprint?.android?.hash !== newFingerprint.android.hash) diffChanged = true;
21294
+ await fs.promises.writeFile(FINGERPRINT_FILE_PATH, JSON.stringify(newFingerprint, null, 2));
21285
21295
  return "Created fingerprint.json";
21286
21296
  }
21287
21297
  }]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.18.0",
4
+ "version": "0.18.1",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -58,9 +58,9 @@
58
58
  "es-git": "^0.2.0",
59
59
  "fast-xml-parser": "^5.2.3",
60
60
  "globby": "^14.1.0",
61
- "@hot-updater/core": "0.18.0",
62
- "@hot-updater/plugin-core": "0.18.0",
63
- "@hot-updater/console": "0.18.0"
61
+ "@hot-updater/console": "0.18.1",
62
+ "@hot-updater/core": "0.18.1",
63
+ "@hot-updater/plugin-core": "0.18.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@babel/core": "7.26.0",
@@ -87,10 +87,10 @@
87
87
  "read-package-up": "^11.0.0",
88
88
  "semver": "^7.6.3",
89
89
  "uuidv7": "^1.0.2",
90
- "@hot-updater/aws": "0.18.0",
91
- "@hot-updater/cloudflare": "0.18.0",
92
- "@hot-updater/firebase": "0.18.0",
93
- "@hot-updater/supabase": "0.18.0"
90
+ "@hot-updater/aws": "0.18.1",
91
+ "@hot-updater/cloudflare": "0.18.1",
92
+ "@hot-updater/firebase": "0.18.1",
93
+ "@hot-updater/supabase": "0.18.1"
94
94
  },
95
95
  "peerDependencies": {
96
96
  "@hot-updater/aws": "*",