Open
Description
What problem does this feature solve?
The useTaobaoRegistry
flag may be set to true
even though they're outside China and it caused slow download speed and potential issues in the future.
The current decision process of the flag is that pinging the default and the mirror repositories and the winner of the promise race of them is used for downloading.
https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/shouldUseTaobao.js#L65
Countries close to China geographically like Japan is likely to be set true
with a highly probability at the process and get involved in mirror site problems.
The output of pinning to the both registries is below.
$ ping -c 10 registry.npmjs.org
PING registry.npmjs.org (104.16.19.35): 56 data bytes
64 bytes from 104.16.19.35: icmp_seq=0 ttl=56 time=14.654 ms
64 bytes from 104.16.19.35: icmp_seq=1 ttl=56 time=5.648 ms
64 bytes from 104.16.19.35: icmp_seq=2 ttl=56 time=8.810 ms
64 bytes from 104.16.19.35: icmp_seq=3 ttl=56 time=12.804 ms
64 bytes from 104.16.19.35: icmp_seq=4 ttl=56 time=13.898 ms
64 bytes from 104.16.19.35: icmp_seq=5 ttl=56 time=12.059 ms
64 bytes from 104.16.19.35: icmp_seq=6 ttl=56 time=7.670 ms
64 bytes from 104.16.19.35: icmp_seq=7 ttl=56 time=5.449 ms
64 bytes from 104.16.19.35: icmp_seq=8 ttl=56 time=5.936 ms
64 bytes from 104.16.19.35: icmp_seq=9 ttl=56 time=5.591 ms
--- registry.npmjs.org ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.449/9.252/14.654/3.547 ms
$ ping -c 10 registry.npm.taobao.org
PING registry.npm.taobao.org.w.cdngslb.com (202.47.28.95): 56 data bytes
64 bytes from 202.47.28.95: icmp_seq=0 ttl=52 time=8.073 ms
64 bytes from 202.47.28.95: icmp_seq=1 ttl=52 time=13.499 ms
64 bytes from 202.47.28.95: icmp_seq=2 ttl=52 time=8.884 ms
64 bytes from 202.47.28.95: icmp_seq=3 ttl=52 time=7.240 ms
64 bytes from 202.47.28.95: icmp_seq=4 ttl=52 time=13.869 ms
64 bytes from 202.47.28.95: icmp_seq=5 ttl=52 time=18.765 ms
64 bytes from 202.47.28.95: icmp_seq=6 ttl=52 time=6.975 ms
64 bytes from 202.47.28.95: icmp_seq=7 ttl=52 time=13.956 ms
64 bytes from 202.47.28.95: icmp_seq=8 ttl=52 time=6.983 ms
64 bytes from 202.47.28.95: icmp_seq=9 ttl=52 time=7.068 ms
--- registry.npm.taobao.org.w.cdngslb.com ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 6.975/10.531/18.765/3.953 ms
What does the proposed API look like?
I suggest pinning multi times and use the average time to decide the registry.