@irfanshadikrishad/anilist 2.0.0-forbidden.0 → 3.0.0-forbidden.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,3 @@
1
+ {
2
+ "outputStyle": "default"
3
+ }
package/.husky/pre-commit CHANGED
@@ -1,3 +1,3 @@
1
- npm run format
1
+ npm run build
2
2
  npm run test
3
- git add .
3
+ npx lint-staged
@@ -0,0 +1,4 @@
1
+ {
2
+ "*.{js,jsx,ts,tsx}": ["prettier --write"],
3
+ "*.{json,md,yml,yaml}": ["prettier --write"]
4
+ }
package/README.md CHANGED
@@ -268,4 +268,13 @@ Since you are creating your own API client for login no else else can get your c
268
268
 
269
269
  Want to contribute to the project? Check out complete guideline [here](CONTRIBUTING.md).
270
270
 
271
+ #### Publish
272
+
273
+ • Bump the version (since you have real changes since 2.0.0-forbidden was published, you can't republish that exact version):
274
+ `npm version prerelease --preid=forbidden --no-git-tag-version`
275
+ This takes 2.0.0-forbidden → 2.0.0-forbidden.0, matching the pattern of past releases (1.1.0-forbidden.0, .7, etc.).
276
+ • Build: `npm run build`
277
+ • Publish under the forbidden tag, not latest:
278
+ `npm publish --tag forbidden`
279
+
271
280
  #### _Thanks for visiting 💙_
@@ -18,6 +18,7 @@ import { exit } from 'process';
18
18
  import Spinner from 'tiny-spinner';
19
19
  import { fetcher } from './fetcher.js';
20
20
  import { colorize } from './lib/colorize.js';
21
+ import { rate_limit_time_ms, symbol_done, symbol_fail, symbol_neutral, } from './lib/constants.js';
21
22
  import { AniDB, AniList, MyAnimeList } from './lists.js';
22
23
  import { deleteActivityMutation, deleteMangaEntryMutation, deleteMediaEntryMutation, likeActivityMutation, saveTextActivityMutation, toggleFollowMutation, } from './mutations.js';
23
24
  import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activityMediaList, activityMessageQuery, activityTextQuery, currentUserAnimeList, currentUserMangaList, currentUserQuery, followingActivitiesQuery, globalActivitiesQuery, specificUserActivitiesQuery, userActivityQuery, userFollowersQuery, userFollowingQuery, userQuery, } from './queries.js';
@@ -319,9 +320,9 @@ Statistics (Manga):
319
320
  const isDeleted = (_f = (_e = deleteResponse === null || deleteResponse === void 0 ? void 0 : deleteResponse.data) === null || _e === void 0 ? void 0 : _e.DeleteActivity) === null || _f === void 0 ? void 0 : _f.deleted;
320
321
  count++;
321
322
  totalCount++;
322
- console.log(`[${count}/${activities.length}/${totalCount}]\t${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? colorize.Green('✔') : colorize.Red('✘')}`);
323
+ console.log(`[${count}/${activities.length}/${totalCount}]\t${act === null || act === void 0 ? void 0 : act.id} ${isDeleted ? symbol_done : symbol_fail}`);
323
324
  // Avoiding rate-limit
324
- yield sleep(1100);
325
+ yield sleep(rate_limit_time_ms);
325
326
  }
326
327
  }
327
328
  }
@@ -345,7 +346,7 @@ Statistics (Manga):
345
346
  const response = yield fetcher(mutation, { id });
346
347
  if (response === null || response === void 0 ? void 0 : response.data) {
347
348
  const deleted = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.DeleteMediaListEntry) === null || _b === void 0 ? void 0 : _b.deleted;
348
- console.log(`del ${title ? getTitle(title) : ''} ${deleted ? colorize.Green('✔') : colorize.Red('✘')}`);
349
+ console.log(`del ${title ? getTitle(title) : ''} ${deleted ? symbol_done : symbol_fail}`);
349
350
  }
350
351
  else {
351
352
  console.error(`\nError deleting entry. ${(_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}`);
@@ -408,7 +409,7 @@ Statistics (Manga):
408
409
  for (const [, entry] of selectedEntries.entries.entries()) {
409
410
  if (entry === null || entry === void 0 ? void 0 : entry.id) {
410
411
  yield deleteByIdFn(entry === null || entry === void 0 ? void 0 : entry.id, (_e = entry === null || entry === void 0 ? void 0 : entry.media) === null || _e === void 0 ? void 0 : _e.title);
411
- yield sleep(1100);
412
+ yield sleep(rate_limit_time_ms);
412
413
  }
413
414
  else {
414
415
  console.log(`No id in entry.`);
@@ -567,13 +568,13 @@ Statistics (Manga):
567
568
  likedCount++;
568
569
  }
569
570
  if (result === 'liked' || result === 'failed') {
570
- responsiveOutput(`${result === 'liked' ? colorize.Green('✔') : colorize.Red('✘')} ${activityBy(activ, likedCount)}`);
571
+ responsiveOutput(`${result === 'liked' ? symbol_done : symbol_fail} ${activityBy(activ, likedCount)}`);
571
572
  }
572
573
  else if (result === 'skipped') {
573
- responsiveOutput(`${colorize.Yellow('⚉')} ${activityBy(activ, likedCount)}`);
574
+ responsiveOutput(`${symbol_neutral} ${activityBy(activ, likedCount)}`);
574
575
  }
575
576
  // avoiding rate-limit
576
- yield sleep(2000);
577
+ yield sleep(rate_limit_time_ms);
577
578
  }
578
579
  page++;
579
580
  }
@@ -582,7 +583,7 @@ Statistics (Manga):
582
583
  spinner.start('Getting activities...');
583
584
  retryCount++;
584
585
  spinner.update(`Empty activities returned. Retrying... (${retryCount}/${maxRetries})`);
585
- yield sleep(2000);
586
+ yield sleep(rate_limit_time_ms);
586
587
  }
587
588
  else {
588
589
  spinner.error(`Probably the end of activities after ${maxRetries} retries.`);
@@ -616,13 +617,13 @@ Statistics (Manga):
616
617
  const result = yield Auth.attemptLikeActivity(activ);
617
618
  if (result === 'liked' || result === 'failed') {
618
619
  likedCount++;
619
- responsiveOutput(`${result === 'liked' ? colorize.Green('✔') : colorize.Red('✘')} ${activityBy(activ, likedCount)}`);
620
+ responsiveOutput(`${result === 'liked' ? symbol_done : symbol_fail} ${activityBy(activ, likedCount)}`);
620
621
  }
621
622
  else if (result === 'skipped') {
622
- responsiveOutput(`${colorize.Yellow('⚉')} ${activityBy(activ, likedCount)}`);
623
+ responsiveOutput(`${symbol_neutral} ${activityBy(activ, likedCount)}`);
623
624
  }
624
625
  // avoiding rate-limit
625
- yield sleep(1500);
626
+ yield sleep(rate_limit_time_ms);
626
627
  }
627
628
  page++;
628
629
  }
@@ -679,14 +680,14 @@ Statistics (Manga):
679
680
  const result = yield Auth.attemptLikeActivity(activ);
680
681
  if (result === 'liked' || result === 'failed') {
681
682
  likedCount++;
682
- responsiveOutput(`${result === 'liked' ? colorize.Green('✔') : colorize.Red('✘')} ${activityBy(activ, likedCount)}`);
683
+ responsiveOutput(`${result === 'liked' ? symbol_done : symbol_fail} ${activityBy(activ, likedCount)}`);
683
684
  if (likedCount >= toLikeAmount) {
684
685
  spinner.success(`Finished liking ${likedCount} activities of ${username}.`);
685
686
  return;
686
687
  }
687
688
  }
688
689
  else if (result === 'skipped') {
689
- responsiveOutput(`${colorize.Yellow('⚉')} ${activityBy(activ, likedCount)}`);
690
+ responsiveOutput(`${symbol_neutral} ${activityBy(activ, likedCount)}`);
690
691
  }
691
692
  }
692
693
  page += 1;
@@ -776,19 +777,19 @@ Statistics (Manga):
776
777
  const activ = activiti[i];
777
778
  const result = yield Auth.attemptLikeActivity(activ);
778
779
  if (result === 'liked' || result === 'failed') {
779
- responsiveOutput(`${result === 'liked' ? colorize.Green('✔') : colorize.Red('✘')} ${activityBy(activ, i + 1)}`);
780
+ responsiveOutput(`${result === 'liked' ? symbol_done : symbol_fail} ${activityBy(activ, i + 1)}`);
780
781
  if (result === 'liked') {
781
782
  liked++;
782
783
  }
783
784
  }
784
785
  else if (result === 'skipped') {
785
- responsiveOutput(`${colorize.Yellow('⚉')} ${activityBy(activ, i + 1)}`);
786
+ responsiveOutput(`${symbol_neutral} ${activityBy(activ, i + 1)}`);
786
787
  }
787
788
  // Avoid rate-limiting
788
- yield sleep(1200);
789
+ yield sleep(rate_limit_time_ms);
789
790
  }
790
791
  }
791
- console.log(`\n${colorize.Green('✔')} All ${liked} activities liked successfully.`);
792
+ console.log(`\n${symbol_done} All ${liked} activities liked successfully.`);
792
793
  }
793
794
  catch (error) {
794
795
  console.error(`\nError in LikeFollowingActivityV2: ${error.message}`);
@@ -883,7 +884,7 @@ class Social {
883
884
  for (const user of users) {
884
885
  try {
885
886
  const response = yield fetcher(toggleFollowMutation, { userId: user.id });
886
- console.log(`${String(`[${user.id}]`).padEnd(maxIdLength)}\t${String(`[${(_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.ToggleFollow) === null || _b === void 0 ? void 0 : _b.name}]`).padEnd(maxNameLength)}\t${((_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.ToggleFollow) === null || _d === void 0 ? void 0 : _d.id) ? colorize.Green('✔') : colorize.Red('✘')}`);
887
+ console.log(`${String(`[${user.id}]`).padEnd(maxIdLength)}\t${String(`[${(_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.ToggleFollow) === null || _b === void 0 ? void 0 : _b.name}]`).padEnd(maxNameLength)}\t${((_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.ToggleFollow) === null || _d === void 0 ? void 0 : _d.id) ? symbol_done : symbol_fail}`);
887
888
  if ((_f = (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.ToggleFollow) === null || _f === void 0 ? void 0 : _f.id) {
888
889
  toggled++;
889
890
  }
@@ -921,7 +922,7 @@ class Social {
921
922
  return;
922
923
  }
923
924
  const followedBack = yield Social.toggleFollowBatch(notFollowing);
924
- console.log(`\n${colorize.Green('✔')} Followed back ${followedBack} users.`);
925
+ console.log(`\n${symbol_done} Followed back ${followedBack} users.`);
925
926
  }
926
927
  catch (error) {
927
928
  console.log(`\nautomate_follow ${error.message}`);
@@ -954,8 +955,8 @@ class Social {
954
955
  }
955
956
  spinner.stop(`Unfollow process activated with ${notFollowingMe.length} users.`);
956
957
  console.log(`\n`);
957
- const unfollowedUsers = yield Social.toggleFollowBatch(notFollowingMe);
958
- console.log(`\n${colorize.Green('✔')} Total Unfollowed: ${unfollowedUsers} of ${notFollowingMe.length} users.`);
958
+ const unfollowed_users = yield Social.toggleFollowBatch(notFollowingMe);
959
+ console.log(`\n${symbol_done} Total Unfollowed: ${unfollowed_users} of ${notFollowingMe.length} users.`);
959
960
  }
960
961
  catch (error) {
961
962
  console.error(`\nautomate_unfollow: ${error.message}`);
@@ -984,29 +985,44 @@ class Social {
984
985
  });
985
986
  });
986
987
  spinner.stop(`Fetched ${allFollowingUsers.length} following user(s). Checking their last activity...`);
987
- const cutoff = Math.floor(Date.now() / 1000) - months * 30 * 24 * 60 * 60;
988
+ const inactivityWindow = months * 30 * 24 * 60 * 60;
989
+ const cutoff = Math.floor(Date.now() / 1000) - inactivityWindow;
990
+ // Users active within this many seconds *after* the cutoff are "almost"
991
+ // stale (within 20% of the inactivity window) and get a soft warning.
992
+ const nearCutoff = cutoff + inactivityWindow * 0.2;
988
993
  const staleUsers = [];
994
+ // Fixed-width columns so rows line up regardless of name/index length
995
+ const maxIndexLength = `[${allFollowingUsers.length}/${allFollowingUsers.length}]`.length;
996
+ const maxNameLength = Math.max(...allFollowingUsers.map(({ name }) => name.length));
989
997
  let checked = 0;
990
998
  for (const user of allFollowingUsers) {
991
999
  checked++;
992
1000
  const activityResponse = yield fetcher(specificUserActivitiesQuery, { userId: user.id, page: 1, perPage: 1 });
993
1001
  const lastActiveAt = (_d = (_c = (_b = (_a = activityResponse === null || activityResponse === void 0 ? void 0 : activityResponse.data) === null || _a === void 0 ? void 0 : _a.Page) === null || _b === void 0 ? void 0 : _b.activities) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.createdAt;
994
- responsiveOutput(`[${checked}/${allFollowingUsers.length}]\t${user.name}\t${lastActiveAt
1002
+ const isStale = !lastActiveAt || lastActiveAt < cutoff;
1003
+ const isNearStale = !isStale && lastActiveAt < nearCutoff;
1004
+ const activityLabel = lastActiveAt
995
1005
  ? timestampToTimeAgo(lastActiveAt)
996
- : 'no activity found'}`);
997
- if (!lastActiveAt || lastActiveAt < cutoff) {
1006
+ : 'no activity found';
1007
+ const coloredActivityLabel = isStale
1008
+ ? colorize.Red(activityLabel)
1009
+ : isNearStale
1010
+ ? colorize.Yellow(activityLabel)
1011
+ : activityLabel;
1012
+ responsiveOutput(`${`[${checked}/${allFollowingUsers.length}]`.padEnd(maxIndexLength)}\t${user.name.padEnd(maxNameLength)}\t${coloredActivityLabel}`);
1013
+ if (isStale) {
998
1014
  staleUsers.push({ id: user.id, name: user.name });
999
1015
  }
1000
1016
  // avoiding rate-limit
1001
- yield sleep(1100);
1017
+ yield sleep(rate_limit_time_ms);
1002
1018
  }
1003
1019
  console.log(`\nFound ${staleUsers.length} user(s) inactive for ${months}+ month(s).`);
1004
1020
  if (staleUsers.length <= 0) {
1005
1021
  console.log(`No stale accounts to unfollow.`);
1006
1022
  return;
1007
1023
  }
1008
- const unfollowedUsers = yield Social.toggleFollowBatch(staleUsers);
1009
- console.log(`\n${colorize.Green('✔')} Unfollowed ${unfollowedUsers} of ${staleUsers.length} inactive user(s).`);
1024
+ const unfollowed_users = yield Social.toggleFollowBatch(staleUsers);
1025
+ console.log(`\n${symbol_done} Unfollowed ${unfollowed_users} of ${staleUsers.length} inactive user(s).`);
1010
1026
  }
1011
1027
  catch (error) {
1012
1028
  console.error(`\nautomate_unfollow_inactive: ${error.message}`);
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Symbol indicating a successful operation, rendered in green.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * console.log(`${symbol_done} Build finished`)
7
+ * // ✔ Build finished (with ✔ in green)
8
+ * ```
9
+ */
10
+ export declare const symbol_done: string;
11
+ /**
12
+ * Symbol indicating a failed operation, rendered in red.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * console.error(`${symbol_fail} Build failed`)
17
+ * // ✘ Build failed (with ✘ in red)
18
+ * ```
19
+ */
20
+ export declare const symbol_fail: string;
21
+ /**
22
+ * Symbol for a neutral / informational state, rendered in yellow.
23
+ *
24
+ * Useful for warnings, skips, or notices that are neither pass nor fail.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * console.log(`${symbol_neutral} Skipping optional step`)
29
+ * // 🙼 Skipping optional step (with 🙼 in yellow)
30
+ * ```
31
+ */
32
+ export declare const symbol_neutral: string;
33
+ /**
34
+ * Rate limit time in milisecond
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * await sleep(rate_limit_time_ms)
39
+ * ```
40
+ */
41
+ export declare const rate_limit_time_ms = 1100;
@@ -0,0 +1,42 @@
1
+ import { colorize } from './colorize.js';
2
+ /**
3
+ * Symbol indicating a successful operation, rendered in green.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * console.log(`${symbol_done} Build finished`)
8
+ * // ✔ Build finished (with ✔ in green)
9
+ * ```
10
+ */
11
+ export const symbol_done = colorize.Green('✔');
12
+ /**
13
+ * Symbol indicating a failed operation, rendered in red.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * console.error(`${symbol_fail} Build failed`)
18
+ * // ✘ Build failed (with ✘ in red)
19
+ * ```
20
+ */
21
+ export const symbol_fail = colorize.Red('✘');
22
+ /**
23
+ * Symbol for a neutral / informational state, rendered in yellow.
24
+ *
25
+ * Useful for warnings, skips, or notices that are neither pass nor fail.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * console.log(`${symbol_neutral} Skipping optional step`)
30
+ * // 🙼 Skipping optional step (with 🙼 in yellow)
31
+ * ```
32
+ */
33
+ export const symbol_neutral = colorize.Yellow('🙼');
34
+ /**
35
+ * Rate limit time in milisecond
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * await sleep(rate_limit_time_ms)
40
+ * ```
41
+ */
42
+ export const rate_limit_time_ms = 1100;
package/package.json CHANGED
@@ -1,91 +1,100 @@
1
1
  {
2
- "name": "@irfanshadikrishad/anilist",
3
- "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
- "author": "Irfan Shadik Rishad",
5
- "version": "2.0.0-forbidden.0",
6
- "main": "./bin/index.js",
7
- "type": "module",
8
- "types": "./bin/index.d.ts",
9
- "bin": {
10
- "anilist": "./bin/index.js"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "scripts": {
16
- "build": "rm -rf ./bin && tsc",
17
- "build:watch": "rm -rf ./bin && tsc -w",
18
- "format": "prettier . --write",
19
- "format:check": "prettier . --check",
20
- "lint": "eslint ./dist",
21
- "lint:fix": "eslint ./dist --fix",
22
- "all": "npm run build && npm run lint && npm run lint:fix && npm run format && npm test",
23
- "test": "jest ./tests",
24
- "prepare": "husky"
25
- },
26
- "keywords": [
27
- "anilist",
28
- "CLI",
29
- "anime",
30
- "manga",
31
- "anime list",
32
- "manga list",
33
- "anime tracker",
34
- "manga tracker",
35
- "anilist API",
36
- "anime progress",
37
- "manga progress",
38
- "media list",
39
- "export anime",
40
- "import anime",
41
- "export manga",
42
- "import manga",
43
- "status tracker",
44
- "watchlist",
45
- "reading list",
46
- "graphql"
47
- ],
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/irfanshadikrishad/anilist"
51
- },
52
- "homepage": "https://github.com/irfanshadikrishad/anilist",
53
- "bugs": {
54
- "url": "https://github.com/irfanshadikrishad/anilist/issues"
55
- },
56
- "license": "MPL-2.0",
57
- "prettier": "@irfanshadikrishad/prettier",
58
- "devDependencies": {
59
- "@babel/preset-env": "^7.28.0",
60
- "@eslint/js": "^9.31.0",
61
- "@irfanshadikrishad/prettier": "^1.1.0",
62
- "@types/jest": "^30.0.0",
63
- "@types/node": "^24.0.14",
64
- "@types/papaparse": "^5.3.16",
65
- "@types/xml2js": "^0.4.14",
66
- "@typescript-eslint/eslint-plugin": "^8.37.0",
67
- "eslint": "^9.31.0",
68
- "globals": "^16.3.0",
69
- "husky": "^9.1.7",
70
- "jest": "^30.0.4",
71
- "prettier": "^3.6.2",
72
- "prettier-plugin-organize-imports": "^4.1.0",
73
- "ts-jest": "^29.4.0",
74
- "ts-node": "^10.9.2",
75
- "typescript": "^5.8.3"
76
- },
77
- "dependencies": {
78
- "@irfanshadikrishad/cipher": "^1.3.0",
79
- "chalk": "^5.4.1",
80
- "cli-truncate": "^4.0.0",
81
- "commander": "^14.0.0",
82
- "fast-xml-parser": "^5.2.5",
83
- "inquirer": "^12.7.0",
84
- "jsonrepair": "^3.13.0",
85
- "node-fetch": "^3.3.2",
86
- "open": "^10.2.0",
87
- "papaparse": "^5.5.3",
88
- "tiny-spinner": "^2.0.5",
89
- "xml2js": "^0.6.2"
90
- }
2
+ "name": "@irfanshadikrishad/anilist",
3
+ "description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
4
+ "version": "3.0.0-forbidden.0",
5
+ "author": "Irfan Shadik Rishad",
6
+ "license": "MPL-2.0",
7
+ "scripts": {
8
+ "all": "npm run build && npm run lint && npm run lint:fix && npm run format && npm test",
9
+ "build": "rm -rf ./bin && tsc",
10
+ "build:watch": "rm -rf ./bin && tsc -w",
11
+ "bump:major": "node scripts/bump.js major",
12
+ "bump:minor": "node scripts/bump.js minor",
13
+ "bump:patch": "node scripts/bump.js patch",
14
+ "bump:pre": "node scripts/bump.js prerelease",
15
+ "format": "prettier . --write",
16
+ "format:check": "prettier . --check",
17
+ "lint": "eslint ./dist",
18
+ "lint:fix": "eslint ./dist --fix",
19
+ "prepare": "husky",
20
+ "publish:forbidden": "npm publish --tag forbidden",
21
+ "test": "jest ./tests"
22
+ },
23
+ "keywords": [
24
+ "anilist",
25
+ "CLI",
26
+ "anime",
27
+ "manga",
28
+ "anime list",
29
+ "manga list",
30
+ "anime tracker",
31
+ "manga tracker",
32
+ "anilist API",
33
+ "anime progress",
34
+ "manga progress",
35
+ "media list",
36
+ "export anime",
37
+ "import anime",
38
+ "export manga",
39
+ "import manga",
40
+ "status tracker",
41
+ "watchlist",
42
+ "reading list",
43
+ "graphql"
44
+ ],
45
+ "homepage": "https://github.com/irfanshadikrishad/anilist",
46
+ "bugs": {
47
+ "url": "https://github.com/irfanshadikrishad/anilist/issues"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "https://github.com/irfanshadikrishad/anilist"
52
+ },
53
+ "type": "module",
54
+ "main": "./bin/index.js",
55
+ "types": "./bin/index.d.ts",
56
+ "bin": {
57
+ "anilist": "./bin/index.js"
58
+ },
59
+ "prettier": "@irfanshadikrishad/prettier",
60
+ "dependencies": {
61
+ "@irfanshadikrishad/cipher": "^1.7.2",
62
+ "chalk": "^5.6.2",
63
+ "cli-truncate": "^4.0.0",
64
+ "commander": "^14.0.3",
65
+ "fast-xml-parser": "^5.12.1",
66
+ "inquirer": "^12.11.1",
67
+ "jsonrepair": "^3.15.0",
68
+ "node-fetch": "^3.3.2",
69
+ "open": "^10.2.0",
70
+ "papaparse": "^5.7.1",
71
+ "tiny-spinner": "^2.0.5",
72
+ "xml2js": "^0.6.2"
73
+ },
74
+ "devDependencies": {
75
+ "@babel/preset-env": "^7.29.14",
76
+ "@eslint/js": "^9.39.5",
77
+ "@irfanshadikrishad/prettier": "^1.3.9",
78
+ "@types/jest": "^30.0.0",
79
+ "@types/node": "^24.19.4",
80
+ "@types/papaparse": "^5.5.2",
81
+ "@types/xml2js": "^0.4.14",
82
+ "@typescript-eslint/eslint-plugin": "^8.74.0",
83
+ "eslint": "^9.39.5",
84
+ "globals": "^16.5.0",
85
+ "husky": "^9.1.7",
86
+ "jest": "^30.5.2",
87
+ "lint-staged": "^17.6.2",
88
+ "prettier": "^3.10.1",
89
+ "prettier-plugin-organize-imports": "^4.3.0",
90
+ "ts-jest": "^29.4.15",
91
+ "ts-node": "^10.9.2",
92
+ "typescript": "^5.9.3"
93
+ },
94
+ "engines": {
95
+ "node": ">=22.0.0"
96
+ },
97
+ "publishConfig": {
98
+ "access": "public"
99
+ }
91
100
  }
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ import { execSync } from 'node:child_process'
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import process from 'node:process'
6
+
7
+ const type = process.argv[2] // major | minor | patch | prerelease
8
+ const preid = 'forbidden'
9
+
10
+ if (!['major', 'minor', 'patch', 'prerelease'].includes(type)) {
11
+ console.error('Usage: node scripts/bump.js <major|minor|patch|prerelease>')
12
+ process.exit(1)
13
+ }
14
+
15
+ const pkgPath = path.join(process.cwd(), 'package.json')
16
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
17
+ const oldVersion = pkg.version
18
+
19
+ const re = /^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z]+)\.(\d+))?$/
20
+ const m = oldVersion.match(re)
21
+ if (!m) {
22
+ console.error(`Cannot parse version "${oldVersion}"`)
23
+ process.exit(1)
24
+ }
25
+
26
+ let [, major, minor, patch, preTag, preNum] = m
27
+ major = Number(major)
28
+ minor = Number(minor)
29
+ patch = Number(patch)
30
+
31
+ let newVersion
32
+
33
+ switch (type) {
34
+ case 'major':
35
+ newVersion = `${major + 1}.0.0-${preid}.0`
36
+ break
37
+
38
+ case 'minor':
39
+ newVersion = `${major}.${minor + 1}.0-${preid}.0`
40
+ break
41
+
42
+ case 'patch':
43
+ newVersion = `${major}.${minor}.${patch + 1}-${preid}.0`
44
+ break
45
+
46
+ case 'prerelease':
47
+ if (preTag === preid) {
48
+ newVersion = `${major}.${minor}.${patch}-${preid}.${Number(preNum) + 1}`
49
+ } else {
50
+ newVersion = `${major}.${minor}.${patch}-${preid}.0`
51
+ }
52
+ break
53
+ }
54
+
55
+ console.log(`Bumping: ${oldVersion} → ${newVersion}`)
56
+
57
+ execSync(`npm version ${newVersion} --no-git-tag-version`, { stdio: 'inherit' })
package/LICENSE.md DELETED
@@ -1,382 +0,0 @@
1
- # Mozilla Public License Version 2.0
2
-
3
- 1. Definitions
4
-
5
- ---
6
-
7
- 1.1. "Contributor"
8
- means each individual or legal entity that creates, contributes to
9
- the creation of, or owns Covered Software.
10
-
11
- 1.2. "Contributor Version"
12
- means the combination of the Contributions of others (if any) used
13
- by a Contributor and that particular Contributor's Contribution.
14
-
15
- 1.3. "Contribution"
16
- means Covered Software of a particular Contributor.
17
-
18
- 1.4. "Covered Software"
19
- means Source Code Form to which the initial Contributor has attached
20
- the notice in Exhibit A, the Executable Form of such Source Code
21
- Form, and Modifications of such Source Code Form, in each case
22
- including portions thereof.
23
-
24
- 1.5. "Incompatible With Secondary Licenses"
25
- means
26
-
27
- (a) that the initial Contributor has attached the notice described
28
- in Exhibit B to the Covered Software; or
29
-
30
- (b) that the Covered Software was made available under the terms of
31
- version 1.1 or earlier of the License, but not also under the
32
- terms of a Secondary License.
33
-
34
- 1.6. "Executable Form"
35
- means any form of the work other than Source Code Form.
36
-
37
- 1.7. "Larger Work"
38
- means a work that combines Covered Software with other material, in
39
- a separate file or files, that is not Covered Software.
40
-
41
- 1.8. "License"
42
- means this document.
43
-
44
- 1.9. "Licensable"
45
- means having the right to grant, to the maximum extent possible,
46
- whether at the time of the initial grant or subsequently, any and
47
- all of the rights conveyed by this License.
48
-
49
- 1.10. "Modifications"
50
- means any of the following:
51
-
52
- (a) any file in Source Code Form that results from an addition to,
53
- deletion from, or modification of the contents of Covered
54
- Software; or
55
-
56
- (b) any new file in Source Code Form that contains any Covered
57
- Software.
58
-
59
- 1.11. "Patent Claims" of a Contributor
60
- means any patent claim(s), including without limitation, method,
61
- process, and apparatus claims, in any patent Licensable by such
62
- Contributor that would be infringed, but for the grant of the
63
- License, by the making, using, selling, offering for sale, having
64
- made, import, or transfer of either its Contributions or its
65
- Contributor Version.
66
-
67
- 1.12. "Secondary License"
68
- means either the GNU General Public License, Version 2.0, the GNU
69
- Lesser General Public License, Version 2.1, the GNU Affero General
70
- Public License, Version 3.0, or any later versions of those
71
- licenses.
72
-
73
- 1.13. "Source Code Form"
74
- means the form of the work preferred for making modifications.
75
-
76
- 1.14. "You" (or "Your")
77
- means an individual or a legal entity exercising rights under this
78
- License. For legal entities, "You" includes any entity that
79
- controls, is controlled by, or is under common control with You. For
80
- purposes of this definition, "control" means (a) the power, direct
81
- or indirect, to cause the direction or management of such entity,
82
- whether by contract or otherwise, or (b) ownership of more than
83
- fifty percent (50%) of the outstanding shares or beneficial
84
- ownership of such entity.
85
-
86
- 2. License Grants and Conditions
87
-
88
- ---
89
-
90
- 2.1. Grants
91
-
92
- Each Contributor hereby grants You a world-wide, royalty-free,
93
- non-exclusive license:
94
-
95
- (a) under intellectual property rights (other than patent or trademark)
96
- Licensable by such Contributor to use, reproduce, make available,
97
- modify, display, perform, distribute, and otherwise exploit its
98
- Contributions, either on an unmodified basis, with Modifications, or
99
- as part of a Larger Work; and
100
-
101
- (b) under Patent Claims of such Contributor to make, use, sell, offer
102
- for sale, have made, import, and otherwise transfer either its
103
- Contributions or its Contributor Version.
104
-
105
- 2.2. Effective Date
106
-
107
- The licenses granted in Section 2.1 with respect to any Contribution
108
- become effective for each Contribution on the date the Contributor first
109
- distributes such Contribution.
110
-
111
- 2.3. Limitations on Grant Scope
112
-
113
- The licenses granted in this Section 2 are the only rights granted under
114
- this License. No additional rights or licenses will be implied from the
115
- distribution or licensing of Covered Software under this License.
116
- Notwithstanding Section 2.1(b) above, no patent license is granted by a
117
- Contributor:
118
-
119
- (a) for any code that a Contributor has removed from Covered Software;
120
- or
121
-
122
- (b) for infringements caused by: (i) Your and any other third party's
123
- modifications of Covered Software, or (ii) the combination of its
124
- Contributions with other software (except as part of its Contributor
125
- Version); or
126
-
127
- (c) under Patent Claims infringed by Covered Software in the absence of
128
- its Contributions.
129
-
130
- This License does not grant any rights in the trademarks, service marks,
131
- or logos of any Contributor (except as may be necessary to comply with
132
- the notice requirements in Section 3.4).
133
-
134
- 2.4. Subsequent Licenses
135
-
136
- No Contributor makes additional grants as a result of Your choice to
137
- distribute the Covered Software under a subsequent version of this
138
- License (see Section 10.2) or under the terms of a Secondary License (if
139
- permitted under the terms of Section 3.3).
140
-
141
- 2.5. Representation
142
-
143
- Each Contributor represents that the Contributor believes its
144
- Contributions are its original creation(s) or it has sufficient rights
145
- to grant the rights to its Contributions conveyed by this License.
146
-
147
- 2.6. Fair Use
148
-
149
- This License is not intended to limit any rights You have under
150
- applicable copyright doctrines of fair use, fair dealing, or other
151
- equivalents.
152
-
153
- 2.7. Conditions
154
-
155
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
156
- in Section 2.1.
157
-
158
- 3. Responsibilities
159
-
160
- ---
161
-
162
- 3.1. Distribution of Source Form
163
-
164
- All distribution of Covered Software in Source Code Form, including any
165
- Modifications that You create or to which You contribute, must be under
166
- the terms of this License. You must inform recipients that the Source
167
- Code Form of the Covered Software is governed by the terms of this
168
- License, and how they can obtain a copy of this License. You may not
169
- attempt to alter or restrict the recipients' rights in the Source Code
170
- Form.
171
-
172
- 3.2. Distribution of Executable Form
173
-
174
- If You distribute Covered Software in Executable Form then:
175
-
176
- (a) such Covered Software must also be made available in Source Code
177
- Form, as described in Section 3.1, and You must inform recipients of
178
- the Executable Form how they can obtain a copy of such Source Code
179
- Form by reasonable means in a timely manner, at a charge no more
180
- than the cost of distribution to the recipient; and
181
-
182
- (b) You may distribute such Executable Form under the terms of this
183
- License, or sublicense it under different terms, provided that the
184
- license for the Executable Form does not attempt to limit or alter
185
- the recipients' rights in the Source Code Form under this License.
186
-
187
- 3.3. Distribution of a Larger Work
188
-
189
- You may create and distribute a Larger Work under terms of Your choice,
190
- provided that You also comply with the requirements of this License for
191
- the Covered Software. If the Larger Work is a combination of Covered
192
- Software with a work governed by one or more Secondary Licenses, and the
193
- Covered Software is not Incompatible With Secondary Licenses, this
194
- License permits You to additionally distribute such Covered Software
195
- under the terms of such Secondary License(s), so that the recipient of
196
- the Larger Work may, at their option, further distribute the Covered
197
- Software under the terms of either this License or such Secondary
198
- License(s).
199
-
200
- 3.4. Notices
201
-
202
- You may not remove or alter the substance of any license notices
203
- (including copyright notices, patent notices, disclaimers of warranty,
204
- or limitations of liability) contained within the Source Code Form of
205
- the Covered Software, except that You may alter any license notices to
206
- the extent required to remedy known factual inaccuracies.
207
-
208
- 3.5. Application of Additional Terms
209
-
210
- You may choose to offer, and to charge a fee for, warranty, support,
211
- indemnity or liability obligations to one or more recipients of Covered
212
- Software. However, You may do so only on Your own behalf, and not on
213
- behalf of any Contributor. You must make it absolutely clear that any
214
- such warranty, support, indemnity, or liability obligation is offered by
215
- You alone, and You hereby agree to indemnify every Contributor for any
216
- liability incurred by such Contributor as a result of warranty, support,
217
- indemnity or liability terms You offer. You may include additional
218
- disclaimers of warranty and limitations of liability specific to any
219
- jurisdiction.
220
-
221
- 4. Inability to Comply Due to Statute or Regulation
222
-
223
- ---
224
-
225
- If it is impossible for You to comply with any of the terms of this
226
- License with respect to some or all of the Covered Software due to
227
- statute, judicial order, or regulation then You must: (a) comply with
228
- the terms of this License to the maximum extent possible; and (b)
229
- describe the limitations and the code they affect. Such description must
230
- be placed in a text file included with all distributions of the Covered
231
- Software under this License. Except to the extent prohibited by statute
232
- or regulation, such description must be sufficiently detailed for a
233
- recipient of ordinary skill to be able to understand it.
234
-
235
- 5. Termination
236
-
237
- ---
238
-
239
- 5.1. The rights granted under this License will terminate automatically
240
- if You fail to comply with any of its terms. However, if You become
241
- compliant, then the rights granted under this License from a particular
242
- Contributor are reinstated (a) provisionally, unless and until such
243
- Contributor explicitly and finally terminates Your grants, and (b) on an
244
- ongoing basis, if such Contributor fails to notify You of the
245
- non-compliance by some reasonable means prior to 60 days after You have
246
- come back into compliance. Moreover, Your grants from a particular
247
- Contributor are reinstated on an ongoing basis if such Contributor
248
- notifies You of the non-compliance by some reasonable means, this is the
249
- first time You have received notice of non-compliance with this License
250
- from such Contributor, and You become compliant prior to 30 days after
251
- Your receipt of the notice.
252
-
253
- 5.2. If You initiate litigation against any entity by asserting a patent
254
- infringement claim (excluding declaratory judgment actions,
255
- counter-claims, and cross-claims) alleging that a Contributor Version
256
- directly or indirectly infringes any patent, then the rights granted to
257
- You by any and all Contributors for the Covered Software under Section
258
- 2.1 of this License shall terminate.
259
-
260
- 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
261
- end user license agreements (excluding distributors and resellers) which
262
- have been validly granted by You or Your distributors under this License
263
- prior to termination shall survive termination.
264
-
265
- ---
266
-
267
- - *
268
- - 6. Disclaimer of Warranty \*
269
- - ------------------------- \*
270
- - *
271
- - Covered Software is provided under this License on an "as is" \*
272
- - basis, without warranty of any kind, either expressed, implied, or \*
273
- - statutory, including, without limitation, warranties that the \*
274
- - Covered Software is free of defects, merchantable, fit for a \*
275
- - particular purpose or non-infringing. The entire risk as to the \*
276
- - quality and performance of the Covered Software is with You. \*
277
- - Should any Covered Software prove defective in any respect, You \*
278
- - (not any Contributor) assume the cost of any necessary servicing, \*
279
- - repair, or correction. This disclaimer of warranty constitutes an \*
280
- - essential part of this License. No use of any Covered Software is \*
281
- - authorized under this License except under this disclaimer. \*
282
- - *
283
-
284
- ---
285
-
286
- ---
287
-
288
- - *
289
- - 7. Limitation of Liability \*
290
- - -------------------------- \*
291
- - *
292
- - Under no circumstances and under no legal theory, whether tort \*
293
- - (including negligence), contract, or otherwise, shall any \*
294
- - Contributor, or anyone who distributes Covered Software as \*
295
- - permitted above, be liable to You for any direct, indirect, \*
296
- - special, incidental, or consequential damages of any character \*
297
- - including, without limitation, damages for lost profits, loss of \*
298
- - goodwill, work stoppage, computer failure or malfunction, or any \*
299
- - and all other commercial damages or losses, even if such party \*
300
- - shall have been informed of the possibility of such damages. This \*
301
- - limitation of liability shall not apply to liability for death or \*
302
- - personal injury resulting from such party's negligence to the \*
303
- - extent applicable law prohibits such limitation. Some \*
304
- - jurisdictions do not allow the exclusion or limitation of \*
305
- - incidental or consequential damages, so this exclusion and \*
306
- - limitation may not apply to You. \*
307
- - *
308
-
309
- ---
310
-
311
- 8. Litigation
312
-
313
- ---
314
-
315
- Any litigation relating to this License may be brought only in the
316
- courts of a jurisdiction where the defendant maintains its principal
317
- place of business and such litigation shall be governed by laws of that
318
- jurisdiction, without reference to its conflict-of-law provisions.
319
- Nothing in this Section shall prevent a party's ability to bring
320
- cross-claims or counter-claims.
321
-
322
- 9. Miscellaneous
323
-
324
- ---
325
-
326
- This License represents the complete agreement concerning the subject
327
- matter hereof. If any provision of this License is held to be
328
- unenforceable, such provision shall be reformed only to the extent
329
- necessary to make it enforceable. Any law or regulation which provides
330
- that the language of a contract shall be construed against the drafter
331
- shall not be used to construe this License against a Contributor.
332
-
333
- 10. Versions of the License
334
-
335
- ---
336
-
337
- 10.1. New Versions
338
-
339
- Mozilla Foundation is the license steward. Except as provided in Section
340
- 10.3, no one other than the license steward has the right to modify or
341
- publish new versions of this License. Each version will be given a
342
- distinguishing version number.
343
-
344
- 10.2. Effect of New Versions
345
-
346
- You may distribute the Covered Software under the terms of the version
347
- of the License under which You originally received the Covered Software,
348
- or under the terms of any subsequent version published by the license
349
- steward.
350
-
351
- 10.3. Modified Versions
352
-
353
- If you create software not governed by this License, and you want to
354
- create a new license for such software, you may create and use a
355
- modified version of this License if you rename the license and remove
356
- any references to the name of the license steward (except to note that
357
- such modified license differs from this License).
358
-
359
- 10.4. Distributing Source Code Form that is Incompatible With Secondary
360
- Licenses
361
-
362
- If You choose to distribute Source Code Form that is Incompatible With
363
- Secondary Licenses under the terms of this version of the License, the
364
- notice described in Exhibit B of this License must be attached.
365
-
366
- ## Exhibit A - Source Code Form License Notice
367
-
368
- This Source Code Form is subject to the terms of the Mozilla Public
369
- License, v. 2.0. If a copy of the MPL was not distributed with this
370
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
371
-
372
- If it is not possible or desirable to put the notice in a particular
373
- file, then You may include the notice in a location (such as a LICENSE
374
- file in a relevant directory) where a recipient would be likely to look
375
- for such a notice.
376
-
377
- You may add additional accurate notices of copyright ownership.
378
-
379
- ## Exhibit B - "Incompatible With Secondary Licenses" Notice
380
-
381
- This Source Code Form is "Incompatible With Secondary Licenses", as
382
- defined by the Mozilla Public License, v. 2.0.