hot-updater 0.6.3 → 0.6.4

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
@@ -16116,7 +16116,12 @@ var __webpack_exports__ = {};
16116
16116
  title: `📦 Uploading to Storage (${storagePlugin.name})`,
16117
16117
  task: async ()=>{
16118
16118
  if (!bundleId) throw new Error("Bundle ID not found");
16119
- ({ fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath));
16119
+ try {
16120
+ ({ fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath));
16121
+ } catch (e) {
16122
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
16123
+ throw new Error("Failed to upload bundle to storage");
16124
+ }
16120
16125
  return `✅ Upload Complete (${storagePlugin.name})`;
16121
16126
  }
16122
16127
  },
@@ -16124,18 +16129,23 @@ var __webpack_exports__ = {};
16124
16129
  title: `📦 Updating Database (${databasePlugin.name})`,
16125
16130
  task: async ()=>{
16126
16131
  if (!bundleId) throw new Error("Bundle ID not found");
16127
- await databasePlugin.appendBundle({
16128
- shouldForceUpdate: options.forceUpdate,
16129
- platform,
16130
- fileUrl,
16131
- fileHash,
16132
- gitCommitHash,
16133
- message: gitMessage,
16134
- targetAppVersion,
16135
- id: bundleId,
16136
- enabled: true
16137
- });
16138
- await databasePlugin.commitBundle();
16132
+ try {
16133
+ await databasePlugin.appendBundle({
16134
+ shouldForceUpdate: options.forceUpdate,
16135
+ platform,
16136
+ fileUrl,
16137
+ fileHash,
16138
+ gitCommitHash,
16139
+ message: gitMessage,
16140
+ targetAppVersion,
16141
+ id: bundleId,
16142
+ enabled: true
16143
+ });
16144
+ await databasePlugin.commitBundle();
16145
+ } catch (e) {
16146
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
16147
+ throw new Error("Failed to update database");
16148
+ }
16139
16149
  await databasePlugin.onUnmount?.();
16140
16150
  await promises_default().rm(bundlePath);
16141
16151
  return `✅ Update Complete (${databasePlugin.name})`;
@@ -22502,7 +22512,7 @@ function App() {
22502
22512
  export default HotUpdater.wrap({
22503
22513
  source: "%%source%%",
22504
22514
  })(App);`;
22505
- const deployWorker = async (oauth_token, { d1DatabaseId, d1DatabaseName })=>{
22515
+ const deployWorker = async (oauth_token, accountId, { d1DatabaseId, d1DatabaseName })=>{
22506
22516
  const workerPath = require.resolve("@hot-updater/cloudflare/worker");
22507
22517
  const workerDir = external_path_default().dirname(workerPath);
22508
22518
  const { tmpDir, removeTmpDir } = await (0, plugin_core_namespaceObject.copyDirToTmp)(workerDir);
@@ -22520,7 +22530,8 @@ export default HotUpdater.wrap({
22520
22530
  const wrangler = await createWrangler({
22521
22531
  stdio: "inherit",
22522
22532
  cloudflareApiToken: oauth_token,
22523
- cwd: tmpDir
22533
+ cwd: tmpDir,
22534
+ accountId: accountId
22524
22535
  });
22525
22536
  await wrangler("d1", "migrations", "apply", d1DatabaseName, "--remote");
22526
22537
  const workerName = await prompts_namespaceObject.text({
@@ -22558,7 +22569,7 @@ export default HotUpdater.wrap({
22558
22569
  });
22559
22570
  auth = getWranglerLoginAuthToken();
22560
22571
  }
22561
- if (!auth) throw new Error("'wrangler login' is required to use this command");
22572
+ if (!auth) throw new Error("'npx wrangler login' is required to use this command");
22562
22573
  const cf = new Cloudflare({
22563
22574
  apiToken: auth.oauth_token
22564
22575
  });
@@ -22716,7 +22727,7 @@ export default HotUpdater.wrap({
22716
22727
  const subdomains = await cf.workers.subdomains.get({
22717
22728
  account_id: accountId
22718
22729
  });
22719
- const workerName = await deployWorker(auth.oauth_token, {
22730
+ const workerName = await deployWorker(auth.oauth_token, accountId, {
22720
22731
  d1DatabaseId: selectedD1DatabaseId,
22721
22732
  d1DatabaseName
22722
22733
  });
package/dist/index.js CHANGED
@@ -16015,7 +16015,12 @@ const deploy = async (options)=>{
16015
16015
  title: `📦 Uploading to Storage (${storagePlugin.name})`,
16016
16016
  task: async ()=>{
16017
16017
  if (!bundleId) throw new Error("Bundle ID not found");
16018
- ({ fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath));
16018
+ try {
16019
+ ({ fileUrl } = await storagePlugin.uploadBundle(bundleId, bundlePath));
16020
+ } catch (e) {
16021
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
16022
+ throw new Error("Failed to upload bundle to storage");
16023
+ }
16019
16024
  return `✅ Upload Complete (${storagePlugin.name})`;
16020
16025
  }
16021
16026
  },
@@ -16023,18 +16028,23 @@ const deploy = async (options)=>{
16023
16028
  title: `📦 Updating Database (${databasePlugin.name})`,
16024
16029
  task: async ()=>{
16025
16030
  if (!bundleId) throw new Error("Bundle ID not found");
16026
- await databasePlugin.appendBundle({
16027
- shouldForceUpdate: options.forceUpdate,
16028
- platform,
16029
- fileUrl,
16030
- fileHash,
16031
- gitCommitHash,
16032
- message: gitMessage,
16033
- targetAppVersion,
16034
- id: bundleId,
16035
- enabled: true
16036
- });
16037
- await databasePlugin.commitBundle();
16031
+ try {
16032
+ await databasePlugin.appendBundle({
16033
+ shouldForceUpdate: options.forceUpdate,
16034
+ platform,
16035
+ fileUrl,
16036
+ fileHash,
16037
+ gitCommitHash,
16038
+ message: gitMessage,
16039
+ targetAppVersion,
16040
+ id: bundleId,
16041
+ enabled: true
16042
+ });
16043
+ await databasePlugin.commitBundle();
16044
+ } catch (e) {
16045
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
16046
+ throw new Error("Failed to update database");
16047
+ }
16038
16048
  await databasePlugin.onUnmount?.();
16039
16049
  await __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__["default"].rm(bundlePath);
16040
16050
  return `✅ Update Complete (${databasePlugin.name})`;
@@ -22395,7 +22405,7 @@ function App() {
22395
22405
  export default HotUpdater.wrap({
22396
22406
  source: "%%source%%",
22397
22407
  })(App);`;
22398
- const deployWorker = async (oauth_token, { d1DatabaseId, d1DatabaseName })=>{
22408
+ const deployWorker = async (oauth_token, accountId, { d1DatabaseId, d1DatabaseName })=>{
22399
22409
  const workerPath = require.resolve("@hot-updater/cloudflare/worker");
22400
22410
  const workerDir = external_path_["default"].dirname(workerPath);
22401
22411
  const { tmpDir, removeTmpDir } = await (0, __WEBPACK_EXTERNAL_MODULE__hot_updater_plugin_core_40c1c502__.copyDirToTmp)(workerDir);
@@ -22413,7 +22423,8 @@ const deployWorker = async (oauth_token, { d1DatabaseId, d1DatabaseName })=>{
22413
22423
  const wrangler = await createWrangler({
22414
22424
  stdio: "inherit",
22415
22425
  cloudflareApiToken: oauth_token,
22416
- cwd: tmpDir
22426
+ cwd: tmpDir,
22427
+ accountId: accountId
22417
22428
  });
22418
22429
  await wrangler("d1", "migrations", "apply", d1DatabaseName, "--remote");
22419
22430
  const workerName = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.text({
@@ -22451,7 +22462,7 @@ const initCloudflareD1R2Worker = async ()=>{
22451
22462
  });
22452
22463
  auth = getWranglerLoginAuthToken();
22453
22464
  }
22454
- if (!auth) throw new Error("'wrangler login' is required to use this command");
22465
+ if (!auth) throw new Error("'npx wrangler login' is required to use this command");
22455
22466
  const cf = new Cloudflare({
22456
22467
  apiToken: auth.oauth_token
22457
22468
  });
@@ -22609,7 +22620,7 @@ const initCloudflareD1R2Worker = async ()=>{
22609
22620
  const subdomains = await cf.workers.subdomains.get({
22610
22621
  account_id: accountId
22611
22622
  });
22612
- const workerName = await deployWorker(auth.oauth_token, {
22623
+ const workerName = await deployWorker(auth.oauth_token, accountId, {
22613
22624
  d1DatabaseId: selectedD1DatabaseId,
22614
22625
  d1DatabaseName
22615
22626
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "bin": {
6
6
  "hot-updater": "./dist/index.js"
7
7
  },
@@ -49,9 +49,9 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@clack/prompts": "^0.9.0",
52
- "@hot-updater/console": "0.6.3",
53
- "@hot-updater/core": "0.6.3",
54
- "@hot-updater/plugin-core": "0.6.3",
52
+ "@hot-updater/console": "0.6.4",
53
+ "@hot-updater/core": "0.6.4",
54
+ "@hot-updater/plugin-core": "0.6.4",
55
55
  "commander": "^11.1.0",
56
56
  "cosmiconfig": "^9.0.0",
57
57
  "cosmiconfig-typescript-loader": "^5.0.0"