Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ No ncurses. No browser DOM. No React. No native addon. No network access. Ever.

## Install

The `hqtui` CLI (widget showcase, `hqtui doctor`, the emoji font installer) in
one line. It uses bun if you have it, otherwise npm with Node 22.6+, and never
asks for sudo:

```sh
curl -fsSL https://hqtui.com/install.sh | sh
```

To build an app, add the library to your project:

```bash
bun add @profullstack/hqtui # Bun is the default runtime
npm add @profullstack/hqtui # Node 22.6+ works too
Expand Down
2 changes: 2 additions & 0 deletions apps/web/app/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ npm add @profullstack/hqtui # Node 22.6+ works unchanged`} />
There is also a CLI: <code className="font-mono text-white/80">hqtui doctor</code>{" "}
reports what your terminal actually supports, and{" "}
<code className="font-mono text-white/80">hqtui</code> opens a built-in showcase.
Install it in one line (bun if present, otherwise npm with Node 22.6+, no sudo):
</P>
<CommandBlock className="mt-3" command="curl -fsSL https://hqtui.com/install.sh | sh" label="CLI install" />

<H2 id="first-app">Your first app</H2>
<P>
Expand Down
6 changes: 6 additions & 0 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ export default async function Home() {
</p>
<CommandBlock command="bun add @profullstack/hqtui" label="install" />
</div>
<div className="text-left">
<p className="mb-1.5 text-center text-xs uppercase tracking-wide text-white/40">
Or install the CLI
</p>
<CommandBlock command="curl -fsSL https://hqtui.com/install.sh | sh" label="CLI install" />
</div>
<div className="mt-1 flex justify-center gap-3">
<Button size="lg" render={<Link href="#languages" />}>
Choose your language <ArrowRight className="ml-1 h-4 w-4" />
Expand Down
8 changes: 8 additions & 0 deletions apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ const nextConfig: NextConfig = {
},
async headers() {
return [
{
// The curl installer: shown as text in a browser, never cached stale.
source: "/install.sh",
headers: [
{ key: "Cache-Control", value: "no-store" },
{ key: "Content-Type", value: "text/plain; charset=utf-8" },
],
},
{
source: "/demo.sh",
headers: [
Expand Down
55 changes: 55 additions & 0 deletions apps/web/public/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
# Install the hqtui CLI (npm: @profullstack/hqtui): the widget showcase,
# `hqtui doctor` for terminal capabilities, and the OpenEmoji font installer.
#
# curl -fsSL https://hqtui.com/install.sh | sh
#
# Uses bun if present, otherwise npm (Node >= 22.6). When the global npm
# prefix is not writable it installs into ~/.local instead of asking for sudo.
# Re-running it upgrades to the latest release.
set -eu

PKG="@profullstack/hqtui"
BIN="hqtui"

say() { printf '%s\n' "$*"; }
die() { printf 'hqtui install: %s\n' "$*" >&2; exit 1; }
have() { command -v "$1" >/dev/null 2>&1; }

say "Installing hqtui (High Quality Terminal UI)..."

if have bun; then
bun add -g "$PKG@latest"
BIN_DIR="${BUN_INSTALL:-$HOME/.bun}/bin"
elif have npm && have node; then
node -e 'const [a,b]=process.versions.node.split(".").map(Number);process.exit(a>22||(a===22&&b>=6)?0:1)' 2>/dev/null \
|| die "Node >= 22.6 required (found $(node -v)). Upgrade Node or install bun: https://bun.sh"
prefix=$(npm config get prefix)
modules="$prefix/lib/node_modules"
[ -d "$modules" ] || modules="$prefix/lib"
if [ -w "$modules" ] && [ -w "$prefix/bin" ]; then
npm install -g "$PKG@latest"
BIN_DIR="$prefix/bin"
else
BIN_DIR="$HOME/.local/bin"
say "npm prefix $prefix is not writable; installing into $HOME/.local"
npm install -g --prefix "$HOME/.local" "$PKG@latest"
fi
else
die "needs bun (https://bun.sh) or Node >= 22.6 with npm (https://nodejs.org)"
fi

say ""
if have "$BIN"; then
say "hqtui $("$BIN" --version 2>/dev/null || echo '') installed."
else
say "hqtui installed to $BIN_DIR, which is not on your PATH. Add it:"
say " export PATH=\"$BIN_DIR:\$PATH\""
fi
say ""
say "Next:"
say " hqtui # open the widget showcase"
say " hqtui doctor # what this terminal supports"
say " hqtui --help # every command"
say ""
say "Building an app? Add the library: bun add @profullstack/hqtui"
Loading