hot-updater 0.6.2 → 0.6.3

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
@@ -22558,23 +22558,28 @@ export default HotUpdater.wrap({
22558
22558
  });
22559
22559
  auth = getWranglerLoginAuthToken();
22560
22560
  }
22561
- if (!auth) throw new Error("'npx wrangler login' is required to use this command");
22561
+ if (!auth) throw new Error("'wrangler login' is required to use this command");
22562
22562
  const cf = new Cloudflare({
22563
22563
  apiToken: auth.oauth_token
22564
22564
  });
22565
22565
  const createKey = `create/${Math.random().toString(36).substring(2, 15)}`;
22566
22566
  const accounts = [];
22567
- await prompts_namespaceObject.tasks([
22568
- {
22569
- title: "Checking Account List...",
22570
- task: async ()=>{
22571
- accounts.push(...(await cf.accounts.list()).result.map((account)=>({
22572
- id: account.id,
22573
- name: account.name
22574
- })));
22567
+ try {
22568
+ await prompts_namespaceObject.tasks([
22569
+ {
22570
+ title: "Checking Account List...",
22571
+ task: async ()=>{
22572
+ accounts.push(...(await cf.accounts.list()).result.map((account)=>({
22573
+ id: account.id,
22574
+ name: account.name
22575
+ })));
22576
+ }
22575
22577
  }
22576
- }
22577
- ]);
22578
+ ]);
22579
+ } catch (e) {
22580
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
22581
+ throw e;
22582
+ }
22578
22583
  const accountId = await prompts_namespaceObject.select({
22579
22584
  message: "Account List",
22580
22585
  options: accounts.map((account)=>({
@@ -22591,19 +22596,24 @@ export default HotUpdater.wrap({
22591
22596
  if (!apiToken) prompts_namespaceObject.log.warn("Skipping API Token. You can set it later in .env HOT_UPDATER_CLOUDFLARE_API_TOKEN file.");
22592
22597
  if (prompts_namespaceObject.isCancel(apiToken)) process.exit(1);
22593
22598
  const availableBuckets = [];
22594
- await prompts_namespaceObject.tasks([
22595
- {
22596
- title: "Checking R2 Buckets...",
22597
- task: async ()=>{
22598
- const buckets = (await cf.r2.buckets.list({
22599
- account_id: accountId
22600
- })).buckets ?? [];
22601
- availableBuckets.push(...buckets.filter((bucket)=>bucket.name).map((bucket)=>({
22602
- name: bucket.name
22603
- })));
22599
+ try {
22600
+ await prompts_namespaceObject.tasks([
22601
+ {
22602
+ title: "Checking R2 Buckets...",
22603
+ task: async ()=>{
22604
+ const buckets = (await cf.r2.buckets.list({
22605
+ account_id: accountId
22606
+ })).buckets ?? [];
22607
+ availableBuckets.push(...buckets.filter((bucket)=>bucket.name).map((bucket)=>({
22608
+ name: bucket.name
22609
+ })));
22610
+ }
22604
22611
  }
22605
- }
22606
- ]);
22612
+ ]);
22613
+ } catch (e) {
22614
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
22615
+ throw e;
22616
+ }
22607
22617
  let selectedBucketName = await prompts_namespaceObject.select({
22608
22618
  message: "R2 List",
22609
22619
  options: [
@@ -22634,32 +22644,42 @@ export default HotUpdater.wrap({
22634
22644
  const domains = await cf.r2.buckets.domains.managed.list(selectedBucketName, {
22635
22645
  account_id: accountId
22636
22646
  });
22637
- if (!domains.enabled) await prompts_namespaceObject.tasks([
22638
- {
22639
- title: "Making R2 bucket publicly accessible...",
22640
- task: async ()=>{
22641
- await cf.r2.buckets.domains.managed.update(selectedBucketName, {
22642
- account_id: accountId,
22643
- enabled: true
22644
- });
22647
+ if (!domains.enabled) try {
22648
+ await prompts_namespaceObject.tasks([
22649
+ {
22650
+ title: "Making R2 bucket publicly accessible...",
22651
+ task: async ()=>{
22652
+ await cf.r2.buckets.domains.managed.update(selectedBucketName, {
22653
+ account_id: accountId,
22654
+ enabled: true
22655
+ });
22656
+ }
22645
22657
  }
22646
- }
22647
- ]);
22658
+ ]);
22659
+ } catch (e) {
22660
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
22661
+ throw e;
22662
+ }
22648
22663
  const availableD1List = [];
22649
- await prompts_namespaceObject.tasks([
22650
- {
22651
- title: "Checking D1 List...",
22652
- task: async ()=>{
22653
- const d1List = (await cf.d1.database.list({
22654
- account_id: accountId
22655
- })).result ?? [];
22656
- availableD1List.push(...d1List.filter((d1)=>d1.name || d1.uuid).map((d1)=>({
22657
- name: d1.name,
22658
- uuid: d1.uuid
22659
- })));
22664
+ try {
22665
+ await prompts_namespaceObject.tasks([
22666
+ {
22667
+ title: "Checking D1 List...",
22668
+ task: async ()=>{
22669
+ const d1List = (await cf.d1.database.list({
22670
+ account_id: accountId
22671
+ })).result ?? [];
22672
+ availableD1List.push(...d1List.filter((d1)=>d1.name || d1.uuid).map((d1)=>({
22673
+ name: d1.name,
22674
+ uuid: d1.uuid
22675
+ })));
22676
+ }
22660
22677
  }
22661
- }
22662
- ]);
22678
+ ]);
22679
+ } catch (e) {
22680
+ if (e instanceof Error) prompts_namespaceObject.log.error(e.message);
22681
+ throw e;
22682
+ }
22663
22683
  let selectedD1DatabaseId = await prompts_namespaceObject.select({
22664
22684
  message: "D1 List",
22665
22685
  options: [
package/dist/index.js CHANGED
@@ -22451,23 +22451,28 @@ const initCloudflareD1R2Worker = async ()=>{
22451
22451
  });
22452
22452
  auth = getWranglerLoginAuthToken();
22453
22453
  }
22454
- if (!auth) throw new Error("'npx wrangler login' is required to use this command");
22454
+ if (!auth) throw new Error("'wrangler login' is required to use this command");
22455
22455
  const cf = new Cloudflare({
22456
22456
  apiToken: auth.oauth_token
22457
22457
  });
22458
22458
  const createKey = `create/${Math.random().toString(36).substring(2, 15)}`;
22459
22459
  const accounts = [];
22460
- await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22461
- {
22462
- title: "Checking Account List...",
22463
- task: async ()=>{
22464
- accounts.push(...(await cf.accounts.list()).result.map((account)=>({
22465
- id: account.id,
22466
- name: account.name
22467
- })));
22460
+ try {
22461
+ await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22462
+ {
22463
+ title: "Checking Account List...",
22464
+ task: async ()=>{
22465
+ accounts.push(...(await cf.accounts.list()).result.map((account)=>({
22466
+ id: account.id,
22467
+ name: account.name
22468
+ })));
22469
+ }
22468
22470
  }
22469
- }
22470
- ]);
22471
+ ]);
22472
+ } catch (e) {
22473
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
22474
+ throw e;
22475
+ }
22471
22476
  const accountId = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select({
22472
22477
  message: "Account List",
22473
22478
  options: accounts.map((account)=>({
@@ -22484,19 +22489,24 @@ const initCloudflareD1R2Worker = async ()=>{
22484
22489
  if (!apiToken) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.warn("Skipping API Token. You can set it later in .env HOT_UPDATER_CLOUDFLARE_API_TOKEN file.");
22485
22490
  if (__WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.isCancel(apiToken)) process.exit(1);
22486
22491
  const availableBuckets = [];
22487
- await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22488
- {
22489
- title: "Checking R2 Buckets...",
22490
- task: async ()=>{
22491
- const buckets = (await cf.r2.buckets.list({
22492
- account_id: accountId
22493
- })).buckets ?? [];
22494
- availableBuckets.push(...buckets.filter((bucket)=>bucket.name).map((bucket)=>({
22495
- name: bucket.name
22496
- })));
22492
+ try {
22493
+ await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22494
+ {
22495
+ title: "Checking R2 Buckets...",
22496
+ task: async ()=>{
22497
+ const buckets = (await cf.r2.buckets.list({
22498
+ account_id: accountId
22499
+ })).buckets ?? [];
22500
+ availableBuckets.push(...buckets.filter((bucket)=>bucket.name).map((bucket)=>({
22501
+ name: bucket.name
22502
+ })));
22503
+ }
22497
22504
  }
22498
- }
22499
- ]);
22505
+ ]);
22506
+ } catch (e) {
22507
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
22508
+ throw e;
22509
+ }
22500
22510
  let selectedBucketName = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select({
22501
22511
  message: "R2 List",
22502
22512
  options: [
@@ -22527,32 +22537,42 @@ const initCloudflareD1R2Worker = async ()=>{
22527
22537
  const domains = await cf.r2.buckets.domains.managed.list(selectedBucketName, {
22528
22538
  account_id: accountId
22529
22539
  });
22530
- if (!domains.enabled) await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22531
- {
22532
- title: "Making R2 bucket publicly accessible...",
22533
- task: async ()=>{
22534
- await cf.r2.buckets.domains.managed.update(selectedBucketName, {
22535
- account_id: accountId,
22536
- enabled: true
22537
- });
22540
+ if (!domains.enabled) try {
22541
+ await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22542
+ {
22543
+ title: "Making R2 bucket publicly accessible...",
22544
+ task: async ()=>{
22545
+ await cf.r2.buckets.domains.managed.update(selectedBucketName, {
22546
+ account_id: accountId,
22547
+ enabled: true
22548
+ });
22549
+ }
22538
22550
  }
22539
- }
22540
- ]);
22551
+ ]);
22552
+ } catch (e) {
22553
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
22554
+ throw e;
22555
+ }
22541
22556
  const availableD1List = [];
22542
- await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22543
- {
22544
- title: "Checking D1 List...",
22545
- task: async ()=>{
22546
- const d1List = (await cf.d1.database.list({
22547
- account_id: accountId
22548
- })).result ?? [];
22549
- availableD1List.push(...d1List.filter((d1)=>d1.name || d1.uuid).map((d1)=>({
22550
- name: d1.name,
22551
- uuid: d1.uuid
22552
- })));
22557
+ try {
22558
+ await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.tasks([
22559
+ {
22560
+ title: "Checking D1 List...",
22561
+ task: async ()=>{
22562
+ const d1List = (await cf.d1.database.list({
22563
+ account_id: accountId
22564
+ })).result ?? [];
22565
+ availableD1List.push(...d1List.filter((d1)=>d1.name || d1.uuid).map((d1)=>({
22566
+ name: d1.name,
22567
+ uuid: d1.uuid
22568
+ })));
22569
+ }
22553
22570
  }
22554
- }
22555
- ]);
22571
+ ]);
22572
+ } catch (e) {
22573
+ if (e instanceof Error) __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.log.error(e.message);
22574
+ throw e;
22575
+ }
22556
22576
  let selectedD1DatabaseId = await __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select({
22557
22577
  message: "D1 List",
22558
22578
  options: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hot-updater",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.3",
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.2",
53
- "@hot-updater/core": "0.6.2",
54
- "@hot-updater/plugin-core": "0.6.2",
52
+ "@hot-updater/console": "0.6.3",
53
+ "@hot-updater/core": "0.6.3",
54
+ "@hot-updater/plugin-core": "0.6.3",
55
55
  "commander": "^11.1.0",
56
56
  "cosmiconfig": "^9.0.0",
57
57
  "cosmiconfig-typescript-loader": "^5.0.0"