noupload 1.0.5 → 1.0.6
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/dist/index.js +2 -1
- package/install.sh +171 -52
- package/package.json +1 -1
- package/src/cli.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -77794,10 +77794,11 @@ var setup = defineCommand({
|
|
|
77794
77794
|
});
|
|
77795
77795
|
|
|
77796
77796
|
// src/cli.ts
|
|
77797
|
+
var VERSION = "1.0.6";
|
|
77797
77798
|
var main2 = defineCommand({
|
|
77798
77799
|
meta: {
|
|
77799
77800
|
name: "noupload",
|
|
77800
|
-
version:
|
|
77801
|
+
version: VERSION,
|
|
77801
77802
|
description: "Privacy-first CLI for PDF, Image, Audio, and QR operations - all processed locally"
|
|
77802
77803
|
},
|
|
77803
77804
|
subCommands: {
|
package/install.sh
CHANGED
|
@@ -3,66 +3,185 @@ set -e
|
|
|
3
3
|
|
|
4
4
|
# Configuration
|
|
5
5
|
BINARY_NAME="noupload"
|
|
6
|
+
PACKAGE_NAME="noupload"
|
|
6
7
|
INSTALL_DIR="/usr/local/bin"
|
|
8
|
+
NPM_REGISTRY="https://registry.npmjs.org/noupload/latest"
|
|
7
9
|
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
# Parse flags
|
|
11
|
+
FORCE_BINARY=false
|
|
12
|
+
for arg in "$@"; do
|
|
13
|
+
case $arg in
|
|
14
|
+
--binary)
|
|
15
|
+
FORCE_BINARY=true
|
|
16
|
+
shift
|
|
17
|
+
;;
|
|
18
|
+
esac
|
|
19
|
+
done
|
|
11
20
|
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
fi
|
|
21
|
+
# Detect package manager (priority: bun > pnpm > yarn > npm)
|
|
22
|
+
detect_package_manager() {
|
|
23
|
+
if [ "$FORCE_BINARY" = true ]; then
|
|
24
|
+
echo "none"
|
|
25
|
+
return
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if command -v bun >/dev/null 2>&1; then echo "bun"; return; fi
|
|
29
|
+
if command -v pnpm >/dev/null 2>&1; then echo "pnpm"; return; fi
|
|
30
|
+
if command -v yarn >/dev/null 2>&1; then echo "yarn"; return; fi
|
|
31
|
+
if command -v npm >/dev/null 2>&1; then echo "npm"; return; fi
|
|
32
|
+
echo "none"
|
|
33
|
+
}
|
|
21
34
|
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
35
|
+
# Get latest version from npm registry
|
|
36
|
+
get_latest_version() {
|
|
37
|
+
echo "🔍 Checking for updates..." >&2
|
|
38
|
+
VERSION=$(curl -fsSL "$NPM_REGISTRY" 2>/dev/null | grep -oE '"version":"[^"]*"' | cut -d'"' -f4)
|
|
39
|
+
echo "$VERSION"
|
|
40
|
+
}
|
|
27
41
|
|
|
28
|
-
|
|
42
|
+
# Get installed version
|
|
43
|
+
get_installed_version() {
|
|
44
|
+
if command -v noupload >/dev/null 2>&1; then
|
|
45
|
+
noupload --version 2>/dev/null | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo ""
|
|
46
|
+
else
|
|
47
|
+
echo ""
|
|
48
|
+
fi
|
|
49
|
+
}
|
|
29
50
|
|
|
30
|
-
#
|
|
31
|
-
|
|
51
|
+
# Function: Install via package manager
|
|
52
|
+
install_via_pm() {
|
|
53
|
+
local pm=$1
|
|
54
|
+
local version=$2
|
|
55
|
+
echo "📦 Detected $pm, installing via $pm..."
|
|
56
|
+
echo "Downloading noupload@$version..."
|
|
57
|
+
|
|
58
|
+
case $pm in
|
|
59
|
+
bun)
|
|
60
|
+
bun install -g noupload 2>&1
|
|
61
|
+
;;
|
|
62
|
+
pnpm)
|
|
63
|
+
pnpm install -g noupload 2>&1
|
|
64
|
+
;;
|
|
65
|
+
yarn)
|
|
66
|
+
yarn global add noupload 2>&1
|
|
67
|
+
;;
|
|
68
|
+
npm)
|
|
69
|
+
npm install -g noupload 2>&1
|
|
70
|
+
;;
|
|
71
|
+
esac
|
|
72
|
+
}
|
|
32
73
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
74
|
+
# Function: Install via binary download
|
|
75
|
+
install_via_binary() {
|
|
76
|
+
# Detect OS and Arch
|
|
77
|
+
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
78
|
+
ARCH="$(uname -m)"
|
|
38
79
|
|
|
39
|
-
#
|
|
40
|
-
if [
|
|
41
|
-
|
|
42
|
-
|
|
80
|
+
# Map architecture names
|
|
81
|
+
if [ "$ARCH" = "x86_64" ]; then
|
|
82
|
+
ARCH="x64"
|
|
83
|
+
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
|
84
|
+
ARCH="arm64"
|
|
85
|
+
else
|
|
86
|
+
echo "❌ Unsupported architecture: $ARCH"
|
|
87
|
+
exit 1
|
|
43
88
|
fi
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
echo "
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
|
|
90
|
+
# Construct asset name
|
|
91
|
+
ASSET_NAME="${BINARY_NAME}-${OS}-${ARCH}"
|
|
92
|
+
if [ "$OS" = "windows" ]; then
|
|
93
|
+
ASSET_NAME="${ASSET_NAME}.exe"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
LATEST_URL="https://noupload.xyz/releases/${ASSET_NAME}"
|
|
97
|
+
|
|
98
|
+
echo "⬇️ Downloading binary (60MB)..."
|
|
99
|
+
echo "Downloading from $LATEST_URL..."
|
|
100
|
+
|
|
101
|
+
# Setup install directory
|
|
102
|
+
if [ ! -d "$INSTALL_DIR" ]; then
|
|
103
|
+
INSTALL_DIR="$HOME/.local/bin"
|
|
104
|
+
mkdir -p "$INSTALL_DIR"
|
|
105
|
+
|
|
106
|
+
# Add to PATH if not present
|
|
107
|
+
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
|
|
108
|
+
[ -f "$HOME/.bashrc" ] && echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$HOME/.bashrc"
|
|
109
|
+
[ -f "$HOME/.zshrc" ] && echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$HOME/.zshrc"
|
|
110
|
+
fi
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
# Download
|
|
114
|
+
TEMP_FILE="/tmp/${BINARY_NAME}"
|
|
115
|
+
if command -v curl >/dev/null 2>&1; then
|
|
116
|
+
curl -fsSL "$LATEST_URL" -o "$TEMP_FILE"
|
|
117
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
118
|
+
wget -qO "$TEMP_FILE" "$LATEST_URL"
|
|
119
|
+
else
|
|
120
|
+
echo "❌ Error: Need curl or wget to download."
|
|
121
|
+
exit 1
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# Install
|
|
125
|
+
chmod +x "$TEMP_FILE"
|
|
126
|
+
|
|
127
|
+
if [ -w "$INSTALL_DIR" ]; then
|
|
128
|
+
mv "$TEMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
|
|
129
|
+
else
|
|
130
|
+
sudo mv "$TEMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
|
|
131
|
+
fi
|
|
132
|
+
}
|
|
60
133
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
134
|
+
# Main installation logic
|
|
135
|
+
main() {
|
|
136
|
+
# Check versions
|
|
137
|
+
INSTALLED_VERSION=$(get_installed_version)
|
|
138
|
+
LATEST_VERSION=$(get_latest_version)
|
|
139
|
+
|
|
140
|
+
# Handle version check failure
|
|
141
|
+
if [ -z "$LATEST_VERSION" ]; then
|
|
142
|
+
echo "⚠️ Could not fetch latest version, proceeding with install..."
|
|
143
|
+
LATEST_VERSION="latest"
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# Check if already up to date
|
|
147
|
+
if [ -n "$INSTALLED_VERSION" ] && [ "$INSTALLED_VERSION" = "$LATEST_VERSION" ]; then
|
|
148
|
+
echo "✅ noupload is already installed and up to date (v$INSTALLED_VERSION)"
|
|
149
|
+
exit 0
|
|
150
|
+
elif [ -n "$INSTALLED_VERSION" ]; then
|
|
151
|
+
echo "📦 Updating noupload from v$INSTALLED_VERSION to v$LATEST_VERSION..."
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# Detect package manager
|
|
155
|
+
PM=$(detect_package_manager)
|
|
156
|
+
|
|
157
|
+
if [ "$PM" != "none" ]; then
|
|
158
|
+
# Try package manager first
|
|
159
|
+
if install_via_pm "$PM" "$LATEST_VERSION"; then
|
|
160
|
+
FINAL_VERSION=$(get_installed_version)
|
|
161
|
+
echo "✅ Installed noupload v$FINAL_VERSION"
|
|
162
|
+
echo "Run 'noupload setup' to install system dependencies."
|
|
163
|
+
exit 0
|
|
164
|
+
else
|
|
165
|
+
# PM install failed, fallback to binary
|
|
166
|
+
echo "⚠️ $PM install failed"
|
|
167
|
+
echo "⬇️ Falling back to binary download (60MB)..."
|
|
168
|
+
install_via_binary
|
|
169
|
+
echo "✅ Installed noupload v$LATEST_VERSION"
|
|
170
|
+
echo "Run 'noupload setup' to install system dependencies."
|
|
171
|
+
exit 0
|
|
172
|
+
fi
|
|
173
|
+
else
|
|
174
|
+
# No package manager found, use binary
|
|
175
|
+
if [ "$FORCE_BINARY" = true ]; then
|
|
176
|
+
echo "⬇️ Installing standalone binary (--binary flag)..."
|
|
177
|
+
else
|
|
178
|
+
echo "⬇️ No package manager found, installing standalone binary..."
|
|
179
|
+
fi
|
|
180
|
+
install_via_binary
|
|
181
|
+
echo "✅ Installed noupload v$LATEST_VERSION"
|
|
182
|
+
echo "Run 'noupload setup' to install system dependencies."
|
|
183
|
+
fi
|
|
184
|
+
}
|
|
66
185
|
|
|
67
|
-
|
|
68
|
-
|
|
186
|
+
# Run main
|
|
187
|
+
main
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -6,10 +6,13 @@ import { pdf } from './commands/pdf';
|
|
|
6
6
|
import { qr } from './commands/qr';
|
|
7
7
|
import { setup } from './commands/setup';
|
|
8
8
|
|
|
9
|
+
// Version synced with package.json - update both when releasing
|
|
10
|
+
export const VERSION = '1.0.6';
|
|
11
|
+
|
|
9
12
|
export const main = defineCommand({
|
|
10
13
|
meta: {
|
|
11
14
|
name: 'noupload',
|
|
12
|
-
version:
|
|
15
|
+
version: VERSION,
|
|
13
16
|
description:
|
|
14
17
|
'Privacy-first CLI for PDF, Image, Audio, and QR operations - all processed locally',
|
|
15
18
|
},
|