@jmcomic/jmcomic 2.6.19-fix

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.
Files changed (3) hide show
  1. package/cli.js +7 -0
  2. package/index.js +49 -0
  3. package/package.json +29 -0
package/cli.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { run } from "./index.js"
3
+
4
+ // CLI 参数
5
+ const args = process.argv.slice(2)
6
+
7
+ run(args)
package/index.js ADDED
@@ -0,0 +1,49 @@
1
+ import path from "path"
2
+ import { execFileSync } from "child_process"
3
+
4
+ // 找 binary
5
+ function getBinary() {
6
+ const platform = process.platform
7
+
8
+ if (platform === "win32") {
9
+ const p = require.resolve("@kaguyajs/jmcomic-windows-x64")
10
+ return path.join(path.dirname(p), "bin/jmcomic.exe")
11
+ }
12
+
13
+ if (platform === "linux") {
14
+ try {
15
+ const p = require.resolve("@kaguyajs/jmcomic-linux-gnu")
16
+ return path.join(path.dirname(p), "bin/jmcomic")
17
+ } catch {
18
+ const p = require.resolve("@kaguyajs/jmcomic-linux-musl")
19
+ return path.join(path.dirname(p), "bin/jmcomic")
20
+ }
21
+ }
22
+
23
+ if (platform === "darwin") {
24
+ const p = require.resolve("@kaguyajs/jmcomic-macos-arm64")
25
+ return path.join(path.dirname(p), "bin/jmcomic")
26
+ }
27
+
28
+ throw new Error("Unsupported platform")
29
+ }
30
+
31
+ const bin = getBinary()
32
+
33
+ // 核心执行函数(API)
34
+ export function run(input) {
35
+ const argv = Array.isArray(input)
36
+ ? input
37
+ : String(input || "").trim().split(/\s+/)
38
+
39
+ execFileSync(bin, argv, {
40
+ stdio: "inherit"
41
+ })
42
+ }
43
+
44
+ // 给用户用的 API
45
+ export function jmcomic(input) {
46
+ return run(input)
47
+ }
48
+
49
+ export default jmcomic
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@jmcomic/jmcomic",
3
+ "version": "2.6.19-fix",
4
+ "keywords": [
5
+ "JMComic",
6
+ "禁漫",
7
+ "jm"
8
+ ],
9
+ "main": "index.js",
10
+ "bin": {
11
+ "jmcomic": "cli.js"
12
+ },
13
+ "author": "hect0x7,jmcomic",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/hect0x7/JMComic-Crawler-Python"
17
+ },
18
+ "license": "MIT",
19
+ "type": "module",
20
+ "files": [
21
+ "index.js"
22
+ ],
23
+ "optionalDependencies": {
24
+ "@jmcomic/jmcomic-linux-gnu": "2.6.19-hotfix",
25
+ "@jmcomic/jmcomic-linux-musl": "2.6.19-hotfix",
26
+ "@jmcomic/jmcomic-windows-x64": "2.6.19-hotfix",
27
+ "@jmcomic/jmcomic-macos-arm64": "2.6.19-hotfix"
28
+ }
29
+ }