@acidify/yogurt 0.1.0-dev.101

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 (2) hide show
  1. package/index.js +54 -0
  2. package/package.json +27 -0
package/index.js ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "child_process";
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const { platform, arch } = process;
11
+
12
+ const vendorRoot = path.join(__dirname, "node_modules", "@acidify", `yogurt-${platform}-${arch}`);
13
+ const yogurtBinaryName = process.platform === "win32" ? "yogurt.exe" : "yogurt.kexe";
14
+ const binaryPath = path.join(vendorRoot, yogurtBinaryName);
15
+
16
+ const child = spawn(binaryPath, [], {
17
+ stdio: "inherit",
18
+ });
19
+
20
+ child.on("error", (err) => {
21
+ console.error(err);
22
+ process.exit(1);
23
+ });
24
+
25
+ const forwardSignal = (signal) => {
26
+ if (child.killed) {
27
+ return;
28
+ }
29
+ try {
30
+ child.kill(signal);
31
+ } catch {
32
+ /* ignore */
33
+ }
34
+ };
35
+
36
+ ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
37
+ process.on(sig, () => forwardSignal(sig));
38
+ });
39
+
40
+ const childResult = await new Promise((resolve) => {
41
+ child.on("exit", (code, signal) => {
42
+ if (signal) {
43
+ resolve({ type: "signal", signal });
44
+ } else {
45
+ resolve({ type: "code", exitCode: code ?? 1 });
46
+ }
47
+ });
48
+ });
49
+
50
+ if (childResult.type === "signal") {
51
+ process.kill(process.pid, childResult.signal);
52
+ } else {
53
+ process.exit(childResult.exitCode);
54
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@acidify/yogurt",
3
+ "version": "0.1.0-dev.101",
4
+ "description": "Milky implementation based on Acidify",
5
+ "bin": {
6
+ "yogurt": "./index.js"
7
+ },
8
+ "keywords": [
9
+ "qq",
10
+ "oicq"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/LagrangeDev/acidify.git"
15
+ },
16
+ "homepage": "https://acidify.ntqqrev.org/",
17
+ "author": "LagrangeDev",
18
+ "license": "GPL-3.0-only",
19
+ "packageManager": "pnpm@10.26.0",
20
+ "optionalDependencies": {
21
+ "@acidify/yogurt-win32-x64": "0.1.0-dev.101",
22
+ "@acidify/yogurt-linux-x64": "0.1.0-dev.101",
23
+ "@acidify/yogurt-linux-arm64": "0.1.0-dev.101",
24
+ "@acidify/yogurt-darwin-x64": "0.1.0-dev.101",
25
+ "@acidify/yogurt-darwin-arm64": "0.1.0-dev.101"
26
+ }
27
+ }