quickscribe 0.1.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.
- package/README.md +4 -0
- package/bin/quickscribe.js +28 -0
- package/package.json +35 -0
- package/scripts/install.js +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Thin Node shim that execs the platform-specific quickscribe binary fetched by
|
|
3
|
+
// scripts/install.js into bin/quickscribe-bin (or .exe on Windows).
|
|
4
|
+
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { spawnSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const binary = path.join(
|
|
9
|
+
__dirname,
|
|
10
|
+
process.platform === "win32" ? "quickscribe-bin.exe" : "quickscribe-bin"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const result = spawnSync(binary, process.argv.slice(2), {
|
|
14
|
+
stdio: "inherit",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (result.error) {
|
|
18
|
+
if (result.error.code === "ENOENT") {
|
|
19
|
+
console.error(
|
|
20
|
+
"[quickscribe] binary not found — postinstall may have failed. Try reinstalling the package."
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
console.error(`[quickscribe] ${result.error.message}`);
|
|
24
|
+
}
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quickscribe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Transcribe audio files with Gemini and clean up the resulting transcripts.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"quickscribe": "bin/quickscribe.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/quickscribe.js",
|
|
10
|
+
"scripts/install.js"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"postinstall": "node scripts/install.js"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=16"
|
|
17
|
+
},
|
|
18
|
+
"os": [
|
|
19
|
+
"darwin",
|
|
20
|
+
"linux",
|
|
21
|
+
"win32"
|
|
22
|
+
],
|
|
23
|
+
"cpu": [
|
|
24
|
+
"arm64",
|
|
25
|
+
"x64"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/farhadjaman/quickscribe.git"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"quickscribe": {
|
|
33
|
+
"repo": "farhadjaman/quickscribe"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Downloads the right prebuilt quickscribe binary from GitHub Releases for the
|
|
3
|
+
// current OS/arch and writes it next to bin/quickscribe.js as `bin/quickscribe-bin`
|
|
4
|
+
// (or `bin/quickscribe-bin.exe` on Windows). The JS shim execs that file.
|
|
5
|
+
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const https = require("https");
|
|
9
|
+
|
|
10
|
+
const pkg = require("../package.json");
|
|
11
|
+
const repo = pkg.quickscribe && pkg.quickscribe.repo;
|
|
12
|
+
const version = pkg.version;
|
|
13
|
+
|
|
14
|
+
if (!repo || repo === "OWNER/REPO") {
|
|
15
|
+
console.error("[quickscribe] package.json `quickscribe.repo` is not set — cannot download binary.");
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const platformMap = {
|
|
20
|
+
"darwin-arm64": "quickscribe-darwin-arm64",
|
|
21
|
+
"darwin-x64": "quickscribe-darwin-amd64",
|
|
22
|
+
"linux-arm64": "quickscribe-linux-arm64",
|
|
23
|
+
"linux-x64": "quickscribe-linux-amd64",
|
|
24
|
+
"win32-x64": "quickscribe-windows-amd64.exe",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const key = `${process.platform}-${process.arch}`;
|
|
28
|
+
const assetName = platformMap[key];
|
|
29
|
+
if (!assetName) {
|
|
30
|
+
console.error(`[quickscribe] unsupported platform: ${key}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const url = `https://github.com/${repo}/releases/download/v${version}/${assetName}`;
|
|
35
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
36
|
+
const target = path.join(binDir, process.platform === "win32" ? "quickscribe-bin.exe" : "quickscribe-bin");
|
|
37
|
+
|
|
38
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
39
|
+
|
|
40
|
+
function download(from, dest, redirects = 5) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
https.get(from, (res) => {
|
|
43
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
44
|
+
if (redirects <= 0) return reject(new Error("too many redirects"));
|
|
45
|
+
return resolve(download(res.headers.location, dest, redirects - 1));
|
|
46
|
+
}
|
|
47
|
+
if (res.statusCode !== 200) {
|
|
48
|
+
return reject(new Error(`HTTP ${res.statusCode} fetching ${from}`));
|
|
49
|
+
}
|
|
50
|
+
const file = fs.createWriteStream(dest, { mode: 0o755 });
|
|
51
|
+
res.pipe(file);
|
|
52
|
+
file.on("finish", () => file.close(resolve));
|
|
53
|
+
file.on("error", reject);
|
|
54
|
+
}).on("error", reject);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log(`[quickscribe] downloading ${assetName} from ${repo} v${version} ...`);
|
|
59
|
+
download(url, target)
|
|
60
|
+
.then(() => {
|
|
61
|
+
fs.chmodSync(target, 0o755);
|
|
62
|
+
console.log(`[quickscribe] installed binary to ${target}`);
|
|
63
|
+
})
|
|
64
|
+
.catch((err) => {
|
|
65
|
+
console.error(`[quickscribe] download failed: ${err.message}`);
|
|
66
|
+
console.error(`[quickscribe] tried: ${url}`);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
});
|