@irfanshadikrishad/anilist 1.0.1 → 1.0.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/README.md +79 -16
- package/bin/helpers/auth.d.ts +4 -3
- package/bin/helpers/auth.js +45 -11
- package/bin/helpers/fetcher.d.ts +11 -1
- package/bin/helpers/fetcher.js +19 -1
- package/bin/helpers/lists.js +349 -100
- package/bin/helpers/more.d.ts +4 -1
- package/bin/helpers/more.js +202 -25
- package/bin/helpers/mutations.d.ts +4 -0
- package/bin/helpers/mutations.js +20 -0
- package/bin/helpers/queries.d.ts +20 -12
- package/bin/helpers/queries.js +98 -72
- package/bin/helpers/workers.js +3 -11
- package/bin/index.js +44 -11
- package/package.json +3 -3
- package/bin/helpers/colorize.d.ts +0 -5
- package/bin/helpers/colorize.js +0 -14
package/bin/index.js
CHANGED
|
@@ -11,9 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import { Command } from "commander";
|
|
12
12
|
import { anilistUserLogin, currentUserInfo, logoutUser, } from "./helpers/auth.js";
|
|
13
13
|
import { deleteAnimeCollection, deleteMangaCollection, getPopular, getTrending, getUpcomingAnimes, loggedInUsersAnimeLists, loggedInUsersMangaLists, } from "./helpers/lists.js";
|
|
14
|
-
import { getAnimeDetailsByID, getUserInfoByUsername } from "./helpers/more.js";
|
|
14
|
+
import { getAnimeDetailsByID, getAnimeSearchResults, getMangaSearchResults, deleteUserActivities, getUserInfoByUsername, } from "./helpers/more.js";
|
|
15
15
|
const cli = new Command();
|
|
16
|
-
cli.name("anilist").description("Unofficial AniList CLI").version("1.0.
|
|
16
|
+
cli.name("anilist").description("Unofficial AniList CLI").version("1.0.3");
|
|
17
17
|
cli
|
|
18
18
|
.command("login")
|
|
19
19
|
.description("Login with AniList")
|
|
@@ -50,10 +50,9 @@ cli
|
|
|
50
50
|
yield getPopular(Number(count));
|
|
51
51
|
}));
|
|
52
52
|
cli
|
|
53
|
-
.command("user")
|
|
53
|
+
.command("user <username>")
|
|
54
54
|
.description("Get user information")
|
|
55
|
-
.
|
|
56
|
-
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ username }) {
|
|
55
|
+
.action((username) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
56
|
yield getUserInfoByUsername(username);
|
|
58
57
|
}));
|
|
59
58
|
cli
|
|
@@ -82,19 +81,29 @@ cli
|
|
|
82
81
|
cli
|
|
83
82
|
.command("delete")
|
|
84
83
|
.alias("del")
|
|
85
|
-
.description("Delete entire collections of anime or
|
|
84
|
+
.description("Delete entire collections of anime or manga")
|
|
86
85
|
.option("-a, --anime", "For anime list of authenticated user", false)
|
|
87
86
|
.option("-m, --manga", "For manga list of authenticated user", false)
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
.option("-ac, --activity", "For activity of authenticated user", false)
|
|
88
|
+
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
|
|
89
|
+
const selectedOptions = [anime, manga, activity].filter(Boolean).length;
|
|
90
|
+
if (selectedOptions === 0) {
|
|
91
|
+
console.error(`Must select one option: either --anime, --manga, or --activity`);
|
|
92
|
+
process.exit(1);
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
if (selectedOptions > 1) {
|
|
95
|
+
console.error(`Only one option can be selected at a time: --anime, --manga, or --activity`);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
if (anime) {
|
|
93
99
|
yield deleteAnimeCollection();
|
|
94
100
|
}
|
|
95
101
|
else if (manga) {
|
|
96
102
|
yield deleteMangaCollection();
|
|
97
103
|
}
|
|
104
|
+
else if (activity) {
|
|
105
|
+
yield deleteUserActivities();
|
|
106
|
+
}
|
|
98
107
|
}));
|
|
99
108
|
cli
|
|
100
109
|
.command("upcoming")
|
|
@@ -105,7 +114,7 @@ cli
|
|
|
105
114
|
yield getUpcomingAnimes(Number(count));
|
|
106
115
|
}));
|
|
107
116
|
cli
|
|
108
|
-
.command("anime
|
|
117
|
+
.command("anime <id>")
|
|
109
118
|
.description("Get anime details by their ID")
|
|
110
119
|
.action((id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
120
|
if (id && !Number.isNaN(Number(id))) {
|
|
@@ -115,4 +124,28 @@ cli
|
|
|
115
124
|
console.error("Invalid or missing ID. Please provide a valid numeric ID.");
|
|
116
125
|
}
|
|
117
126
|
}));
|
|
127
|
+
cli
|
|
128
|
+
.command("search <query>")
|
|
129
|
+
.alias("srch")
|
|
130
|
+
.alias("find")
|
|
131
|
+
.description("Search anime or manga.")
|
|
132
|
+
.option("-a, --anime", "To get the anime search results.", false)
|
|
133
|
+
.option("-m, --manga", "To get the manga search results.", false)
|
|
134
|
+
.option("-c, --count <number>", "Number of search results to show.", "10")
|
|
135
|
+
.action((query_1, _a) => __awaiter(void 0, [query_1, _a], void 0, function* (query, { anime, manga, count }) {
|
|
136
|
+
if ((!anime && !manga) || (anime && manga)) {
|
|
137
|
+
console.error(`Must select an option, either --anime or --manga`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
if (anime) {
|
|
141
|
+
yield getAnimeSearchResults(query, Number(count));
|
|
142
|
+
}
|
|
143
|
+
else if (manga) {
|
|
144
|
+
yield getMangaSearchResults(query, Number(count));
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
console.error(`Must select an option, either --anime or --manga`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
118
151
|
cli.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@irfanshadikrishad/anilist",
|
|
3
3
|
"description": "Unofficial AniList CLI",
|
|
4
4
|
"author": "Irfan Shadik Rishad",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.3",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./bin/index.d.ts",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"type": "git",
|
|
24
24
|
"url": "https://github.com/irfanshadikrishad/anilist"
|
|
25
25
|
},
|
|
26
|
+
"homepage": "https://github.com/irfanshadikrishad/anilist",
|
|
26
27
|
"bugs": {
|
|
27
28
|
"url": "https://github.com/irfanshadikrishad/anilist/issues"
|
|
28
29
|
},
|
|
29
30
|
"license": "MPL-2.0",
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@types/node": "^22.7.
|
|
32
|
+
"@types/node": "^22.7.6",
|
|
32
33
|
"typescript": "^5.6.3"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"chalk": "^5.3.0",
|
|
36
36
|
"commander": "^12.1.0",
|
|
37
37
|
"inquirer": "^12.0.0",
|
|
38
38
|
"node-fetch": "^3.3.2",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare function colorize_Error(text: string): void;
|
|
2
|
-
declare function colorize_Anilist(text: string): string;
|
|
3
|
-
declare function colorize_Brown(text: string): string;
|
|
4
|
-
declare function colorize_Hex(text: string, hex: string): void;
|
|
5
|
-
export { colorize_Error, colorize_Anilist, colorize_Brown, colorize_Hex };
|
package/bin/helpers/colorize.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
function colorize_Error(text) {
|
|
3
|
-
console.log(chalk.red(text));
|
|
4
|
-
}
|
|
5
|
-
function colorize_Anilist(text) {
|
|
6
|
-
return chalk.hex("#03a8fc")(text);
|
|
7
|
-
}
|
|
8
|
-
function colorize_Brown(text) {
|
|
9
|
-
return chalk.hex("#ce9c69")(text);
|
|
10
|
-
}
|
|
11
|
-
function colorize_Hex(text, hex) {
|
|
12
|
-
console.log(chalk.hex(hex)(text));
|
|
13
|
-
}
|
|
14
|
-
export { colorize_Error, colorize_Anilist, colorize_Brown, colorize_Hex };
|