Skip to content

Commit

Permalink
feat(rari-npm): include cli script
Browse files Browse the repository at this point in the history
This allows npx rari to work.
Also Don't error on missing popularities.
  • Loading branch information
fiji-flo committed Oct 24, 2024
1 parent a3e3e87 commit ee9a1d9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ reqwest = { version = "0.12", default-features = false, features = [
] }
indoc = "2"
base64 = "0.22"
console = "0.15"


[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ reqwest.workspace = true
url.workspace = true
indoc.workspace = true
rayon.workspace = true
console.workspace = true

console = "0"
dialoguer = "0"
dialoguer = "0.11"
csv = "1"
sha2 = "0.10"

Expand Down
2 changes: 1 addition & 1 deletion rari-npm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
bin/
binary/
9 changes: 9 additions & 0 deletions rari-npm/lib/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

import { spawn } from "node:child_process";
import process from "node:process";
import { rariBin } from "./index.js";

const input = process.argv.slice(2);

spawn(rariBin, input, { stdio: "inherit" }).on("exit", process.exit);
2 changes: 1 addition & 1 deletion rari-npm/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { join } from "node:path";

export const rariBin = join(
import.meta.dirname,
`../bin/rari${process.platform === "win32" ? ".exe" : ""}`,
`../binary/rari${process.platform === "win32" ? ".exe" : ""}`,
);
2 changes: 1 addition & 1 deletion rari-npm/lib/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { download, exists } from "./download.js";
import packageJson from "../package.json" with { type: "json" };

const VERSION = `v${packageJson.version}`;
const BIN_PATH = join(import.meta.dirname, "../bin");
const BIN_PATH = join(import.meta.dirname, "../binary");
const FORCE = JSON.parse(process.env.FORCE || "false");
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;

Expand Down
2 changes: 1 addition & 1 deletion rari-npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"postinstall": "node ./lib/postinstall.js"
},
"bin": {
"rari": "bin/rari"
"rari": "lib/cli.js"
},
"author": "Florian Dieminger <[email protected]>",
"license": "MPL-2.0",
Expand Down

0 comments on commit ee9a1d9

Please sign in to comment.