@syengup/friday-channel-next 0.0.17 → 0.0.18

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/install.js CHANGED
@@ -59,10 +59,15 @@ if (!PKG) {
59
59
  process.exit(1);
60
60
  }
61
61
 
62
- // Auto-detect best registry (if npmjs.org is unreachable, use npmmirror)
62
+ // Auto-detect best registry (measure latency; fall back to npmmirror if slow/unreachable)
63
63
  let registryFlag = "";
64
64
  try {
65
- execSync('curl -s --connect-timeout 3 --max-time 5 https://registry.npmjs.org/ >/dev/null 2>&1');
65
+ const start = Date.now();
66
+ execSync('curl -s -o /dev/null --connect-timeout 2 --max-time 4 https://registry.npmjs.org/', { stdio: "pipe", timeout: 6000 });
67
+ if (Date.now() - start > 1500) {
68
+ warn("Default registry slow, using https://registry.npmmirror.com");
69
+ registryFlag = "--registry=https://registry.npmmirror.com";
70
+ }
66
71
  } catch {
67
72
  warn("Default registry unreachable, using https://registry.npmmirror.com");
68
73
  registryFlag = "--registry=https://registry.npmmirror.com";
package/install.sh CHANGED
@@ -39,13 +39,15 @@ else
39
39
  exit 1
40
40
  fi
41
41
 
42
- # Auto-detect best registry (if npmjs.org is unreachable, use npmmirror)
43
- if curl -s --connect-timeout 3 https://registry.npmjs.org/ >/dev/null 2>&1; then
44
- REGISTRY=""
45
- else
46
- warn "Default registry unreachable, using https://registry.npmmirror.com"
47
- REGISTRY="--registry=https://registry.npmmirror.com"
48
- fi
42
+ # Auto-detect best registry (measure latency; fall back to npmmirror if slow/unreachable)
43
+ TIME=$(curl -s -o /dev/null -w '%{time_total}' --connect-timeout 2 --max-time 4 https://registry.npmjs.org/ 2>/dev/null || echo "999")
44
+ case "$TIME" in
45
+ 0.*) ;; # under 1s — fast enough
46
+ *)
47
+ warn "Default registry slow/unreachable, using https://registry.npmmirror.com"
48
+ REGISTRY="--registry=https://registry.npmmirror.com"
49
+ ;;
50
+ esac
49
51
 
50
52
  if [ ! -f "$OPENCLAW_CONFIG" ]; then
51
53
  err "OpenClaw config not found at $OPENCLAW_CONFIG"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syengup/friday-channel-next",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "OpenClaw Friday Next Apple channel plugin",
5
5
  "type": "module",
6
6
  "files": [