ttfx-js 0.3.2-win.1
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 +35 -0
- package/bin/ttfx.js +62 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# ttfx (npm)
|
|
2
|
+
|
|
3
|
+
Terminal text effects as a single static binary. No Rust needed:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx ttfx-js decrypt <<< "hello"
|
|
7
|
+
echo "hello" | npx ttfx-js beams
|
|
8
|
+
npm i -g ttfx-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
All 37 effects included. Usage matches the Rust binary:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<producer> | ttfx [terminal options] <effect> [effect options]
|
|
15
|
+
|
|
16
|
+
ttfx --help # all 37 effects and the terminal options
|
|
17
|
+
ttfx <effect> --help # options for one effect
|
|
18
|
+
ttfx --random-effect # surprise me
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## How it works
|
|
22
|
+
|
|
23
|
+
This package ships prebuilt `ttfx` binaries (Linux/macOS/Windows) as optional
|
|
24
|
+
platform packages. `bin/ttfx.js` picks the one for your machine and runs it
|
|
25
|
+
with your terminal attached, so rendering, speed (~3 MB binary, millisecond
|
|
26
|
+
startup) and exit codes are identical to the native build.
|
|
27
|
+
|
|
28
|
+
## Credit where it's due
|
|
29
|
+
|
|
30
|
+
The effects, animation engine and CLI are the work of
|
|
31
|
+
[TerminalTextEffects](https://github.com/ChrisBuilds/terminaltexteffects) by
|
|
32
|
+
[ChrisBuilds](https://github.com/ChrisBuilds), via the
|
|
33
|
+
[ttfx Rust port](https://github.com/omacom-io/ttfx) (Windows support from
|
|
34
|
+
[this fork](https://github.com/Muhammad-Owais-Warsi/ttfx)). This repo only
|
|
35
|
+
packages their prebuilt binaries for npm — see THIRD-PARTY-NOTICES.
|
package/bin/ttfx.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ttfx launcher: pick the prebuilt binary for this OS/CPU and hand it the
|
|
3
|
+
// terminal (stdio: inherit), so colors, animation, Ctrl-C and exit codes
|
|
4
|
+
// behave exactly like the native binary. Zero dependencies.
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const { spawnSync } = require("node:child_process");
|
|
8
|
+
const { execSync } = require("node:child_process");
|
|
9
|
+
const fs = require("node:fs");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
|
|
12
|
+
function isMusl() {
|
|
13
|
+
try {
|
|
14
|
+
const out = execSync("ldd --version", { stdio: ["ignore", "pipe", "pipe"] }).toString();
|
|
15
|
+
return out.includes("musl");
|
|
16
|
+
} catch {
|
|
17
|
+
try {
|
|
18
|
+
return fs.readFileSync("/usr/bin/ldd", "utf8").includes("musl");
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function platformPackage() {
|
|
26
|
+
const platform = process.platform;
|
|
27
|
+
const arch = process.arch;
|
|
28
|
+
if (platform === "win32" && arch === "x64") return "ttfx-windows-x64";
|
|
29
|
+
if (platform === "darwin" && arch === "x64") return "ttfx-darwin-x64";
|
|
30
|
+
if (platform === "darwin" && arch === "arm64") return "ttfx-darwin-arm64";
|
|
31
|
+
if (platform === "linux" && arch === "x64") {
|
|
32
|
+
return isMusl() ? "ttfx-linux-x64-musl" : "ttfx-linux-x64-gnu";
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function main() {
|
|
38
|
+
const pkg = platformPackage();
|
|
39
|
+
if (!pkg) {
|
|
40
|
+
console.error(
|
|
41
|
+
`ttfx: unsupported platform ${process.platform}/${process.arch}. See https://github.com/Muhammad-Owais-Warsi/ttfx-js/releases`
|
|
42
|
+
);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const exe = process.platform === "win32" ? "ttfx.exe" : "ttfx";
|
|
46
|
+
const bin = path.join(__dirname, "..", "..", pkg, exe);
|
|
47
|
+
if (!fs.existsSync(bin)) {
|
|
48
|
+
console.error(
|
|
49
|
+
`ttfx: binary missing for ${process.platform}/${process.arch} (looked for ${pkg}). ` +
|
|
50
|
+
`Reinstall with: npm i -f ttfx`
|
|
51
|
+
);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const result = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
55
|
+
if (result.error) {
|
|
56
|
+
console.error(`ttfx: failed to run ${bin}: ${result.error.message}`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
process.exit(result.status == null ? 1 : result.status);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ttfx-js",
|
|
3
|
+
"version": "0.3.2-win.1",
|
|
4
|
+
"description": "Terminal text effects as a single static binary (npm distribution of ttfx)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/Muhammad-Owais-Warsi/ttfx-js"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"ttfx": "bin/ttfx.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"ttfx-linux-x64-gnu": "0.3.2-win.0",
|
|
18
|
+
"ttfx-linux-x64-musl": "0.3.2-win.0",
|
|
19
|
+
"ttfx-darwin-x64": "0.3.2-win.0",
|
|
20
|
+
"ttfx-darwin-arm64": "0.3.2-win.0",
|
|
21
|
+
"ttfx-windows-x64": "0.3.2-win.0"
|
|
22
|
+
}
|
|
23
|
+
}
|