hot-updater 0.21.3 → 0.21.5

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
@@ -23,6 +23,8 @@ let node_util = require("node:util");
23
23
  node_util = require_picocolors$1.__toESM(node_util);
24
24
  let node_tty = require("node:tty");
25
25
  node_tty = require_picocolors$1.__toESM(node_tty);
26
+ let child_process = require("child_process");
27
+ child_process = require_picocolors$1.__toESM(child_process);
26
28
  let path = require("path");
27
29
  path = require_picocolors$1.__toESM(path);
28
30
  let fs = require("fs");
@@ -39,6 +41,8 @@ let node_stream = require("node:stream");
39
41
  node_stream = require_picocolors$1.__toESM(node_stream);
40
42
  let node_buffer = require("node:buffer");
41
43
  node_buffer = require_picocolors$1.__toESM(node_buffer);
44
+ let util = require("util");
45
+ util = require_picocolors$1.__toESM(util);
42
46
  let stream = require("stream");
43
47
  stream = require_picocolors$1.__toESM(stream);
44
48
  let node_fs_promises = require("node:fs/promises");
@@ -55,8 +59,6 @@ let __hot_updater_console = require("@hot-updater/console");
55
59
  __hot_updater_console = require_picocolors$1.__toESM(__hot_updater_console);
56
60
  let node_net = require("node:net");
57
61
  node_net = require_picocolors$1.__toESM(node_net);
58
- let es_git = require("es-git");
59
- es_git = require_picocolors$1.__toESM(es_git);
60
62
 
61
63
  //#region ../../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/error.js
62
64
  var require_error = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/error.js": ((exports) => {
@@ -14945,7 +14947,7 @@ var require_warning_messages = /* @__PURE__ */ require_picocolors$1.__commonJS({
14945
14947
  //#endregion
14946
14948
  //#region ../../node_modules/.pnpm/normalize-package-data@6.0.2/node_modules/normalize-package-data/lib/make_warning.js
14947
14949
  var require_make_warning = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node_modules/.pnpm/normalize-package-data@6.0.2/node_modules/normalize-package-data/lib/make_warning.js": ((exports, module) => {
14948
- var util$1 = require("util");
14950
+ var util$2 = require("util");
14949
14951
  var messages = require_warning_messages();
14950
14952
  module.exports = function() {
14951
14953
  var args = Array.prototype.slice.call(arguments, 0);
@@ -14954,7 +14956,7 @@ var require_make_warning = /* @__PURE__ */ require_picocolors$1.__commonJS({ "..
14954
14956
  else {
14955
14957
  var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'";
14956
14958
  args.unshift(msgTemplate);
14957
- return util$1.format.apply(null, args);
14959
+ return util$2.format.apply(null, args);
14958
14960
  }
14959
14961
  };
14960
14962
  function makeTypoWarning(providedName, probableName, field) {
@@ -14962,7 +14964,7 @@ var require_make_warning = /* @__PURE__ */ require_picocolors$1.__commonJS({ "..
14962
14964
  providedName = field + "['" + providedName + "']";
14963
14965
  probableName = field + "['" + probableName + "']";
14964
14966
  }
14965
- return util$1.format(messages.typo, providedName, probableName);
14967
+ return util$2.format(messages.typo, providedName, probableName);
14966
14968
  }
14967
14969
  }) });
14968
14970
 
@@ -16038,7 +16040,7 @@ var require_node = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node
16038
16040
  * Module dependencies.
16039
16041
  */
16040
16042
  const tty = require("tty");
16041
- const util = require("util");
16043
+ const util$1 = require("util");
16042
16044
  /**
16043
16045
  * This is the Node.js implementation of `debug()`.
16044
16046
  */
@@ -16048,7 +16050,7 @@ var require_node = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node
16048
16050
  exports.save = save;
16049
16051
  exports.load = load;
16050
16052
  exports.useColors = useColors;
16051
- exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
16053
+ exports.destroy = util$1.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
16052
16054
  /**
16053
16055
  * Colors.
16054
16056
  */
@@ -16189,7 +16191,7 @@ var require_node = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node
16189
16191
  * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
16190
16192
  */
16191
16193
  function log$1(...args) {
16192
- return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
16194
+ return process.stderr.write(util$1.formatWithOptions(exports.inspectOpts, ...args) + "\n");
16193
16195
  }
16194
16196
  /**
16195
16197
  * Save `namespaces`.
@@ -16228,14 +16230,14 @@ var require_node = /* @__PURE__ */ require_picocolors$1.__commonJS({ "../../node
16228
16230
  */
16229
16231
  formatters.o = function(v) {
16230
16232
  this.inspectOpts.colors = this.useColors;
16231
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
16233
+ return util$1.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
16232
16234
  };
16233
16235
  /**
16234
16236
  * Map %O to `util.inspect()`, allowing multiple lines if needed.
16235
16237
  */
16236
16238
  formatters.O = function(v) {
16237
16239
  this.inspectOpts.colors = this.useColors;
16238
- return util.inspect(v, this.inspectOpts);
16240
+ return util$1.inspect(v, this.inspectOpts);
16239
16241
  };
16240
16242
  }) });
16241
16243
 
@@ -34995,12 +34997,30 @@ const getFileHashFromFile = async (filepath) => {
34995
34997
 
34996
34998
  //#endregion
34997
34999
  //#region src/utils/git.ts
35000
+ const execAsync = (0, util.promisify)(child_process.exec);
35001
+ /**
35002
+ * Commit class compatible with es-git's Commit interface
35003
+ */
35004
+ var Commit = class {
35005
+ constructor(commitHash, commitMessage) {
35006
+ this.commitHash = commitHash;
35007
+ this.commitMessage = commitMessage;
35008
+ }
35009
+ id() {
35010
+ return this.commitHash;
35011
+ }
35012
+ summary() {
35013
+ return this.commitMessage;
35014
+ }
35015
+ };
34998
35016
  const getLatestGitCommit = async () => {
34999
35017
  try {
35000
- const repo = await (0, es_git.openRepository)((0, __hot_updater_plugin_core.getCwd)());
35001
- const headSha = repo.revparse("HEAD").from;
35002
- if (headSha) return repo.getCommit(headSha);
35003
- return null;
35018
+ const cwd = (0, __hot_updater_plugin_core.getCwd)();
35019
+ const { stdout: hash } = await execAsync("git rev-parse HEAD", { cwd });
35020
+ const commitHash = hash.trim();
35021
+ if (!commitHash) return null;
35022
+ const { stdout: message } = await execAsync("git log -1 --format=%s", { cwd });
35023
+ return new Commit(commitHash, message.trim() || null);
35004
35024
  } catch {
35005
35025
  return null;
35006
35026
  }
@@ -35223,7 +35243,7 @@ const deploy = async (options) => {
35223
35243
  gitCommitHash,
35224
35244
  message: options?.message ?? gitMessage,
35225
35245
  id: bundleId,
35226
- enabled: true,
35246
+ enabled: !options.disabled,
35227
35247
  channel,
35228
35248
  targetAppVersion: target.appVersion,
35229
35249
  fingerprintHash: target.fingerprintHash,
@@ -36339,7 +36359,7 @@ program.command("deploy").description("deploy a new version").addOption(platform
36339
36359
  process.exit(1);
36340
36360
  }
36341
36361
  return value;
36342
- })).addOption(new Option("-f, --force-update", "force update the app").default(false)).addOption(new Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(interactiveCommandOption).addOption(new Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
36362
+ })).addOption(new Option("-d, --disabled", "disable the update").default(false)).addOption(new Option("-f, --force-update", "force update the app").default(false)).addOption(new Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(interactiveCommandOption).addOption(new Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
36343
36363
  deploy(options);
36344
36364
  });
36345
36365
  program.command("console").description("open the console").action(async () => {
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import { fileURLToPath } from "node:url";
12
12
  import { StringDecoder } from "node:string_decoder";
13
13
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
14
14
  import tty from "node:tty";
15
+ import { exec } from "child_process";
15
16
  import path$1 from "path";
16
17
  import fs$1 from "fs";
17
18
  import { scheduler, setImmediate, setTimeout as setTimeout$1 } from "node:timers/promises";
@@ -20,6 +21,7 @@ import { serialize } from "node:v8";
20
21
  import { finished } from "node:stream/promises";
21
22
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
22
23
  import { Buffer as Buffer$1 } from "node:buffer";
24
+ import { promisify as promisify$1 } from "util";
23
25
  import { Readable as Readable$1 } from "stream";
24
26
  import fs$2, { constants as constants$1 } from "node:fs/promises";
25
27
  import fs$3 from "fs/promises";
@@ -28,7 +30,6 @@ import { createServer } from "http";
28
30
  import { Http2ServerRequest } from "http2";
29
31
  import app from "@hot-updater/console";
30
32
  import net from "node:net";
31
- import { openRepository } from "es-git";
32
33
 
33
34
  //#region ../../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/error.js
34
35
  var require_error = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/commander@14.0.0/node_modules/commander/lib/error.js": ((exports) => {
@@ -34973,12 +34974,30 @@ const getFileHashFromFile = async (filepath) => {
34973
34974
 
34974
34975
  //#endregion
34975
34976
  //#region src/utils/git.ts
34977
+ const execAsync = promisify$1(exec);
34978
+ /**
34979
+ * Commit class compatible with es-git's Commit interface
34980
+ */
34981
+ var Commit = class {
34982
+ constructor(commitHash, commitMessage) {
34983
+ this.commitHash = commitHash;
34984
+ this.commitMessage = commitMessage;
34985
+ }
34986
+ id() {
34987
+ return this.commitHash;
34988
+ }
34989
+ summary() {
34990
+ return this.commitMessage;
34991
+ }
34992
+ };
34976
34993
  const getLatestGitCommit = async () => {
34977
34994
  try {
34978
- const repo = await openRepository(getCwd());
34979
- const headSha = repo.revparse("HEAD").from;
34980
- if (headSha) return repo.getCommit(headSha);
34981
- return null;
34995
+ const cwd = getCwd();
34996
+ const { stdout: hash } = await execAsync("git rev-parse HEAD", { cwd });
34997
+ const commitHash = hash.trim();
34998
+ if (!commitHash) return null;
34999
+ const { stdout: message } = await execAsync("git log -1 --format=%s", { cwd });
35000
+ return new Commit(commitHash, message.trim() || null);
34982
35001
  } catch {
34983
35002
  return null;
34984
35003
  }
@@ -35201,7 +35220,7 @@ const deploy = async (options) => {
35201
35220
  gitCommitHash,
35202
35221
  message: options?.message ?? gitMessage,
35203
35222
  id: bundleId,
35204
- enabled: true,
35223
+ enabled: !options.disabled,
35205
35224
  channel,
35206
35225
  targetAppVersion: target.appVersion,
35207
35226
  fingerprintHash: target.fingerprintHash,
@@ -36317,7 +36336,7 @@ program.command("deploy").description("deploy a new version").addOption(platform
36317
36336
  process.exit(1);
36318
36337
  }
36319
36338
  return value;
36320
- })).addOption(new Option("-f, --force-update", "force update the app").default(false)).addOption(new Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(interactiveCommandOption).addOption(new Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
36339
+ })).addOption(new Option("-d, --disabled", "disable the update").default(false)).addOption(new Option("-f, --force-update", "force update the app").default(false)).addOption(new Option("-o, --bundle-output-path <bundleOutputPath>", "the path where the bundle.zip will be generated")).addOption(interactiveCommandOption).addOption(new Option("-c, --channel <channel>", "specify the channel to deploy").default(DEFAULT_CHANNEL)).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
36321
36340
  deploy(options);
36322
36341
  });
36323
36342
  program.command("console").description("open the console").action(async () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.21.3",
4
+ "version": "0.21.5",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -52,10 +52,9 @@
52
52
  "@expo/fingerprint": "0.13.4",
53
53
  "cosmiconfig": "9.0.0",
54
54
  "cosmiconfig-typescript-loader": "5.0.0",
55
- "es-git": "0.4.0",
56
- "@hot-updater/console": "0.21.3",
57
- "@hot-updater/core": "0.21.3",
58
- "@hot-updater/plugin-core": "0.21.3"
55
+ "@hot-updater/console": "0.21.5",
56
+ "@hot-updater/core": "0.21.5",
57
+ "@hot-updater/plugin-core": "0.21.5"
59
58
  },
60
59
  "devDependencies": {
61
60
  "semver": "^7.6.3",
@@ -86,11 +85,11 @@
86
85
  "plist": "^3.1.0",
87
86
  "read-package-up": "^11.0.0",
88
87
  "uuidv7": "^1.0.2",
89
- "@hot-updater/aws": "0.21.3",
90
- "@hot-updater/cloudflare": "0.21.3",
91
- "@hot-updater/firebase": "0.21.3",
92
- "@hot-updater/supabase": "0.21.3",
93
- "@hot-updater/test-utils": "0.21.3"
88
+ "@hot-updater/aws": "0.21.5",
89
+ "@hot-updater/cloudflare": "0.21.5",
90
+ "@hot-updater/firebase": "0.21.5",
91
+ "@hot-updater/test-utils": "0.21.5",
92
+ "@hot-updater/supabase": "0.21.5"
94
93
  },
95
94
  "peerDependencies": {
96
95
  "@hot-updater/aws": "*",