Fix measure upstream for Node.js

[GitHub #126]
This commit is contained in:
Aoran Zeng 2024-11-22 11:02:03 +08:00
parent f9d360d2bf
commit 7c75b37d09
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 16 additions and 20 deletions

View File

@ -71,8 +71,6 @@ pl_nodejs_setsrc (char *option)
chsrc_note2 (msg); chsrc_note2 (msg);
} }
chsrc_set_measure_upstream (PL_NodeJS_NPM_Upstream_Measure_URL);
bool npm_exist, yarn_exist, pnpm_exist; bool npm_exist, yarn_exist, pnpm_exist;
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist); pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);

View File

@ -40,8 +40,6 @@ pl_nodejs_yarn_getsrc (char *option)
void void
pl_nodejs_yarn_setsrc (char *option) pl_nodejs_yarn_setsrc (char *option)
{ {
chsrc_set_measure_upstream (PL_NodeJS_NPM_Upstream_Measure_URL);
Source_t source; Source_t source;
chsrc_yield_for_the_source (pl_nodejs); chsrc_yield_for_the_source (pl_nodejs);
if (ProgMode_Target_Group!=true) if (ProgMode_Target_Group!=true)

View File

@ -8,15 +8,19 @@
* Last Modified : <2024-11-22> * Last Modified : <2024-11-22>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static MirrorSite_t static SourceProvider_t UpstreamNpm =
NpmMirror = { {
"upstream", "npmjs.org", "上游默认源 npmjs.org", "https://www.npmjs.com/",
{NotSkip, NA, NA, "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"}
};
static MirrorSite_t NpmMirror =
{
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/", "npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
// 注意,下面这个是跳转后的地址,不确定未来会不会改变 // 注意,下面这个是跳转后的地址,不确定未来会不会改变
{NotSkip, NA, NA, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.22.0/tfjs-4.22.0.tgz"} // 29MB {NotSkip, NA, NA, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.22.0/tfjs-4.22.0.tgz"} // 29MB
}; };
#define PL_NodeJS_NPM_Upstream_Measure_URL "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"
/** /**
* @update 2024-09-23 * @update 2024-09-23
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-MirrorSite * @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-MirrorSite
@ -27,12 +31,12 @@ NpmMirror = {
* } * }
* *
*/ */
static Source_t static Source_t pl_nodejs_sources[] =
pl_nodejs_sources[] = { {
{&UpstreamProvider, "https://registry.npmjs.org/"}, /* @note 根据 pnpm 官网,有最后的斜线 */ {&UpstreamNpm, "https://registry.npmjs.org/"}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com"}, {&NpmMirror, "https://registry.npmmirror.com"},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"}, {&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/"}, {&Tencent, "https://mirrors.cloud.tencent.com/npm/"},
}; };
def_sources_n(pl_nodejs); def_sources_n(pl_nodejs);
@ -44,8 +48,8 @@ def_sources_n(pl_nodejs);
* @sync https://github.com/RubyMetric/chsrc/discussions/85 * @sync https://github.com/RubyMetric/chsrc/discussions/85
* *
*/ */
static Source_t static Source_t pl_nodejs_binary_release_sources[] =
pl_nodejs_binary_release_sources[] = { {
{&UpstreamProvider, "https://nodejs.org/dist/"}, {&UpstreamProvider, "https://nodejs.org/dist/"},
{&NpmMirror, "https://npmmirror.com/mirrors"}, {&NpmMirror, "https://npmmirror.com/mirrors"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/"}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/"},

View File

@ -26,8 +26,6 @@ pl_nodejs_npm_getsrc (char *option)
void void
pl_nodejs_npm_setsrc (char *option) pl_nodejs_npm_setsrc (char *option)
{ {
chsrc_set_measure_upstream (PL_NodeJS_NPM_Upstream_Measure_URL);
Source_t source; Source_t source;
chsrc_yield_for_the_source (pl_nodejs); chsrc_yield_for_the_source (pl_nodejs);
if (ProgMode_Target_Group!=true) if (ProgMode_Target_Group!=true)

View File

@ -27,8 +27,6 @@ pl_nodejs_pnpm_getsrc (char *option)
void void
pl_nodejs_pnpm_setsrc (char *option) pl_nodejs_pnpm_setsrc (char *option)
{ {
chsrc_set_measure_upstream (PL_NodeJS_NPM_Upstream_Measure_URL);
Source_t source; Source_t source;
chsrc_yield_for_the_source (pl_nodejs); chsrc_yield_for_the_source (pl_nodejs);
if (ProgMode_Target_Group!=true) if (ProgMode_Target_Group!=true)