@irfanshadikrishad/anilist 1.7.0 → 1.8.1
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/CITATION.cff +6 -6
- package/bin/helpers/auth.d.ts +1 -1
- package/bin/helpers/auth.js +80 -79
- package/bin/helpers/fetcher.js +7 -7
- package/bin/helpers/lists.js +196 -197
- package/bin/helpers/truncate.js +2 -2
- package/bin/helpers/types.d.ts +1 -1
- package/bin/helpers/validation.d.ts +2 -2
- package/bin/helpers/validation.js +11 -11
- package/bin/helpers/workers.d.ts +1 -1
- package/bin/helpers/workers.js +92 -92
- package/bin/index.js +77 -77
- package/bin/lib/colorize.d.ts +8 -0
- package/bin/lib/colorize.js +19 -0
- package/package.json +19 -15
package/bin/index.js
CHANGED
|
@@ -8,69 +8,69 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import { Command } from
|
|
12
|
-
import process from
|
|
13
|
-
import { Auth, Social } from
|
|
14
|
-
import { AniList, MoveTo } from
|
|
15
|
-
import { getCurrentPackageVersion } from
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
import process from 'process';
|
|
13
|
+
import { Auth, Social } from './helpers/auth.js';
|
|
14
|
+
import { AniList, MoveTo } from './helpers/lists.js';
|
|
15
|
+
import { getCurrentPackageVersion } from './helpers/workers.js';
|
|
16
16
|
const cli = new Command();
|
|
17
17
|
cli
|
|
18
|
-
.name(
|
|
19
|
-
.description(
|
|
18
|
+
.name('anilist')
|
|
19
|
+
.description('Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.')
|
|
20
20
|
.version(getCurrentPackageVersion());
|
|
21
21
|
cli
|
|
22
|
-
.command(
|
|
23
|
-
.description(
|
|
24
|
-
.requiredOption(
|
|
25
|
-
.requiredOption(
|
|
22
|
+
.command('login')
|
|
23
|
+
.description('Login with AniList')
|
|
24
|
+
.requiredOption('-i, --id <number>', null)
|
|
25
|
+
.requiredOption('-s, --secret <string>', null)
|
|
26
26
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ id, secret }) {
|
|
27
27
|
if (id && secret) {
|
|
28
28
|
yield Auth.Login(id, secret);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
console.log(
|
|
31
|
+
console.log('\nMust provide both ClientId and ClientSecret!');
|
|
32
32
|
}
|
|
33
33
|
}));
|
|
34
34
|
cli
|
|
35
|
-
.command(
|
|
36
|
-
.description(
|
|
35
|
+
.command('whoami')
|
|
36
|
+
.description('Get details of the logged in user')
|
|
37
37
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
38
|
yield Auth.Myself();
|
|
39
39
|
}));
|
|
40
40
|
cli
|
|
41
|
-
.command(
|
|
42
|
-
.alias(
|
|
43
|
-
.description(
|
|
44
|
-
.option(
|
|
41
|
+
.command('trending')
|
|
42
|
+
.alias('tr')
|
|
43
|
+
.description('Get the trending list from AniList')
|
|
44
|
+
.option('-c, --count <number>', 'Number of list items to get', '10')
|
|
45
45
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ count }) {
|
|
46
46
|
yield AniList.getTrendingAnime(Number(count));
|
|
47
47
|
}));
|
|
48
48
|
cli
|
|
49
|
-
.command(
|
|
50
|
-
.alias(
|
|
51
|
-
.description(
|
|
52
|
-
.option(
|
|
49
|
+
.command('popular')
|
|
50
|
+
.alias('plr')
|
|
51
|
+
.description('Get the popular list from AniList')
|
|
52
|
+
.option('-c, --count <number>', 'Number of list items to get', '10')
|
|
53
53
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ count }) {
|
|
54
54
|
yield AniList.getPopularAnime(Number(count));
|
|
55
55
|
}));
|
|
56
56
|
cli
|
|
57
|
-
.command(
|
|
58
|
-
.description(
|
|
57
|
+
.command('user <username>')
|
|
58
|
+
.description('Get user information')
|
|
59
59
|
.action((username) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
yield AniList.getUserByUsername(username);
|
|
61
61
|
}));
|
|
62
62
|
cli
|
|
63
|
-
.command(
|
|
64
|
-
.description(
|
|
63
|
+
.command('logout')
|
|
64
|
+
.description('Log out the current user.')
|
|
65
65
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
66
|
yield Auth.Logout();
|
|
67
67
|
}));
|
|
68
68
|
cli
|
|
69
|
-
.command(
|
|
70
|
-
.alias(
|
|
71
|
-
.description(
|
|
72
|
-
.option(
|
|
73
|
-
.option(
|
|
69
|
+
.command('lists')
|
|
70
|
+
.alias('ls')
|
|
71
|
+
.description('Get anime or manga list of authenticated user.')
|
|
72
|
+
.option('-a, --anime', 'For anime list of authenticated user', false)
|
|
73
|
+
.option('-m, --manga', 'For manga list of authenticated user', false)
|
|
74
74
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
75
75
|
if ((!anime && !manga) || (anime && manga)) {
|
|
76
76
|
console.error(`\nMust select an option, either --anime or --manga`);
|
|
@@ -83,12 +83,12 @@ cli
|
|
|
83
83
|
}
|
|
84
84
|
}));
|
|
85
85
|
cli
|
|
86
|
-
.command(
|
|
87
|
-
.alias(
|
|
88
|
-
.description(
|
|
89
|
-
.option(
|
|
90
|
-
.option(
|
|
91
|
-
.option(
|
|
86
|
+
.command('delete')
|
|
87
|
+
.alias('del')
|
|
88
|
+
.description('Delete entire collections of anime or manga')
|
|
89
|
+
.option('-a, --anime', 'For anime list of authenticated user', false)
|
|
90
|
+
.option('-m, --manga', 'For manga list of authenticated user', false)
|
|
91
|
+
.option('-s, --activity', 'For activity of authenticated user', false)
|
|
92
92
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga, activity }) {
|
|
93
93
|
const selectedOptions = [anime, manga, activity].filter(Boolean).length;
|
|
94
94
|
if (selectedOptions === 0) {
|
|
@@ -110,16 +110,16 @@ cli
|
|
|
110
110
|
}
|
|
111
111
|
}));
|
|
112
112
|
cli
|
|
113
|
-
.command(
|
|
114
|
-
.alias(
|
|
115
|
-
.description(
|
|
116
|
-
.option(
|
|
113
|
+
.command('upcoming')
|
|
114
|
+
.alias('up')
|
|
115
|
+
.description('Anime that will be released in upcoming season')
|
|
116
|
+
.option('-c, --count <number>', 'Number of items to get', '10')
|
|
117
117
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ count }) {
|
|
118
118
|
yield AniList.getUpcomingAnime(Number(count));
|
|
119
119
|
}));
|
|
120
120
|
cli
|
|
121
|
-
.command(
|
|
122
|
-
.description(
|
|
121
|
+
.command('anime <id>')
|
|
122
|
+
.description('Get anime details by their ID')
|
|
123
123
|
.action((id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
124
124
|
if (id && !Number.isNaN(Number(id))) {
|
|
125
125
|
yield AniList.getAnimeDetailsByID(Number(id));
|
|
@@ -129,20 +129,20 @@ cli
|
|
|
129
129
|
}
|
|
130
130
|
}));
|
|
131
131
|
cli
|
|
132
|
-
.command(
|
|
133
|
-
.description(
|
|
134
|
-
.option(
|
|
132
|
+
.command('manga <id>')
|
|
133
|
+
.description('Get manga details by their ID')
|
|
134
|
+
.option('-c, --count <number>', 'Number of items to get', '10')
|
|
135
135
|
.action((id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
136
|
yield AniList.getMangaDetailsByID(id);
|
|
137
137
|
}));
|
|
138
138
|
cli
|
|
139
|
-
.command(
|
|
140
|
-
.alias(
|
|
141
|
-
.alias(
|
|
142
|
-
.description(
|
|
143
|
-
.option(
|
|
144
|
-
.option(
|
|
145
|
-
.option(
|
|
139
|
+
.command('search <query>')
|
|
140
|
+
.alias('srch')
|
|
141
|
+
.alias('find')
|
|
142
|
+
.description('Search anime or manga.')
|
|
143
|
+
.option('-a, --anime', 'To get the anime search results.', false)
|
|
144
|
+
.option('-m, --manga', 'To get the manga search results.', false)
|
|
145
|
+
.option('-c, --count <number>', 'Number of search results to show.', '10')
|
|
146
146
|
.action((query_1, _a) => __awaiter(void 0, [query_1, _a], void 0, function* (query, { anime, manga, count }) {
|
|
147
147
|
if ((!anime && !manga) || (anime && manga)) {
|
|
148
148
|
console.error(`\nMust select an option, either --anime or --manga`);
|
|
@@ -160,19 +160,19 @@ cli
|
|
|
160
160
|
}
|
|
161
161
|
}));
|
|
162
162
|
cli
|
|
163
|
-
.command(
|
|
164
|
-
.alias(
|
|
165
|
-
.alias(
|
|
166
|
-
.description(
|
|
163
|
+
.command('status <status>')
|
|
164
|
+
.alias('post')
|
|
165
|
+
.alias('write')
|
|
166
|
+
.description('Write a status...')
|
|
167
167
|
.action((status) => __awaiter(void 0, void 0, void 0, function* () {
|
|
168
168
|
yield Auth.Write(status);
|
|
169
169
|
}));
|
|
170
170
|
cli
|
|
171
|
-
.command(
|
|
172
|
-
.alias(
|
|
173
|
-
.description(
|
|
174
|
-
.option(
|
|
175
|
-
.option(
|
|
171
|
+
.command('export')
|
|
172
|
+
.alias('exp')
|
|
173
|
+
.description('Export your anime or manga list.')
|
|
174
|
+
.option('-a, --anime', 'To get the anime search results.', false)
|
|
175
|
+
.option('-m, --manga', 'To get the manga search results.', false)
|
|
176
176
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
177
177
|
if ((!anime && !manga) || (anime && manga)) {
|
|
178
178
|
console.error(`\nMust select an option, either --anime or --manga`);
|
|
@@ -187,11 +187,11 @@ cli
|
|
|
187
187
|
}
|
|
188
188
|
}));
|
|
189
189
|
cli
|
|
190
|
-
.command(
|
|
191
|
-
.alias(
|
|
192
|
-
.description(
|
|
193
|
-
.option(
|
|
194
|
-
.option(
|
|
190
|
+
.command('import')
|
|
191
|
+
.alias('imp')
|
|
192
|
+
.description('Import your anime or manga from anilist or other sources.')
|
|
193
|
+
.option('-a, --anime', 'To get the anime search results.', false)
|
|
194
|
+
.option('-m, --manga', 'To get the manga search results.', false)
|
|
195
195
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
196
196
|
if ((!anime && !manga) || (anime && manga)) {
|
|
197
197
|
console.error(`\nMust select an option, either --anime or --manga`);
|
|
@@ -211,11 +211,11 @@ cli
|
|
|
211
211
|
}
|
|
212
212
|
}));
|
|
213
213
|
cli
|
|
214
|
-
.command(
|
|
215
|
-
.alias(
|
|
216
|
-
.description(
|
|
217
|
-
.option(
|
|
218
|
-
.option(
|
|
214
|
+
.command('social')
|
|
215
|
+
.alias('sol')
|
|
216
|
+
.description('Automate your process')
|
|
217
|
+
.option('-f, --follow', 'Follow the user whos following you.', false)
|
|
218
|
+
.option('-u, --unfollow', 'Unfollow the user whos not following you.', false)
|
|
219
219
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ follow, unfollow }) {
|
|
220
220
|
if (!follow && !unfollow) {
|
|
221
221
|
console.error(`\nMust select an option, either --follow or --unfollow`);
|
|
@@ -235,11 +235,11 @@ cli
|
|
|
235
235
|
}
|
|
236
236
|
}));
|
|
237
237
|
cli
|
|
238
|
-
.command(
|
|
239
|
-
.alias(
|
|
240
|
-
.description(
|
|
241
|
-
.option(
|
|
242
|
-
.option(
|
|
238
|
+
.command('move')
|
|
239
|
+
.alias('mv')
|
|
240
|
+
.description('Move anime or manga from one list to another')
|
|
241
|
+
.option('-a, --anime', 'To move anime lists.', false)
|
|
242
|
+
.option('-m, --manga', 'To move manga lists.', false)
|
|
243
243
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
244
244
|
if (!(yield Auth.isLoggedIn())) {
|
|
245
245
|
console.error(`\nPlease login to use this feature.`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
class colorize {
|
|
3
|
+
static Green(txt) {
|
|
4
|
+
return String(chalk.green(String(txt)));
|
|
5
|
+
}
|
|
6
|
+
static Red(txt) {
|
|
7
|
+
return String(chalk.red(String(txt)));
|
|
8
|
+
}
|
|
9
|
+
static Yellow(txt) {
|
|
10
|
+
return String(chalk.yellow(String(txt)));
|
|
11
|
+
}
|
|
12
|
+
static BgGreen(txt) {
|
|
13
|
+
return String(chalk.bgGreen(String(txt)));
|
|
14
|
+
}
|
|
15
|
+
static BgRed(txt) {
|
|
16
|
+
return String(chalk.bgRed(txt));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export { colorize };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@irfanshadikrishad/anilist",
|
|
3
3
|
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
4
|
"author": "Irfan Shadik Rishad",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.8.1",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./bin/index.d.ts",
|
|
@@ -53,32 +53,36 @@
|
|
|
53
53
|
"url": "https://github.com/irfanshadikrishad/anilist/issues"
|
|
54
54
|
},
|
|
55
55
|
"license": "MPL-2.0",
|
|
56
|
+
"prettier": "@irfanshadikrishad/prettier",
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@babel/preset-env": "^7.
|
|
58
|
-
"@eslint/js": "^9.
|
|
59
|
-
"@
|
|
60
|
-
"@types/
|
|
58
|
+
"@babel/preset-env": "^7.28.0",
|
|
59
|
+
"@eslint/js": "^9.31.0",
|
|
60
|
+
"@irfanshadikrishad/prettier": "^1.1.1",
|
|
61
|
+
"@types/jest": "^30.0.0",
|
|
62
|
+
"@types/node": "^24.0.15",
|
|
61
63
|
"@types/papaparse": "^5.3.16",
|
|
62
64
|
"@types/xml2js": "^0.4.14",
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
66
|
+
"@typescript-eslint/parser": "^8.37.0",
|
|
67
|
+
"eslint": "^9.31.0",
|
|
68
|
+
"globals": "^16.3.0",
|
|
69
|
+
"jest": "^30.0.4",
|
|
70
|
+
"prettier": "^3.6.2",
|
|
68
71
|
"prettier-plugin-organize-imports": "^4.1.0",
|
|
69
|
-
"ts-jest": "^29.
|
|
72
|
+
"ts-jest": "^29.4.0",
|
|
70
73
|
"ts-node": "^10.9.2",
|
|
71
74
|
"typescript": "^5.8.3"
|
|
72
75
|
},
|
|
73
76
|
"dependencies": {
|
|
74
|
-
"@irfanshadikrishad/cipher": "^1.
|
|
77
|
+
"@irfanshadikrishad/cipher": "^1.3.0",
|
|
78
|
+
"chalk": "^5.4.1",
|
|
75
79
|
"cli-truncate": "^4.0.0",
|
|
76
80
|
"commander": "^14.0.0",
|
|
77
81
|
"fast-xml-parser": "^5.2.5",
|
|
78
|
-
"inquirer": "^12.
|
|
79
|
-
"jsonrepair": "^3.
|
|
82
|
+
"inquirer": "^12.8.0",
|
|
83
|
+
"jsonrepair": "^3.13.0",
|
|
80
84
|
"node-fetch": "^3.3.2",
|
|
81
|
-
"open": "^10.
|
|
85
|
+
"open": "^10.2.0",
|
|
82
86
|
"papaparse": "^5.5.3",
|
|
83
87
|
"tiny-spinner": "^2.0.5",
|
|
84
88
|
"xml2js": "^0.6.2"
|