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 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: "1.0.0",
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
- # Detect OS and Arch
9
- OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
10
- ARCH="$(uname -m)"
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
- # Map architecture names
13
- if [ "$ARCH" == "x86_64" ]; then
14
- ARCH="x64"
15
- elif [ "$ARCH" == "aarch64" ] || [ "$ARCH" == "arm64" ]; then
16
- ARCH="arm64"
17
- else
18
- echo "❌ Unsupported architecture: $ARCH"
19
- exit 1
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
- # Construct asset name (e.g., noupload-linux-x64)
23
- ASSET_NAME="${BINARY_NAME}-${OS}-${ARCH}"
24
- if [ "$OS" == "windows" ]; then
25
- ASSET_NAME="${ASSET_NAME}.exe"
26
- fi
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
- echo "⬇️ Installing ${BINARY_NAME} for ${OS}/${ARCH}..."
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
- # Find latest release URL
31
- LATEST_URL="https://noupload.xyz/releases/${ASSET_NAME}"
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
- # Setup install directory
34
- if [ ! -d "$INSTALL_DIR" ]; then
35
- # Fallback to local bin if /usr/local/bin fails or doesn't exist
36
- INSTALL_DIR="$HOME/.local/bin"
37
- mkdir -p "$INSTALL_DIR"
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
- # Add to PATH if not present
40
- if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
41
- echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$HOME/.bashrc"
42
- echo "export PATH=\"\$PATH:$INSTALL_DIR\"" >> "$HOME/.zshrc"
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
- fi
45
-
46
- # Download
47
- TEMP_FILE="/tmp/${BINARY_NAME}"
48
- if command -v curl >/dev/null 2>&1; then
49
- curl -fsSL "$LATEST_URL" -o "$TEMP_FILE"
50
- elif command -v wget >/dev/null 2>&1; then
51
- wget -qO "$TEMP_FILE" "$LATEST_URL"
52
- else
53
- echo " Error: Need curl or wget to download."
54
- exit 1
55
- fi
56
-
57
- # Install
58
- chmod +x "$TEMP_FILE"
59
- echo "📦 Moving to $INSTALL_DIR..."
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
- if [ -w "$INSTALL_DIR" ]; then
62
- mv "$TEMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
63
- else
64
- sudo mv "$TEMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
65
- fi
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
- echo "✅ Installed successfully!"
68
- echo "Run 'noupload setup' to install system dependencies."
186
+ # Run main
187
+ main
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noupload",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Privacy-first CLI for PDF, Image, Audio, and QR operations - all processed locally",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
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: '1.0.0',
15
+ version: VERSION,
13
16
  description:
14
17
  'Privacy-first CLI for PDF, Image, Audio, and QR operations - all processed locally',
15
18
  },