char 0.0.1-nightly.local.1773633617

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/run.js +20 -0
  2. package/install.js +40 -0
  3. package/package.json +24 -0
package/bin/run.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { join } = require("node:path");
5
+
6
+ const bin = join(__dirname, "char");
7
+ const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
8
+
9
+ child.on("error", (err) => {
10
+ console.error(err);
11
+ process.exit(1);
12
+ });
13
+
14
+ child.on("exit", (code, signal) => {
15
+ if (signal) {
16
+ process.kill(process.pid, signal);
17
+ } else {
18
+ process.exit(code ?? 1);
19
+ }
20
+ });
package/install.js ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("node:child_process");
4
+ const { existsSync, mkdirSync } = require("node:fs");
5
+ const { join } = require("node:path");
6
+
7
+ const REPO = "fastrepl/char";
8
+
9
+ const TARGETS = {
10
+ "darwin-arm64": "aarch64-apple-darwin",
11
+ "darwin-x64": "x86_64-apple-darwin",
12
+ };
13
+
14
+ const target = TARGETS[`${process.platform}-${process.arch}`];
15
+ if (!target) {
16
+ console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
17
+ process.exit(1);
18
+ }
19
+
20
+ const version = require("./package.json").version;
21
+ const tag = `cli_v${version}`;
22
+ const archive = `char-${version}-${target}.tar.xz`;
23
+ const url = `https://github.com/${REPO}/releases/download/${tag}/${archive}`;
24
+
25
+ const binDir = join(__dirname, "bin");
26
+ if (!existsSync(binDir)) {
27
+ mkdirSync(binDir, { recursive: true });
28
+ }
29
+
30
+ const dest = join(binDir, "char");
31
+ if (existsSync(dest)) {
32
+ process.exit(0);
33
+ }
34
+
35
+ console.error(`Downloading char from ${url}`);
36
+ const tmp = join(require("node:os").tmpdir(), archive);
37
+ execSync(`curl -fsSL -o "${tmp}" "${url}"`, { stdio: "inherit" });
38
+ execSync(`tar -xf "${tmp}" -C "${binDir}"`, { stdio: "inherit" });
39
+ execSync(`rm -f "${tmp}"`);
40
+ execSync(`chmod +x "${dest}"`);
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "char",
3
+ "version": "0.0.1-nightly.local.1773633617",
4
+ "description": "Live transcription and audio tools",
5
+ "license": "GPL-3.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/fastrepl/char"
9
+ },
10
+ "homepage": "https://char.com",
11
+ "bin": {
12
+ "char": "bin/run.js"
13
+ },
14
+ "scripts": {
15
+ "postinstall": "node install.js"
16
+ },
17
+ "files": [
18
+ "bin/",
19
+ "install.js"
20
+ ],
21
+ "engines": {
22
+ "node": ">=18"
23
+ }
24
+ }