@rslint/core 0.0.8 → 0.0.9
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/rslint.cjs +28 -0
- package/package.json +1 -1
package/bin/rslint.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const os = require('node:os');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
function getBinPath() {
|
|
6
|
+
if (fs.existsSync(path.resolve(__dirname, './rslint'))) {
|
|
7
|
+
return path.resolve(__dirname, './rslint');
|
|
8
|
+
}
|
|
9
|
+
let platformKey = `${process.platform}-${os.arch()}`;
|
|
10
|
+
return path.resolve(__dirname, `./rslint-${platformKey}`);
|
|
11
|
+
}
|
|
12
|
+
function main() {
|
|
13
|
+
const binPath = getBinPath();
|
|
14
|
+
try {
|
|
15
|
+
require('child_process').execFileSync(binPath, process.argv.slice(2), {
|
|
16
|
+
stdio: 'inherit',
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
// Preserve the exit code from the child process
|
|
20
|
+
if (error.status !== undefined) {
|
|
21
|
+
process.exit(error.status);
|
|
22
|
+
} else {
|
|
23
|
+
console.error(`Failed to execute ${binPath}: ${error.message}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
main();
|