@rivolink/leaf 1.10.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/bin/leaf.js +43 -0
- package/package.json +35 -0
package/bin/leaf.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { spawnSync } = require("child_process");
|
|
5
|
+
|
|
6
|
+
const PLATFORM_PACKAGES = {
|
|
7
|
+
"linux-x64": "@rivolink/leaf-linux-x64",
|
|
8
|
+
"linux-arm64": "@rivolink/leaf-linux-arm64",
|
|
9
|
+
"darwin-x64": "@rivolink/leaf-darwin-x64",
|
|
10
|
+
"darwin-arm64": "@rivolink/leaf-darwin-arm64",
|
|
11
|
+
"win32-x64": "@rivolink/leaf-win32-x64",
|
|
12
|
+
"android-arm64": "@rivolink/leaf-android-arm64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const key = `${process.platform}-${process.arch}`;
|
|
16
|
+
const pkgName = PLATFORM_PACKAGES[key];
|
|
17
|
+
|
|
18
|
+
if (!pkgName) {
|
|
19
|
+
console.error(`[leaf] Unsupported platform: ${key}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let binaryPath;
|
|
24
|
+
try {
|
|
25
|
+
const isWindows = process.platform === "win32";
|
|
26
|
+
const binaryName = isWindows ? "leaf.exe" : "leaf";
|
|
27
|
+
binaryPath = require.resolve(path.join(pkgName, binaryName));
|
|
28
|
+
} catch {
|
|
29
|
+
console.error(`[leaf] Binary package not found for ${key}.`);
|
|
30
|
+
console.error(`[leaf] Reinstall: npm install -g @rivolink/leaf`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
35
|
+
stdio: "inherit",
|
|
36
|
+
windowsHide: false,
|
|
37
|
+
env: {
|
|
38
|
+
...process.env,
|
|
39
|
+
LEAF_CURRENT_EXE: binaryPath,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rivolink/leaf",
|
|
3
|
+
"version": "1.10.1",
|
|
4
|
+
"description": "Terminal Markdown previewer — GUI-like experience.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"markdown",
|
|
7
|
+
"terminal",
|
|
8
|
+
"tui",
|
|
9
|
+
"cli",
|
|
10
|
+
"preview"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/RivoLink/leaf",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/RivoLink/leaf.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bin": {
|
|
19
|
+
"leaf": "./bin/leaf.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/leaf.js"
|
|
23
|
+
],
|
|
24
|
+
"optionalDependencies": {
|
|
25
|
+
"@rivolink/leaf-linux-x64": "1.10.1",
|
|
26
|
+
"@rivolink/leaf-linux-arm64": "1.10.1",
|
|
27
|
+
"@rivolink/leaf-darwin-x64": "1.10.1",
|
|
28
|
+
"@rivolink/leaf-darwin-arm64": "1.10.1",
|
|
29
|
+
"@rivolink/leaf-win32-x64": "1.10.1",
|
|
30
|
+
"@rivolink/leaf-android-arm64": "1.10.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
}
|
|
35
|
+
}
|