@quark-client/quark 1.4.2 → 1.4.4
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/bin/quark.js +43 -27
- package/package.json +6 -6
package/bin/quark.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const fs = require('fs');
|
|
6
|
-
const {
|
|
6
|
+
const { spawnSync } = require('child_process');
|
|
7
7
|
|
|
8
8
|
const platform = os.platform();
|
|
9
9
|
const arch = os.arch();
|
|
@@ -29,37 +29,53 @@ if (!pkgName) {
|
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const exeName = platform === 'win32' ? 'quark.exe' : 'quark';
|
|
33
|
+
|
|
34
|
+
// Locate the platform package directory without importing it as a module
|
|
35
|
+
// (it has no `main`). Resolving its package.json via the normal Node lookup
|
|
36
|
+
// from this file covers npm's nested layout
|
|
37
|
+
// (<main>/node_modules/@quark-client/...) and hoisted/flat layouts. The
|
|
38
|
+
// explicit candidates are a fallback for unusual layouts.
|
|
39
|
+
function findPackageDir() {
|
|
36
40
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
if (!found) throw new Error('package not found');
|
|
51
|
-
} catch (err) {
|
|
41
|
+
return path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
42
|
+
} catch {}
|
|
43
|
+
const mainPkgDir = path.resolve(__dirname, '..');
|
|
44
|
+
const candidates = [
|
|
45
|
+
path.join(mainPkgDir, 'node_modules', pkgName),
|
|
46
|
+
path.resolve(mainPkgDir, '..', '..', pkgName),
|
|
47
|
+
];
|
|
48
|
+
return candidates.find((d) => fs.existsSync(path.join(d, 'package.json')));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const pkgDir = findPackageDir();
|
|
52
|
+
if (!pkgDir) {
|
|
52
53
|
console.error(`quark: platform package not found (${pkgName})`);
|
|
53
54
|
console.error('This may happen if npm installed the main package without the matching platform package.');
|
|
54
55
|
console.error('Try: npm install -g @quark-client/quark@latest');
|
|
55
56
|
process.exit(1);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
const binPath = path.join(pkgDir, 'bin', exeName);
|
|
60
|
+
if (!fs.existsSync(binPath)) {
|
|
61
|
+
console.error(`quark: platform package ${pkgName} is installed at ${pkgDir}, but the executable is missing: ${binPath}`);
|
|
62
|
+
console.error('The installation may be corrupt (e.g. interrupted or blocked by antivirus).');
|
|
63
|
+
console.error('Try: npm uninstall -g @quark-client/quark && npm install -g @quark-client/quark@latest');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Pass arguments straight to the binary: no shell, so spaces, quotes, `&`,
|
|
68
|
+
// `|`, `$` etc. in arguments (URLs, JSON bodies, headers) arrive verbatim.
|
|
69
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
70
|
+
stdio: 'inherit',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (result.error) {
|
|
74
|
+
console.error(`quark: failed to run ${binPath}: ${result.error.message}`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
if (result.signal) {
|
|
78
|
+
// Re-raise so the parent shell sees the same signal (e.g. Ctrl+C).
|
|
79
|
+
process.kill(process.pid, result.signal);
|
|
65
80
|
}
|
|
81
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quark-client/quark",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "A local-first, keyboard-driven HTTP client",
|
|
5
5
|
"homepage": "https://github.com/crazy-vedic/Quark",
|
|
6
6
|
"repository": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">=16.0.0"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@quark-client/quark-linux-x64": "1.4.
|
|
25
|
-
"@quark-client/quark-linux-arm64": "1.4.
|
|
26
|
-
"@quark-client/quark-darwin-x64": "1.4.
|
|
27
|
-
"@quark-client/quark-darwin-arm64": "1.4.
|
|
28
|
-
"@quark-client/quark-win32-x64": "1.4.
|
|
24
|
+
"@quark-client/quark-linux-x64": "1.4.4",
|
|
25
|
+
"@quark-client/quark-linux-arm64": "1.4.4",
|
|
26
|
+
"@quark-client/quark-darwin-x64": "1.4.4",
|
|
27
|
+
"@quark-client/quark-darwin-arm64": "1.4.4",
|
|
28
|
+
"@quark-client/quark-win32-x64": "1.4.4"
|
|
29
29
|
}
|
|
30
30
|
}
|