terminull-arcade 1.0.3 → 1.0.4

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/launch.ps1 ADDED
@@ -0,0 +1,110 @@
1
+ # Terminull Arcade Universal Launcher for Windows
2
+ # Automatically detects and installs Node.js if missing, then launches Terminull
3
+
4
+ param (
5
+ [switch]$Auto
6
+ )
7
+
8
+ $ErrorActionPreference = "Continue"
9
+
10
+ Write-Host ""
11
+ Write-Host "=============================================" -ForegroundColor Cyan
12
+ Write-Host " TERMINULL ARCADE LAUNCHER " -ForegroundColor Yellow
13
+ Write-Host "=============================================" -ForegroundColor Cyan
14
+ Write-Host ""
15
+
16
+ function Refresh-PathEnvironment {
17
+ $machinePath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
18
+ $userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
19
+ $env:PATH = "$machinePath;$userPath"
20
+
21
+ $commonNodePaths = @(
22
+ "$env:ProgramFiles\nodejs",
23
+ "${env:ProgramFiles(x86)}\nodejs",
24
+ "$env:LOCALAPPDATA\Programs\node"
25
+ )
26
+
27
+ foreach ($path in $commonNodePaths) {
28
+ if ((Test-Path $path) -and ($env:PATH -notlike "*$path*")) {
29
+ $env:PATH = "$path;$env:PATH"
30
+ }
31
+ }
32
+ }
33
+
34
+ Refresh-PathEnvironment
35
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
36
+
37
+ if (-not $nodeCmd) {
38
+ Write-Host "[!] Node.js is not detected on your system." -ForegroundColor Yellow
39
+ Write-Host "[>] Automatically installing Node.js LTS for you now..." -ForegroundColor Cyan
40
+ Write-Host " This only needs to happen once. Please wait a moment..." -ForegroundColor Gray
41
+ Write-Host ""
42
+
43
+ $installed = $false
44
+
45
+ # Method 1: Windows Package Manager (winget)
46
+ $wingetCmd = Get-Command winget -ErrorAction SilentlyContinue
47
+ if ($wingetCmd) {
48
+ try {
49
+ Write-Host ">>> Installing via Windows Package Manager (winget)..." -ForegroundColor Cyan
50
+ $wingetProcess = Start-Process -FilePath "winget" -ArgumentList "install OpenJS.NodeJS.LTS --silent --accept-package-agreements --accept-source-agreements" -NoNewWindow -Wait -PassThru
51
+ if ($wingetProcess.ExitCode -eq 0) {
52
+ $installed = $true
53
+ }
54
+ } catch {
55
+ Write-Host "[!] winget install failed, trying direct installer download..." -ForegroundColor Yellow
56
+ }
57
+ }
58
+
59
+ # Method 2: Direct MSI installer download if winget not available or failed
60
+ if (-not $installed) {
61
+ try {
62
+ Write-Host ">>> Downloading Node.js LTS installer directly from nodejs.org..." -ForegroundColor Cyan
63
+ $installerUrl = "https://nodejs.org/dist/v20.18.1/node-v20.18.1-x64.msi"
64
+ $tempMsi = Join-Path $env:TEMP "nodejs_terminull_setup.msi"
65
+
66
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
67
+ Invoke-WebRequest -Uri $installerUrl -OutFile $tempMsi -UseBasicParsing
68
+
69
+ Write-Host ">>> Executing silent installation..." -ForegroundColor Cyan
70
+ $msiProcess = Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$tempMsi`" /qn /norestart" -Wait -PassThru
71
+ if ($msiProcess.ExitCode -eq 0 -or $msiProcess.ExitCode -eq 3010) {
72
+ $installed = $true
73
+ }
74
+ if (Test-Path $tempMsi) {
75
+ Remove-Item $tempMsi -Force -ErrorAction SilentlyContinue
76
+ }
77
+ } catch {
78
+ Write-Host "[!] Direct download failed: $_" -ForegroundColor Red
79
+ }
80
+ }
81
+
82
+ Refresh-PathEnvironment
83
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
84
+
85
+ if ($nodeCmd) {
86
+ Write-Host ""
87
+ Write-Host "[✓] Node.js successfully installed and activated!" -ForegroundColor Green
88
+ } else {
89
+ Write-Host ""
90
+ Write-Host "[!] Could not automatically complete Node.js installation." -ForegroundColor Red
91
+ Write-Host " Please download and run the installer from: https://nodejs.org" -ForegroundColor White
92
+ Write-Host " Then run this launcher again." -ForegroundColor Gray
93
+ exit 1
94
+ }
95
+ }
96
+
97
+ $nodeVersion = & node -v
98
+ Write-Host "[✓] Node.js Runtime Ready: $nodeVersion" -ForegroundColor Green
99
+ Write-Host ""
100
+
101
+ $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
102
+ $localCli = Join-Path $scriptDir "dist\cli.js"
103
+
104
+ if (Test-Path $localCli) {
105
+ Write-Host "Launching Terminull Arcade..." -ForegroundColor Cyan
106
+ & node $localCli
107
+ } else {
108
+ Write-Host "Launching Terminull Arcade via npx..." -ForegroundColor Cyan
109
+ & npx terminull-arcade
110
+ }
package/launch.sh ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env bash
2
+ # Terminull Arcade Universal Launcher for macOS / Linux
3
+ # Automatically detects and installs Node.js if missing, then launches Terminull
4
+
5
+ echo ""
6
+ echo "============================================="
7
+ echo " TERMINULL ARCADE LAUNCHER "
8
+ echo "============================================="
9
+ echo ""
10
+
11
+ refresh_paths() {
12
+ export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.nvm/versions/node/$(ls $HOME/.nvm/versions/node 2>/dev/null | tail -n 1)/bin:$PATH"
13
+ }
14
+
15
+ refresh_paths
16
+
17
+ if ! command -v node >/dev/null 2>&1; then
18
+ echo "[!] Node.js is not detected on your system."
19
+ echo "[>] Automatically installing Node.js LTS for you now..."
20
+ echo " This only needs to happen once. Please wait a moment..."
21
+ echo ""
22
+
23
+ if [[ "$OSTYPE" == "darwin"* ]]; then
24
+ # macOS
25
+ if command -v brew >/dev/null 2>&1; then
26
+ echo ">>> Installing Node.js via Homebrew..."
27
+ brew install node
28
+ else
29
+ echo ">>> Downloading official macOS installer package..."
30
+ PKG_TMP="/tmp/node-latest.pkg"
31
+ curl -fsSL "https://nodejs.org/dist/v20.18.1/node-v20.18.1.pkg" -o "$PKG_TMP"
32
+ sudo installer -pkg "$PKG_TMP" -target /
33
+ rm -f "$PKG_TMP"
34
+ fi
35
+ elif [ -f /etc/debian_version ] || command -v apt-get >/dev/null 2>&1; then
36
+ # Debian / Ubuntu / Mint
37
+ echo ">>> Installing Node.js via apt..."
38
+ sudo apt-get update -y && sudo apt-get install -y nodejs npm
39
+ elif [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ] || command -v dnf >/dev/null 2>&1; then
40
+ # Fedora / RHEL / CentOS
41
+ echo ">>> Installing Node.js via dnf..."
42
+ sudo dnf install -y nodejs npm
43
+ elif command -v pacman >/dev/null 2>&1; then
44
+ # Arch Linux
45
+ echo ">>> Installing Node.js via pacman..."
46
+ sudo pacman -Sy --noconfirm nodejs npm
47
+ elif command -v apk >/dev/null 2>&1; then
48
+ # Alpine
49
+ echo ">>> Installing Node.js via apk..."
50
+ sudo apk add --no-cache nodejs npm
51
+ else
52
+ echo "[!] Automatic package manager not detected."
53
+ echo " Please install Node.js manually from: https://nodejs.org"
54
+ exit 1
55
+ fi
56
+
57
+ refresh_paths
58
+ fi
59
+
60
+ if ! command -v node >/dev/null 2>&1; then
61
+ echo "[!] Could not automatically complete Node.js installation."
62
+ echo " Please install Node.js (v18+) manually from: https://nodejs.org"
63
+ exit 1
64
+ fi
65
+
66
+ NODE_VER=$(node -v)
67
+ echo "[✓] Node.js Runtime Ready: $NODE_VER"
68
+ echo ""
69
+
70
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
71
+ LOCAL_CLI="$SCRIPT_DIR/dist/cli.js"
72
+
73
+ if [ -f "$LOCAL_CLI" ]; then
74
+ echo "Launching Terminull Arcade..."
75
+ node "$LOCAL_CLI" "$@"
76
+ else
77
+ echo "Launching Terminull Arcade via npx..."
78
+ npx terminull-arcade "$@"
79
+ fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminull-arcade",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Enter the Terminull. Play beyond the prompt. A curated arcade of original terminal games.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,12 +21,18 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "README.md",
24
- "LICENSE"
24
+ "LICENSE",
25
+ "launch.ps1",
26
+ "launch.sh",
27
+ "terminull.cmd",
28
+ "terminull.ps1",
29
+ "terminull"
25
30
  ],
26
31
  "engines": {
27
32
  "node": ">=18.0.0"
28
33
  },
29
34
  "scripts": {
35
+ "start": "node ./dist/cli.js",
30
36
  "dev": "tsup --watch",
31
37
  "build": "tsup",
32
38
  "test": "vitest run",
package/terminull ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3
+ "$SCRIPT_DIR/launch.sh" "$@"
package/terminull.cmd ADDED
@@ -0,0 +1,16 @@
1
+ @echo off
2
+ setlocal
3
+ where node >nul 2>&1
4
+ if %ERRORLEVEL% equ 0 (
5
+ if exist "%~dp0dist\cli.js" (
6
+ node "%~dp0dist\cli.js" %*
7
+ goto :EOF
8
+ ) else (
9
+ npx terminull-arcade %*
10
+ goto :EOF
11
+ )
12
+ )
13
+
14
+ echo [!] Node.js not found on this system.
15
+ echo [^>] Automatically installing Node.js LTS for you now...
16
+ powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0launch.ps1"
package/terminull.ps1 ADDED
@@ -0,0 +1,7 @@
1
+ # Terminull Arcade PowerShell Command Launcher
2
+ param (
3
+ [Parameter(ValueFromRemainingArguments = $true)]
4
+ [string[]]$Args
5
+ )
6
+
7
+ & "$PSScriptRoot\launch.ps1" @Args