@irfanshadikrishad/anilist 1.9.10 → 1.10.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.
@@ -0,0 +1 @@
1
+ npx --no -- commitlint --edit $1
package/README.md CHANGED
@@ -25,6 +25,10 @@ npm install -g @irfanshadikrishad/anilist
25
25
 
26
26
  This will install the package globally. And you have to use commands like
27
27
 
28
+ > [!IMPORTANT]
29
+ > Recommended to use the `forbidden` version for additional options and latest updates:
30
+ > `npm i -g @irfanshadikrishad/anilist@forbidden`
31
+
28
32
  ```bash
29
33
  anilist tr -c 15
30
34
  ```
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { Cipher } from '@irfanshadikrishad/cipher';
11
+ import { Logger } from '@irfanshadikrishad/logger';
11
12
  import fs from 'fs';
12
13
  import inquirer from 'inquirer';
13
14
  import open from 'open';
@@ -21,6 +22,7 @@ import { deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutat
21
22
  import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, } from './queries.js';
22
23
  import { responsiveOutput } from './truncate.js';
23
24
  import { aniListEndpoint, getTitle, redirectUri, timestampToTimeAgo, } from './workers.js';
25
+ const log = Logger.child('auth');
24
26
  const home_dir = os.homedir();
25
27
  const save_path = path.join(home_dir, '.anilist_tok3n');
26
28
  const spinner = new Spinner();
@@ -40,13 +42,13 @@ class Auth {
40
42
  },
41
43
  ]);
42
44
  if (!token) {
43
- console.warn('\nNo token entered. Please try again.');
45
+ log.WARN('No token entered. Please try again.');
44
46
  return null;
45
47
  }
46
48
  return token;
47
49
  }
48
50
  catch (error) {
49
- console.error(`\nAn error occurred while getting the access token: ${error.message}`);
51
+ log.ERROR(`An error occurred while getting the access token: ${error.message}`);
50
52
  return null;
51
53
  }
52
54
  });
@@ -55,13 +57,13 @@ class Auth {
55
57
  return __awaiter(this, void 0, void 0, function* () {
56
58
  try {
57
59
  if (!token) {
58
- console.warn('\nNo token provided. Nothing to store.');
60
+ log.WARN('No token provided. Nothing to store.');
59
61
  return;
60
62
  }
61
63
  fs.writeFileSync(save_path, vigenere.encrypt(token), { encoding: 'utf8' });
62
64
  }
63
65
  catch (error) {
64
- console.error(`\nError storing access token: ${error.message}`);
66
+ log.ERROR(`Error storing access token: ${error.message}`);
65
67
  }
66
68
  });
67
69
  }
@@ -76,7 +78,7 @@ class Auth {
76
78
  }
77
79
  }
78
80
  catch (error) {
79
- console.error(`\nError retrieving access token. ${error.message}`);
81
+ log.ERROR(`Error retrieving access token. ${error.message}`);
80
82
  return null;
81
83
  }
82
84
  });
@@ -191,17 +193,17 @@ Statistics (Manga):
191
193
  return user;
192
194
  }
193
195
  else {
194
- console.error(`\nSomething went wrong. Please log in again. ${(_5 = errors === null || errors === void 0 ? void 0 : errors[0]) === null || _5 === void 0 ? void 0 : _5.message}`);
196
+ log.ERROR(`Something went wrong. Please log in again. ${(_5 = errors === null || errors === void 0 ? void 0 : errors[0]) === null || _5 === void 0 ? void 0 : _5.message}`);
195
197
  return null;
196
198
  }
197
199
  }
198
200
  else {
199
- console.error(`\nPlease login first to use this feature.`);
201
+ log.ERROR(`Please login first to use this feature.`);
200
202
  return null;
201
203
  }
202
204
  }
203
205
  catch (error) {
204
- console.error(`\nError from Myself. ${error.message}`);
206
+ log.ERROR(`Error from Myself. ${error.message}`);
205
207
  }
206
208
  });
207
209
  }
@@ -212,7 +214,7 @@ Statistics (Manga):
212
214
  return token !== null;
213
215
  }
214
216
  catch (error) {
215
- console.error(`Error checking login status: ${error.message}`);
217
+ log.ERROR(`Error checking login status: ${error.message}`);
216
218
  return false;
217
219
  }
218
220
  });
@@ -487,15 +489,15 @@ Statistics (Manga):
487
489
  }
488
490
  }
489
491
  else {
490
- console.error('\nNo entries found.');
492
+ log.ERROR('\nNo entries found.');
491
493
  }
492
494
  }
493
495
  else {
494
- console.error(`\nNo manga(s) found in any list.`);
496
+ log.ERROR(`\nNo manga(s) found in any list.`);
495
497
  }
496
498
  }
497
499
  catch (error) {
498
- console.error(`\nError deleting manga. ${error.message}`);
500
+ log.ERROR(`\nError deleting manga. ${error.message}`);
499
501
  }
500
502
  });
501
503
  }
@@ -510,11 +512,11 @@ Statistics (Manga):
510
512
  console.log(`del ${statusMessage} ${deleted ? '✔' : '✘'}`);
511
513
  }
512
514
  else {
513
- console.error(`Error deleting manga. ${(_d = (_c = response === null || response === void 0 ? void 0 : response.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.message}`);
515
+ log.ERROR(`Error deleting manga. ${(_d = (_c = response === null || response === void 0 ? void 0 : response.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.message}`);
514
516
  }
515
517
  }
516
518
  catch (error) {
517
- console.error(`Error deleting manga. ${id} ${error instanceof Error ? error.message : error}`);
519
+ log.ERROR(`Error deleting manga. ${id} ${error instanceof Error ? error.message : error}`);
518
520
  }
519
521
  });
520
522
  }
@@ -529,7 +531,7 @@ Statistics (Manga):
529
531
  status: status,
530
532
  });
531
533
  if (!(response === null || response === void 0 ? void 0 : response.data)) {
532
- console.error(`\nSomething went wrong.`);
534
+ log.ERROR(`\nSomething went wrong.`);
533
535
  return;
534
536
  }
535
537
  if (response.data.SaveTextActivity.id) {
@@ -537,7 +539,7 @@ Statistics (Manga):
537
539
  }
538
540
  }
539
541
  catch (error) {
540
- console.error(`\n${error.message}`);
542
+ log.ERROR(`\n${error.message}`);
541
543
  }
542
544
  });
543
545
  }
@@ -573,7 +575,7 @@ Statistics (Manga):
573
575
  }
574
576
  }
575
577
  catch (error) {
576
- console.error(`\n${error.message}`);
578
+ log.ERROR(`\n${error.message}`);
577
579
  }
578
580
  });
579
581
  }
@@ -605,7 +607,7 @@ Statistics (Manga):
605
607
  }
606
608
  }
607
609
  catch (error) {
608
- console.error(`\n${error.message}`);
610
+ log.ERROR(`\n${error.message}`);
609
611
  }
610
612
  });
611
613
  }
@@ -660,13 +662,13 @@ class Social {
660
662
  }
661
663
  }
662
664
  catch (error) {
663
- console.log(`automate_follow_toggle_follow: ${error.message}`);
665
+ log.ERROR(`automate_follow_toggle_follow: ${error.message}`);
664
666
  }
665
667
  }
666
668
  console.log(`\n${colorize.Green('✔')} Followed back ${followedBack} users.`);
667
669
  }
668
670
  catch (error) {
669
- console.log(`\nautomate_follow ${error.message}`);
671
+ log.ERROR(`\nautomate_follow ${error.message}`);
670
672
  }
671
673
  });
672
674
  }
@@ -719,13 +721,13 @@ class Social {
719
721
  }
720
722
  }
721
723
  catch (error) {
722
- console.log(`unfollow_toggle_follow. ${error.message}`);
724
+ log.ERROR(`unfollow_toggle_follow. ${error.message}`);
723
725
  }
724
726
  }
725
727
  console.log(`\nTotal Unfollowed: ${unfollowedUsers} of ${nfmCount} users.`);
726
728
  }
727
729
  catch (error) {
728
- console.error(`\nautomate_unfollow: ${error.message}`);
730
+ log.ERROR(`\nautomate_unfollow: ${error.message}`);
729
731
  }
730
732
  });
731
733
  }
@@ -0,0 +1 @@
1
+ export default { extends: ['@commitlint/config-conventional'] }
@@ -0,0 +1,3 @@
1
+ {
2
+ "timestamp": false
3
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@irfanshadikrishad/anilist",
3
3
  "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
- "version": "1.9.10",
5
- "author": "Irfan Shadik Rishad",
4
+ "version": "1.10.0",
5
+ "author": "Irfan Shadik Rishad <hello@irfanshadikrishad.dev> (https://www.irfanshadikrishad.dev)",
6
6
  "license": "MPL-2.0",
7
7
  "scripts": {
8
8
  "all": "npm run build && npm run lint && npm run lint:fix && npm run format && npm test",
@@ -63,34 +63,37 @@
63
63
  },
64
64
  "prettier": "@irfanshadikrishad/prettier",
65
65
  "dependencies": {
66
- "@irfanshadikrishad/cipher": "^1.7.1",
67
- "chalk": "^6.0.0",
68
- "cli-truncate": "^6.1.1",
66
+ "@irfanshadikrishad/cipher": "^1.7.2",
67
+ "@irfanshadikrishad/logger": "^0.2.1",
68
+ "chalk": "^6.0.1",
69
+ "cli-truncate": "^6.2.0",
69
70
  "commander": "^14.0.3",
70
- "fast-xml-parser": "^5.11.1",
71
+ "fast-xml-parser": "^5.12.1",
71
72
  "inquirer": "^13.4.3",
72
73
  "jsonrepair": "^3.15.0",
73
74
  "open": "^11.0.4",
74
- "papaparse": "^5.7.0",
75
+ "papaparse": "^5.7.1",
75
76
  "tiny-spinner": "^2.0.5"
76
77
  },
77
78
  "devDependencies": {
78
- "@babel/preset-env": "^7.29.7",
79
+ "@babel/preset-env": "^7.29.14",
80
+ "@commitlint/cli": "^21.2.4",
81
+ "@commitlint/config-conventional": "^21.2.4",
79
82
  "@eslint/js": "^10.0.1",
80
- "@irfanshadikrishad/prettier": "^1.3.7",
83
+ "@irfanshadikrishad/prettier": "^1.3.9",
81
84
  "@types/jest": "^30.0.0",
82
- "@types/node": "^25.9.1",
85
+ "@types/node": "^25.9.12",
83
86
  "@types/papaparse": "^5.5.2",
84
- "@typescript-eslint/eslint-plugin": "^8.70.0",
85
- "@typescript-eslint/parser": "^8.66.0",
86
- "eslint": "^10.11.0",
87
- "globals": "^17.12.0",
87
+ "@typescript-eslint/eslint-plugin": "^8.74.0",
88
+ "@typescript-eslint/parser": "^8.74.0",
89
+ "eslint": "^10.15.0",
90
+ "globals": "^17.14.0",
88
91
  "husky": "^9.1.7",
89
92
  "jest": "^30.5.2",
90
- "lint-staged": "^17.5.1",
91
- "prettier": "^3.9.8",
93
+ "lint-staged": "^17.6.2",
94
+ "prettier": "^3.10.1",
92
95
  "prettier-plugin-organize-imports": "^4.3.0",
93
- "ts-jest": "^29.4.12",
96
+ "ts-jest": "^29.4.15",
94
97
  "ts-node": "^10.9.2",
95
98
  "typescript": "^6.0.3"
96
99
  },