chore: import upstream snapshot with attribution
Docker Publish / docker (web, apps/web/Dockerfile, web) (push) Failing after 0s
Docker Publish / docker (api, apps/api/Dockerfile, api) (push) Failing after 1s
Publish Extension / detect-version (push) Has been skipped
Publish Extension / submit (push) Has been cancelled
Docker Publish / docker (web, apps/web/Dockerfile, web) (push) Failing after 0s
Docker Publish / docker (api, apps/api/Dockerfile, api) (push) Failing after 1s
Publish Extension / detect-version (push) Has been skipped
Publish Extension / submit (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Homebrew formula for @vidbee/cli.
|
||||
#
|
||||
# Place this file at the root of a tap repository (e.g. vidbee/homebrew-tap)
|
||||
# under `Formula/vidbee.rb` and users can install with:
|
||||
#
|
||||
# brew install vidbee/tap/vidbee
|
||||
#
|
||||
# The formula wraps the same npm tarball that `npm install -g @vidbee/cli`
|
||||
# would resolve, so the installed binary is bit-for-bit identical to the
|
||||
# npm and shell-installer paths. Bumping the version requires updating
|
||||
# `version` and `sha256` to match the new tarball published to the npm
|
||||
# registry. The CI workflow `cli-publish.yml` can be extended to open a PR
|
||||
# against the tap repo on each tag.
|
||||
class Vidbee < Formula
|
||||
desc "Agent-friendly yt-dlp downloader CLI for VidBee (Desktop & API hosts)"
|
||||
homepage "https://github.com/vidbee/vidbee"
|
||||
# When publishing a new version, replace the tarball URL with the npm
|
||||
# registry URL printed by `npm view @vidbee/cli@<version> dist.tarball`
|
||||
# and the sha256 with the matching `dist.shasum` (after converting hex
|
||||
# to sha256 via `npm view @vidbee/cli@<version> dist.integrity`).
|
||||
url "https://registry.npmjs.org/@vidbee/cli/-/cli-0.1.0.tgz"
|
||||
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
license "MIT"
|
||||
|
||||
depends_on "node"
|
||||
|
||||
def install
|
||||
system "npm", "install", "-g",
|
||||
"--prefix=#{libexec}",
|
||||
"--no-audit",
|
||||
"--no-fund",
|
||||
"@vidbee/cli@#{version}"
|
||||
bin.install_symlink Dir["#{libexec}/bin/vidbee"]
|
||||
end
|
||||
|
||||
test do
|
||||
output = shell_output("#{bin}/vidbee :version")
|
||||
assert_match "vidbee", output.downcase
|
||||
end
|
||||
end
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
#!/usr/bin/env sh
|
||||
# VidBee CLI standalone installer.
|
||||
#
|
||||
# curl -fsSL https://vidbee.dev/cli/install.sh | sh
|
||||
# curl -fsSL https://vidbee.dev/cli/install.sh | sh -s -- --version 0.1.0
|
||||
#
|
||||
# Downloads the npm tarball for `@vidbee/cli` and installs it under
|
||||
# $VIDBEE_HOME (default ~/.vidbee/cli). Writes a `vidbee` shim into
|
||||
# $VIDBEE_BIN_DIR (default ~/.local/bin) that runs the bundled CLI via
|
||||
# Node ≥ 20.
|
||||
#
|
||||
# Designed to work on macOS and Linux with POSIX sh + curl + tar + node.
|
||||
# Windows users should install via npm: npm install -g @vidbee/cli
|
||||
#
|
||||
# Reference: NEX-148 §2.
|
||||
|
||||
set -eu
|
||||
|
||||
PKG_NAME="@vidbee/cli"
|
||||
REGISTRY_URL="${VIDBEE_REGISTRY:-https://registry.npmjs.org}"
|
||||
VIDBEE_HOME="${VIDBEE_HOME:-$HOME/.vidbee/cli}"
|
||||
VIDBEE_BIN_DIR="${VIDBEE_BIN_DIR:-$HOME/.local/bin}"
|
||||
VERSION=""
|
||||
QUIET="${VIDBEE_QUIET:-0}"
|
||||
|
||||
log() {
|
||||
if [ "$QUIET" != "1" ]; then
|
||||
printf '%s\n' "$1" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
die() {
|
||||
printf 'vidbee install: %s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--version)
|
||||
shift
|
||||
[ $# -gt 0 ] || die '--version requires a value'
|
||||
VERSION="$1"
|
||||
;;
|
||||
--version=*)
|
||||
VERSION="${1#--version=}"
|
||||
;;
|
||||
--bin-dir)
|
||||
shift
|
||||
[ $# -gt 0 ] || die '--bin-dir requires a value'
|
||||
VIDBEE_BIN_DIR="$1"
|
||||
;;
|
||||
--bin-dir=*)
|
||||
VIDBEE_BIN_DIR="${1#--bin-dir=}"
|
||||
;;
|
||||
--home)
|
||||
shift
|
||||
[ $# -gt 0 ] || die '--home requires a value'
|
||||
VIDBEE_HOME="$1"
|
||||
;;
|
||||
--home=*)
|
||||
VIDBEE_HOME="${1#--home=}"
|
||||
;;
|
||||
--quiet)
|
||||
QUIET=1
|
||||
;;
|
||||
--help|-h)
|
||||
cat <<USAGE
|
||||
Usage: cli-install.sh [--version X.Y.Z] [--home DIR] [--bin-dir DIR] [--quiet]
|
||||
|
||||
Installs the @vidbee/cli npm tarball into \$VIDBEE_HOME (default ~/.vidbee/cli)
|
||||
and writes a 'vidbee' shim into \$VIDBEE_BIN_DIR (default ~/.local/bin).
|
||||
|
||||
Prefer one of:
|
||||
npm install -g @vidbee/cli
|
||||
pnpm add -g @vidbee/cli
|
||||
bun install -g @vidbee/cli
|
||||
brew install vidbee/tap/vidbee
|
||||
|
||||
Use this installer when you don't have a package manager handy.
|
||||
USAGE
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
die "unknown argument: $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Sanity-check dependencies
|
||||
need() {
|
||||
command -v "$1" >/dev/null 2>&1 || die "missing required command: $1"
|
||||
}
|
||||
need curl
|
||||
need tar
|
||||
need node
|
||||
|
||||
NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)"
|
||||
if [ "$NODE_MAJOR" -lt 20 ]; then
|
||||
die "node ≥ 20 required (found $(node -v 2>/dev/null || echo 'none'))"
|
||||
fi
|
||||
|
||||
# Resolve version
|
||||
if [ -z "$VERSION" ]; then
|
||||
log "Resolving latest version of $PKG_NAME from $REGISTRY_URL"
|
||||
META_URL="$REGISTRY_URL/$(printf '%s' "$PKG_NAME" | sed 's|/|%2F|')/latest"
|
||||
RESOLVED="$(curl -fsSL "$META_URL" | node -e '
|
||||
let buf = "";
|
||||
process.stdin.on("data", (c) => { buf += c; });
|
||||
process.stdin.on("end", () => {
|
||||
const data = JSON.parse(buf);
|
||||
if (typeof data.version !== "string") {
|
||||
process.stderr.write("registry response missing version\n");
|
||||
process.exit(1);
|
||||
}
|
||||
process.stdout.write(data.version);
|
||||
});
|
||||
')"
|
||||
VERSION="$RESOLVED"
|
||||
[ -n "$VERSION" ] || die "could not resolve latest version"
|
||||
fi
|
||||
|
||||
log "Installing $PKG_NAME@$VERSION → $VIDBEE_HOME"
|
||||
|
||||
TMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t vidbee)"
|
||||
trap 'rm -rf "$TMP_DIR"' EXIT INT TERM
|
||||
|
||||
ESCAPED_NAME="$(printf '%s' "$PKG_NAME" | sed 's|/|%2F|')"
|
||||
META_URL="$REGISTRY_URL/$ESCAPED_NAME/$VERSION"
|
||||
META_FILE="$TMP_DIR/meta.json"
|
||||
curl -fsSL "$META_URL" -o "$META_FILE" || die "could not fetch package metadata"
|
||||
|
||||
TARBALL_URL="$(node -e '
|
||||
const fs = require("node:fs");
|
||||
const m = JSON.parse(fs.readFileSync(process.argv[1], "utf-8"));
|
||||
if (!m || !m.dist || !m.dist.tarball) {
|
||||
process.stderr.write("metadata missing dist.tarball\n");
|
||||
process.exit(1);
|
||||
}
|
||||
process.stdout.write(m.dist.tarball);
|
||||
' "$META_FILE")"
|
||||
[ -n "$TARBALL_URL" ] || die "metadata missing dist.tarball"
|
||||
|
||||
TARBALL="$TMP_DIR/cli.tgz"
|
||||
curl -fsSL "$TARBALL_URL" -o "$TARBALL" || die "could not download tarball"
|
||||
|
||||
mkdir -p "$VIDBEE_HOME"
|
||||
# Replace any prior install atomically by extracting into a new dir then
|
||||
# swapping it in.
|
||||
STAGING="$TMP_DIR/staging"
|
||||
mkdir -p "$STAGING"
|
||||
tar -xf "$TARBALL" -C "$STAGING"
|
||||
[ -d "$STAGING/package" ] || die "unexpected tarball layout"
|
||||
|
||||
rm -rf "$VIDBEE_HOME.old"
|
||||
if [ -d "$VIDBEE_HOME" ] && [ "$(ls -A "$VIDBEE_HOME" 2>/dev/null || true)" ]; then
|
||||
mv "$VIDBEE_HOME" "$VIDBEE_HOME.old"
|
||||
fi
|
||||
mkdir -p "$VIDBEE_HOME"
|
||||
# Move package contents into VIDBEE_HOME
|
||||
( cd "$STAGING/package" && tar -cf - . ) | ( cd "$VIDBEE_HOME" && tar -xf - )
|
||||
rm -rf "$VIDBEE_HOME.old"
|
||||
|
||||
# Write the bin shim
|
||||
mkdir -p "$VIDBEE_BIN_DIR"
|
||||
SHIM="$VIDBEE_BIN_DIR/vidbee"
|
||||
cat >"$SHIM" <<SH
|
||||
#!/usr/bin/env sh
|
||||
# Generated by VidBee CLI installer.
|
||||
exec node "$VIDBEE_HOME/dist/bin/vidbee.mjs" "\$@"
|
||||
SH
|
||||
chmod +x "$SHIM"
|
||||
|
||||
if ! [ -f "$VIDBEE_HOME/dist/bin/vidbee.mjs" ]; then
|
||||
die "expected dist/bin/vidbee.mjs in tarball but it is missing"
|
||||
fi
|
||||
|
||||
log ""
|
||||
log "Installed VidBee CLI $VERSION."
|
||||
log " Bin: $SHIM"
|
||||
log " Bundle: $VIDBEE_HOME/dist/index.mjs"
|
||||
log ""
|
||||
|
||||
case ":$PATH:" in
|
||||
*":$VIDBEE_BIN_DIR:"*) ;;
|
||||
*)
|
||||
log "Note: $VIDBEE_BIN_DIR is not on your PATH. Add this line to your"
|
||||
log " shell profile (~/.zshrc, ~/.bashrc, ~/.profile):"
|
||||
log ""
|
||||
log " export PATH=\"$VIDBEE_BIN_DIR:\$PATH\""
|
||||
log ""
|
||||
;;
|
||||
esac
|
||||
|
||||
log "Verify with: vidbee :version"
|
||||
Reference in New Issue
Block a user