1b279d4d10
Lua CI / lua-language-server type check (push) Failing after 1s
Lua CI / luacheck lint (push) Failing after 1s
Python CI / Python bindings (ubuntu-latest) (push) Failing after 1s
Build & Publish / Build Neovim aarch64-linux-android (push) Failing after 3s
Build & Publish / Build Neovim aarch64-unknown-linux-gnu (push) Failing after 0s
Build & Publish / Build Neovim aarch64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build Neovim x86_64-unknown-linux-gnu (push) Failing after 1s
Build & Publish / Build Neovim x86_64-unknown-linux-musl (push) Failing after 1s
Build & Publish / Build C FFI aarch64-linux-android (push) Failing after 1s
Build & Publish / Build C FFI aarch64-unknown-linux-gnu (push) Failing after 1s
Build & Publish / Build C FFI aarch64-unknown-linux-musl (push) Failing after 0s
Build & Publish / Build C FFI x86_64-unknown-linux-gnu (push) Failing after 1s
Build & Publish / Build C FFI x86_64-unknown-linux-musl (push) Failing after 3s
Build & Publish / Build MCP aarch64-unknown-linux-gnu (push) Failing after 1s
Build & Publish / Build MCP aarch64-unknown-linux-musl (push) Failing after 0s
Build & Publish / Build MCP x86_64-unknown-linux-gnu (push) Failing after 2s
Rust CI / Fuzz Tests (ubuntu-latest) (push) Failing after 1s
Rust CI / Build i686-unknown-linux-gnu (push) Failing after 1s
Rust CI / cargo fmt (push) Failing after 1s
Build & Publish / Build MCP x86_64-unknown-linux-musl (push) Failing after 4s
Build & Publish / Build Python wheels aarch64 (ubuntu-latest) (push) Failing after 1s
Build & Publish / Build Python wheels x86_64 (ubuntu-latest) (push) Failing after 1s
Build & Publish / Build Python sdist (push) Failing after 0s
Rust CI / Test (ubuntu-latest) (push) Failing after 1s
Rust CI / cargo clippy (push) Failing after 1s
Spelling / Spell Check with Typos (push) Failing after 1s
Stylua / Check lua files using Stylua (push) Failing after 1s
e2e Tests / e2e (ubuntu-latest) (push) Failing after 4s
e2e Tests / e2e (alpine-musl) (push) Successful in 58m54s
Build & Publish / Build C FFI aarch64-apple-darwin (push) Has been cancelled
Build & Publish / Build C FFI aarch64-pc-windows-msvc (push) Has been cancelled
Build & Publish / Build C FFI x86_64-apple-darwin (push) Has been cancelled
Build & Publish / Build C FFI x86_64-pc-windows-msvc (push) Has been cancelled
e2e Tests / e2e (macos-latest) (push) Has been cancelled
e2e Tests / e2e (windows-latest) (push) Has been cancelled
Nix CI / check (push) Has been cancelled
Python CI / Python bindings (macos-latest) (push) Has been cancelled
Python CI / Python bindings (windows-latest) (push) Has been cancelled
Build & Publish / Build Neovim aarch64-apple-darwin (push) Has been cancelled
Build & Publish / Build Neovim aarch64-pc-windows-msvc (push) Has been cancelled
Build & Publish / Build Neovim x86_64-apple-darwin (push) Has been cancelled
Build & Publish / Build Neovim x86_64-pc-windows-msvc (push) Has been cancelled
Build & Publish / Build MCP aarch64-apple-darwin (push) Has been cancelled
Build & Publish / Build MCP aarch64-pc-windows-msvc (push) Has been cancelled
Build & Publish / Build MCP x86_64-apple-darwin (push) Has been cancelled
Build & Publish / Build MCP x86_64-pc-windows-msvc (push) Has been cancelled
Build & Publish / Build Python wheels aarch64 (macos-latest) (push) Has been cancelled
Build & Publish / Build Python wheels x86_64 (macos-latest) (push) Has been cancelled
Build & Publish / Build Python wheels x86_64 (windows-latest) (push) Has been cancelled
Build & Publish / Release (push) Has been cancelled
Build & Publish / Publish Python wheels to PyPI (push) Has been cancelled
Build & Publish / Publish Rust crates (push) Has been cancelled
Build & Publish / Publish npm packages (push) Has been cancelled
Rust CI / Test (macos-latest) (push) Has been cancelled
Rust CI / Test (windows-latest) (push) Has been cancelled
Rust CI / Fuzz Tests (macos-latest) (push) Has been cancelled
Rust CI / Fuzz Tests (windows-latest) (push) Has been cancelled
123 lines
3.5 KiB
TypeScript
123 lines
3.5 KiB
TypeScript
/**
|
|
* CLI tool for fff-node package management
|
|
*
|
|
* Usage:
|
|
* npx @ff-labs/fff-node download [tag] - Download native binary from GitHub
|
|
* npx @ff-labs/fff-node info - Show platform and binary info
|
|
*/
|
|
|
|
import { readFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { downloadBinary, findBinary, getBinaryPath } from "../src/binary.js";
|
|
import {
|
|
getLibExtension,
|
|
getLibFilename,
|
|
getNpmPackageName,
|
|
getTriple,
|
|
} from "../src/platform.js";
|
|
|
|
const args = process.argv.slice(2);
|
|
const command = args[0];
|
|
|
|
interface PackageJson {
|
|
version: string;
|
|
}
|
|
|
|
function getPackageInfo(): PackageJson {
|
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
|
const packageJsonPath = join(currentDir, "..", "package.json");
|
|
|
|
try {
|
|
return JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
} catch {
|
|
return { version: "unknown" };
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
switch (command) {
|
|
case "download": {
|
|
const tag = args[1];
|
|
console.log("fff: Downloading native library from GitHub...");
|
|
try {
|
|
const resolvedTag = await downloadBinary(tag);
|
|
console.log(`fff: Download complete! (${resolvedTag})`);
|
|
} catch (error) {
|
|
console.error("fff: Download failed:", error);
|
|
process.exit(1);
|
|
}
|
|
break;
|
|
}
|
|
|
|
case "info": {
|
|
const pkg = getPackageInfo();
|
|
let npmPackage: string;
|
|
try {
|
|
npmPackage = getNpmPackageName();
|
|
} catch {
|
|
npmPackage = "unsupported";
|
|
}
|
|
|
|
console.log("fff - Fast File Finder (Node.js)");
|
|
console.log(`Package version: ${pkg.version}`);
|
|
console.log("");
|
|
console.log("Platform Information:");
|
|
console.log(` Triple: ${getTriple()}`);
|
|
console.log(` Extension: ${getLibExtension()}`);
|
|
console.log(` Library name: ${getLibFilename()}`);
|
|
console.log(` npm package: ${npmPackage}`);
|
|
console.log("");
|
|
console.log("Binary Status:");
|
|
const existing = findBinary();
|
|
if (existing) {
|
|
console.log(` Found: ${existing}`);
|
|
} else {
|
|
console.log(" Not found");
|
|
console.log(` Expected path: ${getBinaryPath()}`);
|
|
console.log(` Try: npm add ${npmPackage}`);
|
|
}
|
|
break;
|
|
}
|
|
|
|
case "version":
|
|
case "--version":
|
|
case "-v": {
|
|
const pkg = getPackageInfo();
|
|
console.log(pkg.version);
|
|
break;
|
|
}
|
|
|
|
default: {
|
|
const pkg = getPackageInfo();
|
|
console.log(`fff - Fast File Finder CLI (Node.js) v${pkg.version}`);
|
|
console.log("");
|
|
console.log("Usage:");
|
|
console.log(
|
|
" npx @ff-labs/fff-node download [tag] Download native binary from GitHub (fallback)",
|
|
);
|
|
console.log(
|
|
" npx @ff-labs/fff-node info Show platform and binary info",
|
|
);
|
|
console.log(" npx @ff-labs/fff-node version Show version");
|
|
console.log(" npx @ff-labs/fff-node help Show this help message");
|
|
console.log("");
|
|
console.log("Examples:");
|
|
console.log(
|
|
" npx @ff-labs/fff-node download Download latest binary from GitHub",
|
|
);
|
|
console.log(
|
|
" npx @ff-labs/fff-node download abc1234 Download specific release tag",
|
|
);
|
|
console.log("");
|
|
console.log(
|
|
"Note: Binaries are normally provided via platform-specific npm packages.",
|
|
);
|
|
console.log("The download command is a fallback for when those aren't available.");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
main();
|