@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 +7 -2
- package/install.sh +9 -7
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -59,10 +59,15 @@ if (!PKG) {
|
|
|
59
59
|
process.exit(1);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
// Auto-detect best registry (
|
|
62
|
+
// Auto-detect best registry (measure latency; fall back to npmmirror if slow/unreachable)
|
|
63
63
|
let registryFlag = "";
|
|
64
64
|
try {
|
|
65
|
-
|
|
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 (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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"
|