@circlesac/holla 0.0.0 → 26.2.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.
Files changed (3) hide show
  1. package/bin/holla +16 -0
  2. package/install.js +41 -0
  3. package/package.json +17 -2
package/bin/holla ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync, existsSync } = require("child_process") || {};
4
+ const { join } = require("path");
5
+
6
+ const bin = join(__dirname, "native", "holla");
7
+
8
+ if (!existsSync(bin)) {
9
+ require("../install.js");
10
+ }
11
+
12
+ try {
13
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
14
+ } catch (err) {
15
+ process.exit(err.status ?? 1);
16
+ }
package/install.js ADDED
@@ -0,0 +1,41 @@
1
+ const { execSync } = require("child_process");
2
+ const { createWriteStream, existsSync, mkdirSync, chmodSync } = require("fs");
3
+ const { join } = require("path");
4
+ const https = require("https");
5
+
6
+ const REPO = "circlesac/holla-cli";
7
+ const BIN_DIR = join(__dirname, "bin", "native");
8
+ const BIN_PATH = join(BIN_DIR, "holla");
9
+
10
+ const PLATFORM_MAP = {
11
+ "darwin-arm64": "holla-darwin-arm64",
12
+ "darwin-x64": "holla-darwin-x64",
13
+ "linux-arm64": "holla-linux-arm64",
14
+ "linux-x64": "holla-linux-x64",
15
+ };
16
+
17
+ async function install() {
18
+ if (existsSync(BIN_PATH)) return;
19
+
20
+ const platform = `${process.platform}-${process.arch}`;
21
+ const name = PLATFORM_MAP[platform];
22
+ if (!name) {
23
+ console.error(`Unsupported platform: ${platform}`);
24
+ process.exit(1);
25
+ }
26
+
27
+ const version = require("./package.json").version;
28
+ const url = `https://github.com/${REPO}/releases/download/v${version}/${name}.tar.gz`;
29
+
30
+ mkdirSync(BIN_DIR, { recursive: true });
31
+
32
+ console.log(`Downloading holla v${version} for ${platform}...`);
33
+ execSync(`curl -fsSL "${url}" | tar xz -C "${BIN_DIR}"`, { stdio: "inherit" });
34
+ chmodSync(BIN_PATH, 0o755);
35
+ console.log("Installed successfully.");
36
+ }
37
+
38
+ install().catch((err) => {
39
+ console.error("Failed to install holla:", err.message);
40
+ process.exit(1);
41
+ });
package/package.json CHANGED
@@ -1,5 +1,20 @@
1
1
  {
2
+ "bin": {
3
+ "holla": "bin/holla"
4
+ },
5
+ "description": "CLI tool that acts as you on messaging platforms",
6
+ "files": [
7
+ "bin/holla",
8
+ "install.js"
9
+ ],
10
+ "license": "MIT",
2
11
  "name": "@circlesac/holla",
3
- "version": "0.0.0",
4
- "description": "CLI tool that acts as you on messaging platforms"
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/circlesac/holla-cli"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node install.js"
18
+ },
19
+ "version": "26.2.0"
5
20
  }