unified-tvdevelopment-cli 1.0.0 → 1.0.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 +2 -0
- package/dist/cli.mjs +41177 -721
- package/install.ps1 +3 -3
- package/install.sh +85 -66
- package/package.json +3 -3
package/install.ps1
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# unified-tvdevelopment-cli — Windows installer
|
|
2
2
|
# Run:
|
|
3
|
-
# iwr -useb https://raw.githubusercontent.com/
|
|
4
|
-
# iwr -useb https://raw.githubusercontent.com/
|
|
3
|
+
# iwr -useb https://raw.githubusercontent.com/tvdev-cli/tvdev-cli/main/install.ps1 | iex
|
|
4
|
+
# iwr -useb https://raw.githubusercontent.com/tvdev-cli/tvdev-cli/main/install.ps1 | iex # then pass -Beta
|
|
5
5
|
|
|
6
6
|
param(
|
|
7
7
|
[switch]$Beta,
|
|
@@ -166,6 +166,6 @@ Write-Host ""
|
|
|
166
166
|
Write-Host " Launch TV Dev Manager: " -NoNewline
|
|
167
167
|
Write-Host $Bin -ForegroundColor Cyan
|
|
168
168
|
Write-Host ""
|
|
169
|
-
Write-Host " GitHub : https://github.com/
|
|
169
|
+
Write-Host " GitHub : https://github.com/tvdev-cli/tvdev-cli" -ForegroundColor DarkGray
|
|
170
170
|
Write-Host " npm : https://npmjs.com/package/unified-tvdevelopment-cli" -ForegroundColor DarkGray
|
|
171
171
|
Write-Host ""
|
package/install.sh
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
2
|
+
# tvdev-cli — one-line installer
|
|
3
|
+
# Pulls the latest release binary directly from GitHub Releases.
|
|
4
4
|
#
|
|
5
|
-
# curl -fsSL https://raw.githubusercontent.com/
|
|
6
|
-
# curl -fsSL https://raw.githubusercontent.com/
|
|
5
|
+
# curl -fsSL https://raw.githubusercontent.com/tvdev-cli/tvdev-cli/main/install.sh | bash
|
|
6
|
+
# curl -fsSL https://raw.githubusercontent.com/tvdev-cli/tvdev-cli/main/install.sh | bash -s -- --beta
|
|
7
7
|
#
|
|
8
8
|
set -euo pipefail
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
REPO="tvdev-cli/tvdev-cli"
|
|
11
11
|
BIN="tvdev"
|
|
12
12
|
REQUIRED_NODE=18
|
|
13
13
|
NVM_VERSION="v0.39.7"
|
|
14
14
|
INSTALL_NODE_VERSION="20"
|
|
15
|
-
|
|
15
|
+
CHANNEL="stable" # stable | beta
|
|
16
16
|
|
|
17
17
|
# ── Flags ─────────────────────────────────────────────────────────────────────
|
|
18
18
|
for arg in "${@:-}"; do
|
|
19
19
|
case "$arg" in
|
|
20
|
-
--beta)
|
|
21
|
-
--tag=*) NPM_TAG="${arg#--tag=}" ;;
|
|
22
|
-
--tag) shift; NPM_TAG="${1:-latest}" ;;
|
|
20
|
+
--beta) CHANNEL="beta" ;;
|
|
23
21
|
esac
|
|
24
22
|
done
|
|
25
23
|
|
|
@@ -38,8 +36,8 @@ banner() {
|
|
|
38
36
|
echo -e " ${INDIGO}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
|
|
39
37
|
echo -e " ${DIM}Universal Smart TV Development CLI${RESET}"
|
|
40
38
|
echo -e " ${DIM}LG webOS · Samsung Tizen · Amazon Fire TV · Android TV${RESET}"
|
|
41
|
-
if [ "$
|
|
42
|
-
echo -e " ${YELLOW}
|
|
39
|
+
if [ "$CHANNEL" = "beta" ]; then
|
|
40
|
+
echo -e " ${YELLOW} channel: beta${RESET}"
|
|
43
41
|
fi
|
|
44
42
|
echo ""
|
|
45
43
|
}
|
|
@@ -50,79 +48,73 @@ info() { echo -e " ${INDIGO}●${RESET} $*"; }
|
|
|
50
48
|
warn() { echo -e " ${YELLOW}⚠${RESET} $*"; }
|
|
51
49
|
fail() { echo -e "\n ${RED}✗ $*${RESET}\n"; exit 1; }
|
|
52
50
|
|
|
53
|
-
# ── Semver compare (returns 0 if $1 >= $2) ────────────────────────────────────
|
|
54
51
|
semver_gte() {
|
|
55
|
-
# strip pre-release suffix for comparison
|
|
56
52
|
local a b
|
|
57
53
|
a=$(echo "$1" | sed 's/-.*//')
|
|
58
|
-
b=$(echo "$2" | sed 's
|
|
54
|
+
b=$(echo "$2" | sed 's/-.*//')
|
|
59
55
|
[ "$(printf '%s\n%s\n' "$a" "$b" | sort -V | head -1)" = "$b" ]
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
detect_shell_rc() {
|
|
63
59
|
case "${SHELL:-}" in
|
|
64
|
-
*/zsh) echo "$HOME/.zshrc"
|
|
60
|
+
*/zsh) echo "$HOME/.zshrc" ;;
|
|
65
61
|
*/bash)
|
|
66
|
-
[ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc"
|
|
67
|
-
;;
|
|
62
|
+
[ -f "$HOME/.bash_profile" ] && echo "$HOME/.bash_profile" || echo "$HOME/.bashrc" ;;
|
|
68
63
|
*/fish) echo "$HOME/.config/fish/config.fish" ;;
|
|
69
64
|
*) echo "$HOME/.profile" ;;
|
|
70
65
|
esac
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if [[ "${SHELL:-}" == */fish ]]; then
|
|
84
|
-
export_line="set -gx PATH \$PATH ${bin_dir}"
|
|
68
|
+
# ── Resolve GitHub release ────────────────────────────────────────────────────
|
|
69
|
+
fetch_release_info() {
|
|
70
|
+
local url
|
|
71
|
+
if [ "$CHANNEL" = "beta" ]; then
|
|
72
|
+
# latest pre-release (first entry that has prerelease:true)
|
|
73
|
+
url="https://api.github.com/repos/${REPO}/releases"
|
|
74
|
+
curl -fsSL "$url" \
|
|
75
|
+
| grep -E '"tag_name"|"prerelease"' \
|
|
76
|
+
| paste - - \
|
|
77
|
+
| awk -F'"' '/"prerelease": true/{print $4; exit}'
|
|
85
78
|
else
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
ok "PATH entry already in ${rc_file}"
|
|
91
|
-
return
|
|
79
|
+
# latest stable release
|
|
80
|
+
curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
|
|
81
|
+
| grep '"tag_name"' \
|
|
82
|
+
| sed 's/.*"tag_name": *"\([^"]*\)".*/\1/'
|
|
92
83
|
fi
|
|
93
|
-
|
|
94
|
-
echo "" >> "$rc_file"
|
|
95
|
-
echo "# added by unified-tvdevelopment-cli installer" >> "$rc_file"
|
|
96
|
-
echo "$export_line" >> "$rc_file"
|
|
97
|
-
ok "Added PATH entry to ${rc_file}"
|
|
98
|
-
export PATH="${PATH}:${bin_dir}"
|
|
99
84
|
}
|
|
100
85
|
|
|
101
|
-
# ──
|
|
86
|
+
# ── Banner ────────────────────────────────────────────────────────────────────
|
|
102
87
|
banner
|
|
103
88
|
|
|
89
|
+
# ── Resolve release tag ───────────────────────────────────────────────────────
|
|
90
|
+
step "Resolving latest ${CHANNEL} release from GitHub"
|
|
91
|
+
|
|
92
|
+
RELEASE_TAG=$(fetch_release_info)
|
|
93
|
+
[ -z "$RELEASE_TAG" ] && fail "Could not resolve release tag from GitHub. Check https://github.com/${REPO}/releases"
|
|
94
|
+
|
|
95
|
+
RELEASE_VERSION="${RELEASE_TAG#v}"
|
|
96
|
+
info "Release : ${RELEASE_TAG}"
|
|
97
|
+
|
|
98
|
+
# Download URL for the cli.mjs asset attached to the release
|
|
99
|
+
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/cli.mjs"
|
|
100
|
+
|
|
101
|
+
# ── Idempotency check ─────────────────────────────────────────────────────────
|
|
104
102
|
step "Checking existing installation"
|
|
105
103
|
|
|
106
104
|
INSTALLED_VER=""
|
|
107
|
-
LATEST_VER=""
|
|
108
|
-
|
|
109
105
|
if command -v "$BIN" &>/dev/null; then
|
|
110
|
-
INSTALLED_VER=$(
|
|
111
|
-
| grep "$PACKAGE" | sed 's/.*@//' | tr -d '[:space:]' || true)
|
|
112
|
-
LATEST_VER=$(npm show "${PACKAGE}@${NPM_TAG}" version 2>/dev/null || true)
|
|
113
|
-
|
|
106
|
+
INSTALLED_VER=$("$BIN" --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+[^ ]*' | head -1 || true)
|
|
114
107
|
ok "${BIN} already installed"
|
|
115
108
|
[ -n "$INSTALLED_VER" ] && info "Installed : ${INSTALLED_VER}"
|
|
116
|
-
|
|
109
|
+
info "Latest : ${RELEASE_VERSION} (${CHANNEL})"
|
|
117
110
|
|
|
118
|
-
if [ -n "$INSTALLED_VER" ] &&
|
|
111
|
+
if [ -n "$INSTALLED_VER" ] && semver_gte "$INSTALLED_VER" "$RELEASE_VERSION"; then
|
|
119
112
|
ok "Already up to date — nothing to do"
|
|
120
113
|
echo ""
|
|
121
114
|
echo -e " ${BOLD}Run: ${INDIGO}${BIN}${RESET}"
|
|
122
115
|
echo ""
|
|
123
116
|
exit 0
|
|
124
117
|
fi
|
|
125
|
-
|
|
126
118
|
info "Update available — reinstalling"
|
|
127
119
|
else
|
|
128
120
|
info "${BIN} not yet installed — starting fresh install"
|
|
@@ -162,22 +154,49 @@ NODE_MAJOR=$(node --version | sed 's/v//' | cut -d. -f1)
|
|
|
162
154
|
|
|
163
155
|
ok "Node.js $(node --version)"
|
|
164
156
|
|
|
165
|
-
# ──
|
|
166
|
-
step "
|
|
167
|
-
|
|
168
|
-
ok "npm $(npm --version)"
|
|
157
|
+
# ── Download & install binary from GitHub Release ────────────────────────────
|
|
158
|
+
step "Downloading ${BIN} ${RELEASE_TAG} from GitHub"
|
|
159
|
+
info "Source: ${DOWNLOAD_URL}"
|
|
169
160
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
ok "${
|
|
161
|
+
INSTALL_DIR="${HOME}/.local/bin"
|
|
162
|
+
mkdir -p "$INSTALL_DIR"
|
|
163
|
+
BIN_PATH="${INSTALL_DIR}/${BIN}"
|
|
164
|
+
|
|
165
|
+
if curl -fsSL --output "$BIN_PATH" "$DOWNLOAD_URL"; then
|
|
166
|
+
chmod +x "$BIN_PATH"
|
|
167
|
+
ok "Installed to ${BIN_PATH}"
|
|
168
|
+
else
|
|
169
|
+
# fallback: try npm if GitHub download fails
|
|
170
|
+
warn "GitHub download failed — falling back to npm"
|
|
171
|
+
! command -v npm &>/dev/null && fail "npm not found. Install Node.js from https://nodejs.org"
|
|
172
|
+
NPM_TAG="latest"
|
|
173
|
+
[ "$CHANNEL" = "beta" ] && NPM_TAG="beta"
|
|
174
|
+
npm install -g "unified-tvdevelopment-cli@${NPM_TAG}" 2>&1 | grep -v "^npm warn" | grep -v "^$" || true
|
|
175
|
+
fi
|
|
177
176
|
|
|
178
177
|
# ── PATH ──────────────────────────────────────────────────────────────────────
|
|
179
178
|
step "Setting up PATH"
|
|
180
|
-
|
|
179
|
+
|
|
180
|
+
rc_file=$(detect_shell_rc)
|
|
181
|
+
export_line="export PATH=\"\$PATH:${INSTALL_DIR}\""
|
|
182
|
+
|
|
183
|
+
if echo ":${PATH}:" | grep -q ":${INSTALL_DIR}:"; then
|
|
184
|
+
ok "PATH already contains ${INSTALL_DIR}"
|
|
185
|
+
elif [[ "${SHELL:-}" == */fish ]]; then
|
|
186
|
+
echo "set -gx PATH \$PATH ${INSTALL_DIR}" >> "$rc_file"
|
|
187
|
+
ok "Added PATH entry to ${rc_file}"
|
|
188
|
+
else
|
|
189
|
+
if ! grep -qF "$INSTALL_DIR" "$rc_file" 2>/dev/null; then
|
|
190
|
+
echo "" >> "$rc_file"
|
|
191
|
+
echo "# added by tvdev-cli installer" >> "$rc_file"
|
|
192
|
+
echo "$export_line" >> "$rc_file"
|
|
193
|
+
ok "Added PATH entry to ${rc_file}"
|
|
194
|
+
else
|
|
195
|
+
ok "PATH entry already in ${rc_file}"
|
|
196
|
+
fi
|
|
197
|
+
export PATH="${PATH}:${INSTALL_DIR}"
|
|
198
|
+
fi
|
|
199
|
+
|
|
181
200
|
hash -r 2>/dev/null || true
|
|
182
201
|
|
|
183
202
|
if command -v "$BIN" &>/dev/null; then
|
|
@@ -205,7 +224,7 @@ fi
|
|
|
205
224
|
if command -v adb &>/dev/null; then
|
|
206
225
|
ok "adb (Fire TV / Android TV) → $(command -v adb)"
|
|
207
226
|
else
|
|
208
|
-
warn "adb not found → brew install android-platform-tools
|
|
227
|
+
warn "adb not found → brew install android-platform-tools"
|
|
209
228
|
fi
|
|
210
229
|
|
|
211
230
|
if command -v inputd-cli &>/dev/null; then
|
|
@@ -217,10 +236,10 @@ fi
|
|
|
217
236
|
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
218
237
|
echo ""
|
|
219
238
|
echo -e "${BOLD}${INDIGO} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
|
|
220
|
-
echo -e "${BOLD}${GREEN} ✓ Installation complete
|
|
239
|
+
echo -e "${BOLD}${GREEN} ✓ Installation complete! (${RELEASE_TAG})${RESET}"
|
|
221
240
|
echo ""
|
|
222
241
|
echo -e " Launch TV Dev Manager: ${BOLD}${INDIGO}${BIN}${RESET}"
|
|
223
242
|
echo ""
|
|
224
|
-
echo -e " ${DIM}GitHub : https://github.com/
|
|
243
|
+
echo -e " ${DIM}GitHub : https://github.com/tvdev-cli/tvdev-cli${RESET}"
|
|
225
244
|
echo -e " ${DIM}npm : https://npmjs.com/package/unified-tvdevelopment-cli${RESET}"
|
|
226
245
|
echo ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unified-tvdevelopment-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Universal TUI manager for Smart TV development — LG webOS, Samsung Tizen, Amazon Fire TV, Android TV",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "mkdir -p dist && esbuild src/index.js --bundle --
|
|
13
|
+
"build": "mkdir -p dist && esbuild src/index.js --bundle --alias:react-devtools-core=./scripts/devtools-stub.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\" --outfile=dist/_bundle.mjs --loader:.js=jsx && printf '#!/usr/bin/env node\\n' | cat - dist/_bundle.mjs > dist/cli.mjs && chmod +x dist/cli.mjs && rm dist/_bundle.mjs",
|
|
14
14
|
"start": "npm run build && node dist/cli.mjs",
|
|
15
15
|
"dev": "npm run build && node dist/cli.mjs",
|
|
16
16
|
"prepare": "npm run build",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/tvdev-cli/
|
|
42
|
+
"url": "git+https://github.com/tvdev-cli/tvdev-cli.git"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
45
|
"dist/",
|