sloss-cli 1.3.1 → 1.3.3

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.
Files changed (2) hide show
  1. package/build.sh +39 -5
  2. package/package.json +4 -1
package/build.sh CHANGED
@@ -208,13 +208,24 @@ echo ""
208
208
  echo "📤 Uploading to Sloss..."
209
209
 
210
210
  # Resolve Sloss URL and API key
211
- UPLOAD_URL="${SLOSS_URL:-https://sloss.ngrok.app}/upload"
211
+ CREDS_FILE="$HOME/.config/sloss/credentials.json"
212
+
213
+ # Resolve Sloss URL: env var > credentials.json > default
214
+ if [[ -n "${SLOSS_URL:-}" ]]; then
215
+ UPLOAD_URL="${SLOSS_URL}/upload"
216
+ elif [[ -f "$CREDS_FILE" ]]; then
217
+ CREDS_URL=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).url||'')}catch{console.log('')}")
218
+ UPLOAD_URL="${CREDS_URL:-https://sloss.ngrok.app}/upload"
219
+ else
220
+ UPLOAD_URL="https://sloss.ngrok.app/upload"
221
+ fi
212
222
 
223
+ # Resolve API key: env var > credentials.json > error
213
224
  if [[ -z "${SLOSS_API_KEY:-}" ]]; then
214
- CREDS_FILE="$HOME/.config/sloss/credentials.json"
215
225
  if [[ -f "$CREDS_FILE" ]]; then
216
- SLOSS_API_KEY=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).api_key)")
217
- else
226
+ SLOSS_API_KEY=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('$CREDS_FILE','utf8')).apiKey||'')}catch{console.log('')}")
227
+ fi
228
+ if [[ -z "${SLOSS_API_KEY:-}" ]]; then
218
229
  echo "❌ No SLOSS_API_KEY env var and no ~/.config/sloss/credentials.json found."
219
230
  echo " Artifact is at: $ARTIFACT_PATH"
220
231
  exit 1
@@ -252,6 +263,25 @@ if [[ "$HTTP_CODE" -lt 200 || "$HTTP_CODE" -ge 300 ]]; then
252
263
  exit 1
253
264
  fi
254
265
 
266
+ # ─── Submit to TestFlight (production only) ─────────────────────────────────
267
+ TESTFLIGHT_STATUS=""
268
+ if [[ "$PROFILE" == "production" && "$PLATFORM" == "ios" ]]; then
269
+ echo ""
270
+ echo "✈️ Submitting to TestFlight..."
271
+ set +e
272
+ (cd "$PROJECT_DIR" && eas submit --platform ios --path "$ARTIFACT_PATH" --non-interactive --wait 2>&1) | tee /tmp/sloss-submit.log
273
+ SUBMIT_EXIT=${PIPESTATUS[0]}
274
+ set -e
275
+
276
+ if [[ $SUBMIT_EXIT -eq 0 ]]; then
277
+ TESTFLIGHT_STATUS="submitted"
278
+ echo "✅ Submitted to TestFlight"
279
+ else
280
+ TESTFLIGHT_STATUS="failed"
281
+ echo "⚠️ TestFlight submission failed (exit $SUBMIT_EXIT). IPA is still on Sloss."
282
+ fi
283
+ fi
284
+
255
285
  # ─── Print results ──────────────────────────────────────────────────────────
256
286
  PAGE_URL=$(node -e "try{console.log(JSON.parse(process.argv[1]).page_url||'')}catch{console.log('')}" "$RESPONSE_BODY")
257
287
  INSTALL_URL=$(node -e "try{console.log(JSON.parse(process.argv[1]).install_url||'')}catch{console.log('')}" "$RESPONSE_BODY")
@@ -268,7 +298,11 @@ echo "║ Artifact: $ARTIFACT_PATH"
268
298
  if [[ -n "$PAGE_URL" ]]; then
269
299
  echo "║ Page: $PAGE_URL"
270
300
  fi
271
- if [[ -n "$INSTALL_URL" ]]; then
301
+ if [[ "$TESTFLIGHT_STATUS" == "submitted" ]]; then
302
+ echo "║ TestFlight: ✅ Submitted"
303
+ elif [[ "$TESTFLIGHT_STATUS" == "failed" ]]; then
304
+ echo "║ TestFlight: ⚠️ Failed (check logs)"
305
+ elif [[ -n "$INSTALL_URL" ]]; then
272
306
  echo "║ Install: $INSTALL_URL"
273
307
  fi
274
308
  echo "╚══════════════════════════════════════════╝"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sloss-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "CLI for Sloss — a self-hosted IPA/APK distribution server",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,6 +30,9 @@
30
30
  "type": "git",
31
31
  "url": "git+https://github.com/aualdrich/sloss-cli.git"
32
32
  },
33
+ "scripts": {
34
+ "test": "bash test/build.test.sh"
35
+ },
33
36
  "engines": {
34
37
  "node": ">=18.0.0"
35
38
  },