hot-updater 0.1.5 → 0.1.6-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.
@@ -27,12 +27,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.6.2_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js
31
31
  import { fileURLToPath } from "url";
32
32
  import path from "path";
33
33
  var getFilename, getDirname, __dirname;
34
34
  var init_esm_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.6.2_yaml@2.4.5/node_modules/tsup/assets/esm_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/esm_shims.js"() {
36
36
  "use strict";
37
37
  getFilename = () => fileURLToPath(import.meta.url);
38
38
  getDirname = () => path.dirname(getFilename());
package/dist/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-M76SRQA4.js";
3
+ } from "./chunk-P5MMNLL7.js";
4
4
 
5
5
  // src/config.ts
6
6
  init_esm_shims();
package/dist/index.cjs CHANGED
@@ -169,7 +169,7 @@ var getFileHashFromFile = async (filepath) => {
169
169
  }
170
170
  };
171
171
 
172
- // src/utils/getLatestGitCommitMessage.ts
172
+ // src/utils/git.ts
173
173
  var import_child_process2 = require("child_process");
174
174
  var getLatestGitCommitMessage = () => {
175
175
  return new Promise((resolve) => {
@@ -182,6 +182,17 @@ var getLatestGitCommitMessage = () => {
182
182
  });
183
183
  });
184
184
  };
185
+ var getGitCommitHash = () => {
186
+ return new Promise((resolve) => {
187
+ (0, import_child_process2.exec)("git rev-parse HEAD", (error, stdout) => {
188
+ if (error) {
189
+ resolve(null);
190
+ return;
191
+ }
192
+ resolve(stdout.trim());
193
+ });
194
+ });
195
+ };
185
196
 
186
197
  // src/commands/deploy.ts
187
198
  var import_plugin_core = require("@hot-updater/plugin-core");
@@ -194,7 +205,10 @@ var deploy = async (options) => {
194
205
  process.exit(1);
195
206
  }
196
207
  const cwd = (0, import_plugin_core.getCwd)();
197
- const message = await getLatestGitCommitMessage();
208
+ const [gitCommitHash, gitMessage] = await Promise.all([
209
+ getGitCommitHash(),
210
+ getLatestGitCommitMessage()
211
+ ]);
198
212
  const targetVersion = options.targetVersion ?? await getDefaultTargetVersion(cwd, options.platform);
199
213
  if (!targetVersion) {
200
214
  throw new Error(
@@ -209,7 +223,7 @@ var deploy = async (options) => {
209
223
  s.message("Checking existing updates...");
210
224
  await createZip(buildPath, "build.zip");
211
225
  const bundlePath = buildPath.concat(".zip");
212
- const hash = await getFileHashFromFile(bundlePath);
226
+ const fileHash = await getFileHashFromFile(bundlePath);
213
227
  const databasePlugin = config.database({
214
228
  cwd
215
229
  });
@@ -217,13 +231,14 @@ var deploy = async (options) => {
217
231
  const storagePlugin = config.storage({
218
232
  cwd
219
233
  });
220
- const { file } = await storagePlugin.uploadBundle(bundleId, bundlePath);
234
+ const { fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath);
221
235
  await databasePlugin.appendBundle({
222
236
  forceUpdate: options.forceUpdate,
223
237
  platform: options.platform,
224
- file,
225
- hash,
226
- message: message ?? void 0,
238
+ fileUrl,
239
+ fileHash,
240
+ gitCommitHash,
241
+ message: gitMessage,
227
242
  targetVersion,
228
243
  id: bundleId,
229
244
  enabled: true
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  __dirname,
4
4
  init_esm_shims
5
- } from "./chunk-M76SRQA4.js";
5
+ } from "./chunk-P5MMNLL7.js";
6
6
 
7
7
  // src/index.ts
8
8
  init_esm_shims();
@@ -158,7 +158,7 @@ var getFileHashFromFile = async (filepath) => {
158
158
  }
159
159
  };
160
160
 
161
- // src/utils/getLatestGitCommitMessage.ts
161
+ // src/utils/git.ts
162
162
  init_esm_shims();
163
163
  import { exec as exec2 } from "child_process";
164
164
  var getLatestGitCommitMessage = () => {
@@ -172,6 +172,17 @@ var getLatestGitCommitMessage = () => {
172
172
  });
173
173
  });
174
174
  };
175
+ var getGitCommitHash = () => {
176
+ return new Promise((resolve) => {
177
+ exec2("git rev-parse HEAD", (error, stdout) => {
178
+ if (error) {
179
+ resolve(null);
180
+ return;
181
+ }
182
+ resolve(stdout.trim());
183
+ });
184
+ });
185
+ };
175
186
 
176
187
  // src/commands/deploy.ts
177
188
  import { getCwd, loadConfig } from "@hot-updater/plugin-core";
@@ -184,7 +195,10 @@ var deploy = async (options) => {
184
195
  process.exit(1);
185
196
  }
186
197
  const cwd = getCwd();
187
- const message = await getLatestGitCommitMessage();
198
+ const [gitCommitHash, gitMessage] = await Promise.all([
199
+ getGitCommitHash(),
200
+ getLatestGitCommitMessage()
201
+ ]);
188
202
  const targetVersion = options.targetVersion ?? await getDefaultTargetVersion(cwd, options.platform);
189
203
  if (!targetVersion) {
190
204
  throw new Error(
@@ -199,7 +213,7 @@ var deploy = async (options) => {
199
213
  s.message("Checking existing updates...");
200
214
  await createZip(buildPath, "build.zip");
201
215
  const bundlePath = buildPath.concat(".zip");
202
- const hash = await getFileHashFromFile(bundlePath);
216
+ const fileHash = await getFileHashFromFile(bundlePath);
203
217
  const databasePlugin = config.database({
204
218
  cwd
205
219
  });
@@ -207,13 +221,14 @@ var deploy = async (options) => {
207
221
  const storagePlugin = config.storage({
208
222
  cwd
209
223
  });
210
- const { file } = await storagePlugin.uploadBundle(bundleId, bundlePath);
224
+ const { fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath);
211
225
  await databasePlugin.appendBundle({
212
226
  forceUpdate: options.forceUpdate,
213
227
  platform: options.platform,
214
- file,
215
- hash,
216
- message: message ?? void 0,
228
+ fileUrl,
229
+ fileHash,
230
+ gitCommitHash,
231
+ message: gitMessage,
217
232
  targetVersion,
218
233
  id: bundleId,
219
234
  enabled: true
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.6.2_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.6.2_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.42_@swc+helpers@0.5.15__jiti@1.21.6_postcss@8.4.47_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -15147,9 +15147,9 @@ __export(babel_exports, {
15147
15147
  module.exports = __toCommonJS(babel_exports);
15148
15148
  init_cjs_shims();
15149
15149
  var t = __toESM(require_lib3(), 1);
15150
- var NIL_UUID = "00000000-0000-0000-0000-000000000000";
15150
+ var import_core = require("@hot-updater/core");
15151
15151
  function replaceHotUpdaterBundleId() {
15152
- const bundleId = process.env["HOT_UPDATER_BUNDLE_ID"] ?? NIL_UUID;
15152
+ const bundleId = process.env["HOT_UPDATER_BUNDLE_ID"] ?? import_core.NIL_UUID;
15153
15153
  return {
15154
15154
  name: "replace-hot-updater-bundle-id",
15155
15155
  visitor: {
@@ -2,7 +2,7 @@ import {
2
2
  __commonJS,
3
3
  __toESM,
4
4
  init_esm_shims
5
- } from "../chunk-M76SRQA4.js";
5
+ } from "../chunk-P5MMNLL7.js";
6
6
 
7
7
  // ../../node_modules/.pnpm/@babel+types@7.26.0/node_modules/@babel/types/lib/utils/shallowEqual.js
8
8
  var require_shallowEqual = __commonJS({
@@ -15106,7 +15106,7 @@ var require_lib3 = __commonJS({
15106
15106
  // src/plugins/babel.ts
15107
15107
  init_esm_shims();
15108
15108
  var t = __toESM(require_lib3(), 1);
15109
- var NIL_UUID = "00000000-0000-0000-0000-000000000000";
15109
+ import { NIL_UUID } from "@hot-updater/core";
15110
15110
  function replaceHotUpdaterBundleId() {
15111
15111
  const bundleId = process.env["HOT_UPDATER_BUNDLE_ID"] ?? NIL_UUID;
15112
15112
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.6-0",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -40,9 +40,9 @@
40
40
  "dependencies": {
41
41
  "@clack/prompts": "^0.7.0",
42
42
  "@hono/node-server": "^1.13.4",
43
- "@hot-updater/console": "0.1.5",
44
- "@hot-updater/plugin-core": "0.1.5",
45
- "@hot-updater/utils": "0.1.5",
43
+ "@hot-updater/console": "0.1.6-0",
44
+ "@hot-updater/plugin-core": "0.1.6-0",
45
+ "@hot-updater/core": "0.1.6-0",
46
46
  "boxen": "^8.0.1",
47
47
  "commander": "^11.1.0",
48
48
  "cosmiconfig": "^9.0.0",