raykit 0.0.0-stage → 0.3.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/README.md +129 -2
- package/THIRD_PARTY_NOTICES.txt +1888 -0
- package/bin/raykit.mjs +33 -0
- package/lib/platform.mjs +16 -0
- package/native/raykit-darwin-amd64 +0 -0
- package/native/raykit-darwin-arm64 +0 -0
- package/native/raykit-linux-amd64 +0 -0
- package/native/raykit-linux-arm64 +0 -0
- package/native/raykit-windows-amd64.exe +0 -0
- package/package.json +22 -4
package/bin/raykit.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { constants } from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { binaryName } from '../lib/platform.mjs';
|
|
6
|
+
|
|
7
|
+
let executable;
|
|
8
|
+
try {
|
|
9
|
+
executable = fileURLToPath(new URL(`../native/${binaryName()}`, import.meta.url));
|
|
10
|
+
} catch (error) {
|
|
11
|
+
process.stderr.write(`raykit: ${error.message}\n`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const child = spawn(executable, process.argv.slice(2), { stdio: 'inherit', windowsHide: true });
|
|
16
|
+
const handlers = new Map();
|
|
17
|
+
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
18
|
+
const handler = () => child.kill(signal);
|
|
19
|
+
handlers.set(signal, handler);
|
|
20
|
+
process.on(signal, handler);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
child.once('error', (error) => {
|
|
24
|
+
process.stderr.write(`raykit: 无法启动内置程序(${error.code ?? 'unknown'}),请重新安装 npm 包。\n`);
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
child.once('close', (code, signal) => {
|
|
29
|
+
for (const [name, handler] of handlers) process.removeListener(name, handler);
|
|
30
|
+
if (code !== null) process.exitCode = code < 0 ? 1 : code;
|
|
31
|
+
else if (signal) process.exitCode = 128 + (constants.signals[signal] ?? 1);
|
|
32
|
+
else process.exitCode = 1;
|
|
33
|
+
});
|
package/lib/platform.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const targets = [
|
|
2
|
+
{ platform: 'darwin', arch: 'arm64', goos: 'darwin', goarch: 'arm64' },
|
|
3
|
+
{ platform: 'darwin', arch: 'x64', goos: 'darwin', goarch: 'amd64' },
|
|
4
|
+
{ platform: 'linux', arch: 'x64', goos: 'linux', goarch: 'amd64' },
|
|
5
|
+
{ platform: 'linux', arch: 'arm64', goos: 'linux', goarch: 'arm64' },
|
|
6
|
+
{ platform: 'win32', arch: 'x64', goos: 'windows', goarch: 'amd64' },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export function binaryName(platform = process.platform, arch = process.arch) {
|
|
10
|
+
const target = targets.find((entry) => entry.platform === platform && entry.arch === arch);
|
|
11
|
+
if (!target) {
|
|
12
|
+
throw new Error(`暂不支持 ${platform}/${arch};支持 macOS/Linux arm64、x64 和 Windows x64。`);
|
|
13
|
+
}
|
|
14
|
+
const extension = platform === 'win32' ? '.exe' : '';
|
|
15
|
+
return `raykit-${target.goos}-${target.goarch}${extension}`;
|
|
16
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raykit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Go-powered CLI for SQL queries and test database operations",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"kit": "bin/raykit.mjs",
|
|
12
|
+
"raykit": "bin/raykit.mjs"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/raykit.mjs",
|
|
16
|
+
"lib/platform.mjs",
|
|
17
|
+
"native/",
|
|
18
|
+
"THIRD_PARTY_NOTICES.txt"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"registry": "https://registry.npmjs.org/",
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|