@ruby-fast/lsp 0.1.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/bin/ruby-fast-lsp +60 -0
- package/package.json +23 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
"darwin-arm64": "@ruby-fast/lsp-darwin-arm64",
|
|
9
|
+
"darwin-x64": "@ruby-fast/lsp-darwin-x64",
|
|
10
|
+
"linux-x64": "@ruby-fast/lsp-linux-x64",
|
|
11
|
+
"win32-x64": "@ruby-fast/lsp-win32-x64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function getBinaryPath() {
|
|
15
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
16
|
+
const pkg = PLATFORMS[platformKey];
|
|
17
|
+
|
|
18
|
+
if (!pkg) {
|
|
19
|
+
console.error(
|
|
20
|
+
`Unsupported platform: ${process.platform}-${process.arch}\n` +
|
|
21
|
+
`Supported: ${Object.keys(PLATFORMS).join(", ")}`
|
|
22
|
+
);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const pkgPath = require.resolve(`${pkg}/package.json`);
|
|
28
|
+
const pkgDir = path.dirname(pkgPath);
|
|
29
|
+
const binName =
|
|
30
|
+
process.platform === "win32" ? "ruby-fast-lsp.exe" : "ruby-fast-lsp";
|
|
31
|
+
const binPath = path.join(pkgDir, "bin", binName);
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(binPath)) {
|
|
34
|
+
console.error(`Binary not found at ${binPath}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return binPath;
|
|
39
|
+
} catch {
|
|
40
|
+
console.error(
|
|
41
|
+
`Platform package ${pkg} is not installed.\n` +
|
|
42
|
+
`Run: npm install ${pkg}`
|
|
43
|
+
);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const binPath = getBinaryPath();
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
execFileSync(binPath, process.argv.slice(2), {
|
|
52
|
+
stdio: "inherit",
|
|
53
|
+
env: process.env,
|
|
54
|
+
});
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err.status !== null) {
|
|
57
|
+
process.exit(err.status);
|
|
58
|
+
}
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ruby-fast/lsp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A fast Language Server Protocol implementation for Ruby",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/rajnaveen344/ruby-fast-lsp"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"ruby-fast-lsp": "bin/ruby-fast-lsp"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@ruby-fast/lsp-darwin-arm64": "0.1.0",
|
|
19
|
+
"@ruby-fast/lsp-darwin-x64": "0.1.0",
|
|
20
|
+
"@ruby-fast/lsp-linux-x64": "0.1.0",
|
|
21
|
+
"@ruby-fast/lsp-win32-x64": "0.1.0"
|
|
22
|
+
}
|
|
23
|
+
}
|