mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-23 10:59:29 +08:00
@@ -5,26 +5,9 @@
|
||||
* Contributors : Mr. Will <mr.will.com@outlook.com>
|
||||
* Created On : <2023-08-30>
|
||||
* Major Revision : 2
|
||||
* Last Modified : <2024-09-10>
|
||||
* Last Modified : <2024-09-13>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2024-04-18 更新
|
||||
* @note {
|
||||
* Sjtug, Tuna, Lzuoss, Jlu, Bfsu, 网易,搜狐 都没有
|
||||
* 腾讯软件源的npm源一直未证实是否可用
|
||||
* }
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_nodejs_sources[] = {
|
||||
{&Upstream, "https://registry.npmjs.org/"},
|
||||
{&NpmMirror, "https://registry.npmmirror.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/npm"}
|
||||
};
|
||||
def_sources_n(pl_nodejs);
|
||||
|
||||
|
||||
void
|
||||
pl_nodejs_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
|
||||
{
|
||||
@@ -79,11 +62,19 @@ pl_nodejs_getsrc (char *option)
|
||||
void
|
||||
pl_nodejs_setsrc (char *option)
|
||||
{
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "** Three package managers will be replaced for you at the same time: " \
|
||||
"npm, pnpm, yarn. If you need to change the source independently, " \
|
||||
"please run independently `chsrc set <pkg-manager>` **\n"
|
||||
: "** 将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager> **\n";
|
||||
chsrc_log (bdyellow(msg));
|
||||
}
|
||||
|
||||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
// chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
split_between_source_changing_process;
|
||||
ProgMode_Target_Group = true;
|
||||
chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
|
||||
if (npm_exist)
|
||||
{
|
||||
@@ -100,10 +91,7 @@ pl_nodejs_setsrc (char *option)
|
||||
if (pnpm_exist)
|
||||
{
|
||||
pl_nodejs_pnpm_setsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
// chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,19 +8,6 @@
|
||||
* Last Modified : <2024-09-13>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-04-08
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_nodejs_yarn_sources[] = {
|
||||
{&Upstream, "https://registry.npmjs.org/"}, // @note 根据 pnpm 官网,有最后的斜线
|
||||
{&NpmMirror, "https://registry.npmmirror.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/npm"}
|
||||
};
|
||||
def_sources_n(pl_nodejs_yarn);
|
||||
|
||||
|
||||
static double
|
||||
pl_nodejs_yarn_get_yarn_version ()
|
||||
{
|
||||
@@ -53,7 +40,10 @@ pl_nodejs_yarn_getsrc (char *option)
|
||||
void
|
||||
pl_nodejs_yarn_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_nodejs_yarn);
|
||||
SourceInfo source;
|
||||
chsrc_yield_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
@@ -115,4 +105,5 @@ pl_nodejs_yarn_feat (char *option)
|
||||
return fi;
|
||||
}
|
||||
|
||||
def_target_gsrf(pl_nodejs_yarn);
|
||||
// def_target_gsrf(pl_nodejs_yarn);
|
||||
TargetInfo pl_nodejs_yarn_target = {def_target_inner_gsrf(pl_nodejs_yarn),def_target_sourcesn(pl_nodejs)};
|
||||
|
||||
@@ -5,10 +5,27 @@
|
||||
* Contributors : Nul None <nul@none.org>
|
||||
* Created On : <2023-09-09>
|
||||
* Major Revision : 1
|
||||
* Last Modified : <2024-09-10>
|
||||
* Last Modified : <2024-09-13>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
static MirrorSite
|
||||
NpmMirror = {"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
|
||||
// 注意,这个是跳转后的地址,不确定未来会不会改变
|
||||
"https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.10.0/tfjs-4.10.0.tgz"}; // 29MB
|
||||
|
||||
|
||||
/**
|
||||
* @time 2024-04-18 更新
|
||||
* @note {
|
||||
* Sjtug, Tuna, Lzuoss, Jlu, Bfsu, 网易,搜狐 都没有
|
||||
* 腾讯软件源的npm源一直未证实是否可用
|
||||
* }
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_nodejs_sources[] = {
|
||||
{&Upstream, "https://registry.npmjs.org/"}, // @note 根据 pnpm 官网,有最后的斜线
|
||||
{&NpmMirror, "https://registry.npmmirror.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/npm"}
|
||||
};
|
||||
def_sources_n(pl_nodejs);
|
||||
|
||||
@@ -5,22 +5,9 @@
|
||||
* Contributors : Mr. Will <mr.will.com@outlook.com>
|
||||
* Created On : <2023-08-30>
|
||||
* Major Revision : 2
|
||||
* Last Modified : <2024-09-10>
|
||||
* Last Modified : <2024-09-13>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-04-08
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_nodejs_npm_sources[] = {
|
||||
{&Upstream, "https://registry.npmjs.org/"}, // @note 根据 pnpm 官网,有最后的斜线
|
||||
{&NpmMirror, "https://registry.npmmirror.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/npm"}
|
||||
};
|
||||
def_sources_n(pl_nodejs_npm);
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get npm
|
||||
*/
|
||||
@@ -39,7 +26,10 @@ pl_nodejs_npm_getsrc (char *option)
|
||||
void
|
||||
pl_nodejs_npm_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_nodejs_npm);
|
||||
SourceInfo source;
|
||||
chsrc_yield_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
@@ -84,4 +74,5 @@ pl_nodejs_npm_feat (char *option)
|
||||
return fi;
|
||||
}
|
||||
|
||||
def_target_gsrf(pl_nodejs_npm);
|
||||
// def_target_gsrf(pl_nodejs_npm);
|
||||
TargetInfo pl_nodejs_npm_target = {def_target_inner_gsrf(pl_nodejs_npm),def_target_sourcesn(pl_nodejs)};
|
||||
|
||||
@@ -5,22 +5,9 @@
|
||||
* Contributors : Nul None <nul@none.org>
|
||||
* Created On : <2024-04-18>
|
||||
* Major Revision : 2
|
||||
* Last Modified : <2024-09-10>
|
||||
* Last Modified : <2024-09-13>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @update 2024-04-08
|
||||
*/
|
||||
static SourceInfo
|
||||
pl_nodejs_pnpm_sources[] = {
|
||||
{&Upstream, "https://registry.npmjs.org/"}, // @note 根据 pnpm 官网,有最后的斜线
|
||||
{&NpmMirror, "https://registry.npmmirror.com"},
|
||||
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/npm"}
|
||||
};
|
||||
def_sources_n(pl_nodejs_pnpm);
|
||||
|
||||
|
||||
/**
|
||||
* chsrc get pnpm
|
||||
*/
|
||||
@@ -40,7 +27,10 @@ pl_nodejs_pnpm_getsrc (char *option)
|
||||
void
|
||||
pl_nodejs_pnpm_setsrc (char *option)
|
||||
{
|
||||
chsrc_yield_source_and_confirm (pl_nodejs_pnpm);
|
||||
SourceInfo source;
|
||||
chsrc_yield_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
@@ -86,4 +76,5 @@ pl_nodejs_pnpm_feat (char *option)
|
||||
}
|
||||
|
||||
|
||||
def_target_gsrf(pl_nodejs_pnpm);
|
||||
// def_target_gsrf(pl_nodejs_pnpm);
|
||||
TargetInfo pl_nodejs_pnpm_target = {def_target_inner_gsrf(pl_nodejs_pnpm),def_target_sourcesn(pl_nodejs)};
|
||||
|
||||
Reference in New Issue
Block a user