@irfanshadikrishad/anilist 1.9.8 → 2.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.
- package/.husky/pre-commit +1 -1
- package/LICENSE.md +382 -0
- package/README.md +33 -42
- package/bin/helpers/auth.d.ts +31 -6
- package/bin/helpers/auth.js +536 -252
- package/bin/helpers/fetcher.d.ts +2 -2
- package/bin/helpers/fetcher.js +7 -6
- package/bin/helpers/lists.d.ts +41 -5
- package/bin/helpers/lists.js +356 -848
- package/bin/helpers/mutations.d.ts +2 -2
- package/bin/helpers/mutations.js +6 -9
- package/bin/helpers/queries.d.ts +4 -1
- package/bin/helpers/queries.js +35 -1
- package/bin/helpers/types.d.ts +53 -15
- package/bin/helpers/validation.d.ts +13 -4
- package/bin/helpers/validation.js +47 -56
- package/bin/helpers/workers.d.ts +9 -7
- package/bin/helpers/workers.js +34 -10
- package/bin/index.js +69 -93
- package/package.json +89 -92
- package/CITATION.cff +0 -8
- /package/bin/{lib → helpers/lib}/colorize.d.ts +0 -0
- /package/bin/{lib → helpers/lib}/colorize.js +0 -0
package/bin/index.js
CHANGED
|
@@ -8,22 +8,43 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var _a;
|
|
12
11
|
import { Command } from 'commander';
|
|
13
12
|
import process from 'process';
|
|
14
13
|
import { Auth, Social } from './helpers/auth.js';
|
|
15
|
-
import { AniList
|
|
14
|
+
import { AniList } from './helpers/lists.js';
|
|
16
15
|
import { getCurrentPackageVersion } from './helpers/workers.js';
|
|
17
16
|
const cli = new Command();
|
|
17
|
+
/**
|
|
18
|
+
* Dispatch to exactly one handler out of a set of mutually-exclusive options
|
|
19
|
+
* (eg: --anime/--manga, --follow/--unfollow/--inactive), optionally requiring login.
|
|
20
|
+
*/
|
|
21
|
+
function dispatchOneOf(options_1) {
|
|
22
|
+
return __awaiter(this, arguments, void 0, function* (options, { requireLogin = false } = {}) {
|
|
23
|
+
const selected = options.filter(({ flag }) => flag);
|
|
24
|
+
if (selected.length !== 1) {
|
|
25
|
+
const names = options.map(({ name }) => `--${name}`);
|
|
26
|
+
const optionList = names.length <= 2
|
|
27
|
+
? names.join(' or ')
|
|
28
|
+
: `${names.slice(0, -1).join(', ')} or ${names[names.length - 1]}`;
|
|
29
|
+
console.error(`\nMust select an option, either ${optionList}`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (requireLogin && !(yield Auth.isLoggedIn())) {
|
|
33
|
+
console.error(`\nPlease login to use this feature.`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
yield selected[0].handler();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
18
39
|
cli
|
|
19
40
|
.name('anilist')
|
|
20
41
|
.description('Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts.')
|
|
21
|
-
.version(
|
|
42
|
+
.version(getCurrentPackageVersion());
|
|
22
43
|
cli
|
|
23
44
|
.command('login')
|
|
24
45
|
.description('Login with AniList')
|
|
25
|
-
.requiredOption('-i, --id <number>',
|
|
26
|
-
.requiredOption('-s, --secret <string>',
|
|
46
|
+
.requiredOption('-i, --id <number>', null)
|
|
47
|
+
.requiredOption('-s, --secret <string>', null)
|
|
27
48
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ id, secret }) {
|
|
28
49
|
if (id && secret) {
|
|
29
50
|
yield Auth.Login(id, secret);
|
|
@@ -73,15 +94,10 @@ cli
|
|
|
73
94
|
.option('-a, --anime', 'For anime list of authenticated user', false)
|
|
74
95
|
.option('-m, --manga', 'For manga list of authenticated user', false)
|
|
75
96
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
yield AniList.MyAnime();
|
|
81
|
-
}
|
|
82
|
-
else if (manga) {
|
|
83
|
-
yield AniList.MyManga();
|
|
84
|
-
}
|
|
97
|
+
return dispatchOneOf([
|
|
98
|
+
{ flag: anime, name: 'anime', handler: AniList.MyAnime },
|
|
99
|
+
{ flag: manga, name: 'manga', handler: AniList.MyManga },
|
|
100
|
+
]);
|
|
85
101
|
}));
|
|
86
102
|
cli
|
|
87
103
|
.command('delete')
|
|
@@ -132,6 +148,7 @@ cli
|
|
|
132
148
|
cli
|
|
133
149
|
.command('manga <id>')
|
|
134
150
|
.description('Get manga details by their ID')
|
|
151
|
+
.option('-c, --count <number>', 'Number of items to get', '10')
|
|
135
152
|
.action((id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
153
|
yield AniList.getMangaDetailsByID(id);
|
|
137
154
|
}));
|
|
@@ -144,20 +161,18 @@ cli
|
|
|
144
161
|
.option('-m, --manga', 'To get the manga search results.', false)
|
|
145
162
|
.option('-c, --count <number>', 'Number of search results to show.', '10')
|
|
146
163
|
.action((query_1, _a) => __awaiter(void 0, [query_1, _a], void 0, function* (query, { anime, manga, count }) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
}
|
|
164
|
+
return dispatchOneOf([
|
|
165
|
+
{
|
|
166
|
+
flag: anime,
|
|
167
|
+
name: 'anime',
|
|
168
|
+
handler: () => AniList.searchAnime(query, Number(count)),
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
flag: manga,
|
|
172
|
+
name: 'manga',
|
|
173
|
+
handler: () => AniList.searchManga(query, Number(count)),
|
|
174
|
+
},
|
|
175
|
+
]);
|
|
161
176
|
}));
|
|
162
177
|
cli
|
|
163
178
|
.command('status <status>')
|
|
@@ -174,17 +189,10 @@ cli
|
|
|
174
189
|
.option('-a, --anime', 'To get the anime search results.', false)
|
|
175
190
|
.option('-m, --manga', 'To get the manga search results.', false)
|
|
176
191
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (anime) {
|
|
182
|
-
yield AniList.exportAnime();
|
|
183
|
-
}
|
|
184
|
-
else if (manga) {
|
|
185
|
-
yield AniList.exportManga();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
192
|
+
return dispatchOneOf([
|
|
193
|
+
{ flag: anime, name: 'anime', handler: AniList.exportAnime },
|
|
194
|
+
{ flag: manga, name: 'manga', handler: AniList.exportManga },
|
|
195
|
+
]);
|
|
188
196
|
}));
|
|
189
197
|
cli
|
|
190
198
|
.command('import')
|
|
@@ -193,22 +201,17 @@ cli
|
|
|
193
201
|
.option('-a, --anime', 'To get the anime search results.', false)
|
|
194
202
|
.option('-m, --manga', 'To get the manga search results.', false)
|
|
195
203
|
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
console.error(`\nPlease login to use this feature.`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
204
|
+
return dispatchOneOf([
|
|
205
|
+
{ flag: anime, name: 'anime', handler: Auth.callAnimeImporter },
|
|
206
|
+
{ flag: manga, name: 'manga', handler: Auth.callMangaImporter },
|
|
207
|
+
], { requireLogin: true });
|
|
208
|
+
}));
|
|
209
|
+
cli
|
|
210
|
+
.command('autolike')
|
|
211
|
+
.alias('al')
|
|
212
|
+
.description('Autolike following or global activities.')
|
|
213
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
+
yield Auth.AutoLike();
|
|
212
215
|
}));
|
|
213
216
|
cli
|
|
214
217
|
.command('social')
|
|
@@ -216,43 +219,16 @@ cli
|
|
|
216
219
|
.description('Automate your process')
|
|
217
220
|
.option('-f, --follow', 'Follow the user whos following you.', false)
|
|
218
221
|
.option('-u, --unfollow', 'Unfollow the user whos not following you.', false)
|
|
219
|
-
.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
console.error(`\nPlease login to use this feature.`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}));
|
|
237
|
-
cli
|
|
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
|
-
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ anime, manga }) {
|
|
244
|
-
if (!(yield Auth.isLoggedIn())) {
|
|
245
|
-
console.error(`\nPlease login to use this feature.`);
|
|
246
|
-
process.exit(1);
|
|
247
|
-
}
|
|
248
|
-
if ((!anime && !manga) || (anime && manga)) {
|
|
249
|
-
console.error(`\nMust select an option, either --anime or --manga`);
|
|
250
|
-
}
|
|
251
|
-
if (anime) {
|
|
252
|
-
yield MoveTo.AnimeList();
|
|
253
|
-
}
|
|
254
|
-
else if (manga) {
|
|
255
|
-
yield MoveTo.MangaList();
|
|
256
|
-
}
|
|
222
|
+
.option('-i, --inactive <months>', 'Unfollow users you follow with no activity in this many months')
|
|
223
|
+
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ follow, unfollow, inactive }) {
|
|
224
|
+
return dispatchOneOf([
|
|
225
|
+
{ flag: follow, name: 'follow', handler: Social.follow },
|
|
226
|
+
{ flag: unfollow, name: 'unfollow', handler: Social.unfollow },
|
|
227
|
+
{
|
|
228
|
+
flag: inactive !== undefined,
|
|
229
|
+
name: 'inactive <months>',
|
|
230
|
+
handler: () => Social.unfollowInactive(Number(inactive)),
|
|
231
|
+
},
|
|
232
|
+
], { requireLogin: true });
|
|
257
233
|
}));
|
|
258
234
|
cli.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,94 +1,91 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"publishConfig": {
|
|
92
|
-
"access": "public"
|
|
93
|
-
}
|
|
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
|
+
}
|
|
94
91
|
}
|
package/CITATION.cff
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
cff-version: 1.2.0
|
|
2
|
-
message: 'If you use this software, please cite it as below.'
|
|
3
|
-
title: '@irfanshadikrishad/anilist'
|
|
4
|
-
authors:
|
|
5
|
-
- name: 'Irfan Shadik Rishad'
|
|
6
|
-
orcid: '0009-0001-6745-5291'
|
|
7
|
-
date-released: '2024-10-12'
|
|
8
|
-
repository-code: 'https://github.com/irfanshadikrishad/anilist'
|
|
File without changes
|
|
File without changes
|