Update pl recipes using chef DSL

This commit is contained in:
Aoran Zeng
2025-08-10 18:33:28 +08:00
parent caa90fee32
commit 616b0caa48
15 changed files with 449 additions and 551 deletions

View File

@@ -1,12 +1,37 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Lontten <lontten@163.com>
* Created On : <2024-09-29>
* Last Modified : <2025-07-22>
* ------------------------------------------------------------*/
def_target(pl_js_bun);
void
pl_js_bun_prelude (void)
{
use_this(pl_js_bun);
chef_set_created_on (this, "2024-09-29");
chef_set_last_updated (this, "2025-07-22");
chef_set_sources_last_updated (this, "2025-07-22");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Lontten", "lontten@163.com");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
// 用的是 npm Registry 的源,所以使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
/**
* chsrc get bun
*/
@@ -58,27 +83,3 @@ pl_js_bun_resetsrc (char *option)
{
pl_js_bun_setsrc (option);
}
/**
* chsrc ls bun
*/
Feature_t
pl_js_bun_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_bun);
Target_t pl_js_bun_target = {def_target_inner_gsrf(pl_js_bun),def_target_sourcesn(pl_js_group)};

View File

@@ -26,9 +26,6 @@ pl_js_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
}
/**
* chsrc get nodejs
*/
void
pl_js_group_getsrc (char *option)
{
@@ -57,9 +54,6 @@ pl_js_group_getsrc (char *option)
}
/**
* chsrc set nodejs
*/
void
pl_js_group_setsrc (char *option)
{
@@ -99,33 +93,8 @@ pl_js_group_setsrc (char *option)
}
/**
* chsrc reset nodejs
*/
void
pl_js_group_resetsrc (char *option)
{
pl_js_group_setsrc (option);
}
/**
* chsrc ls nodejs
*/
Feature_t
pl_js_group_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = "Support `npm` & `yarn v2` & `pnpm`. No support for `yarn v1`";
f.can_english = true;
f.can_user_define = true;
return f;
}
def_target_gsrf (pl_js_group);

View File

@@ -1,13 +1,37 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mr. Will <mr.will.com@outlook.com>
* Created On : <2023-09-09>
* Major Reviison : 3
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
def_target(pl_js_yarn);
void
pl_js_yarn_prelude (void)
{
use_this(pl_js_yarn);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Mr. Will", "mr.will.com@outlook.com");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
static double
pl_js_yarn_get_yarn_version ()
{
@@ -17,9 +41,6 @@ pl_js_yarn_get_yarn_version ()
}
/**
* chsrc get yarn
*/
void
pl_js_yarn_getsrc (char *option)
{
@@ -78,35 +99,8 @@ pl_js_yarn_setsrc (char *option)
}
/**
* chsrc reset yarn
*/
void
pl_js_yarn_resetsrc (char *option)
{
pl_js_yarn_setsrc (option);
}
/**
* chsrc ls yarn
*/
Feature_t
pl_js_yarn_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_yarn);
Target_t pl_js_yarn_target = {def_target_inner_gsrf(pl_js_yarn),def_target_sourcesn(pl_js_group)};

View File

@@ -1,86 +1,85 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* |
* Created On : <2023-09-09>
* Major Revision : 1
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
#define PL_JS_Group_Speed_URL_Postfix "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"
static SourceProvider_t pl_js_npm_upstream =
{
def_upstream, "https://www.npmjs.com/",
{NotSkip, NA, NA, "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz", ACCURATE}
};
static MirrorSite_t NpmMirror =
{
IS_DedicatedMirrorSite,
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
// 注意,下面这个是跳转后的地址,不确定未来会不会改变
{NotSkip, NA, NA, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.22.0/tfjs-4.22.0.tgz", ACCURATE} // 29MB
{SKIP, NULL, NULL, NULL, ACCURATE}
};
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
* @note
* Sjtug, Tuna, Lzuoss, Jlu, Bfsu, 网易,搜狐 都没有
*/
static Source_t pl_js_group_sources[] =
def_target(pl_js_group);
void
pl_js_group_prelude (void)
{
{&pl_js_npm_upstream, "https://registry.npmjs.org/", DelegateToUpstream}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", DelegateToMirror},
use_this(pl_js_group);
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/",
"https://mirrors.huaweicloud.com/repository/npm/" PL_JS_Group_Speed_URL_Postfix},
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
{&Tencent, "https://mirrors.cloud.tencent.com/npm/",
"https://mirrors.cloud.tencent.com/npm/" PL_JS_Group_Speed_URL_Postfix},
};
def_sources_n(pl_js_group);
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this,0);
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&upstream, "https://registry.npmjs.org/", FeedByPrelude}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/", FeedByPrelude}
def_sources_end()
// 29MB 大小
chsrc_set_sources_speed_measure_url_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
}
#define PL_Nodejs_Binary_Speed_URL_Postfix "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"
static SourceProvider_t pl_js_binary_release_upstream =
def_target(pl_js_binary_release);
void
pl_js_binary_release_prelude (void)
{
def_upstream, "https://nodejs.org/",
{NotSkip, NA, NA, "https://nodejs.org/dist/v23.4.0/node-v23.4.0.tar.gz", ACCURATE} // 100MB
};
use_this(pl_js_binary_release);
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-BinaryRelease-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
*/
static Source_t pl_js_binary_release_sources[] =
{
{&pl_js_binary_release_upstream, "https://nodejs.org/dist/", DelegateToUpstream},
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
{&NpmMirror, "https://npmmirror.com/mirrors",
"https://registry.npmmirror.com/-/binary/node/v23.4.0/node-v23.4.0.tar.gz"},
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",
"https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
chef_allow_get();
chef_allow_set();
chef_allow_reset();
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",
"https://mirrors.bfsu.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
chef_forbid_local_mode (this);
chef_allow_english(this);
chef_allow_user_define(this);
{&Ustc, "https://mirrors.ustc.edu.cn/node/",
"https://mirrors.ustc.edu.cn/node/" PL_Nodejs_Binary_Speed_URL_Postfix},
def_sources_begin()
{&upstream, "https://nodejs.org/dist/", FeedByPrelude},
{&NpmMirror, "https://npmmirror.com/mirrors", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/node/",FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude}
def_sources_end()
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",
"https://mirrors.huaweicloud.com/nodejs/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/",
"https://mirrors.cloud.tencent.com/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix}
};
def_sources_n(pl_js_binary_release);
chsrc_set_sources_speed_measure_url_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
}

View File

@@ -1,16 +1,38 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mr. Will <mr.will.com@outlook.com>
* Created On : <2023-08-30>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get npm
*/
def_target(pl_js_npm);
void
pl_js_npm_prelude (void)
{
use_this(pl_js_npm);
chef_set_created_on (this, "2023-08-30");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Mr. Will", "mr.will.com@outlook.com");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
void
pl_js_npm_getsrc (char *option)
{
@@ -20,8 +42,6 @@ pl_js_npm_getsrc (char *option)
/**
* @consult https://npmmirror.com/
*
* chsrc set npm
*/
void
pl_js_npm_setsrc (char *option)
@@ -47,35 +67,8 @@ pl_js_npm_setsrc (char *option)
}
/**
* chsrc reset npm
*/
void
pl_js_npm_resetsrc (char *option)
{
pl_js_npm_setsrc (option);
}
/**
* chsrc ls npm
*/
Feature_t
pl_js_npm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_npm);
Target_t pl_js_npm_target = {def_target_inner_gsrf(pl_js_npm),def_target_sourcesn(pl_js_group)};

View File

@@ -1,16 +1,40 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* |
* Created On : <2024-09-23>
* Last Modified : <2025-06-19>
* ------------------------------------------------------------*/
/**
* chsrc get nvm
*/
def_target(pl_js_nvm);
void
pl_js_nvm_prelude (void)
{
use_this(pl_js_nvm);
chef_set_created_on (this, "2024-09-23");
chef_set_last_updated (this, "2025-06-19");
chef_set_sources_last_updated (this, "2025-06-19");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_forbid_local_mode (this);
chef_allow_english(this);
chef_allow_user_define(this);
chef_set_note ("nvm does not support Fish", "nvm 不支持 Fish shell");
// 使用 pl_js_binary_release 的源
this->sources = pl_js_binary_release_target.sources;
this->sources_n = pl_js_binary_release_target.sources_n;
}
void
pl_js_nvm_getsrc (char *option)
{
@@ -23,9 +47,7 @@ pl_js_nvm_getsrc (char *option)
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/nodejs-release/
* @issue https://github.com/RubyMetric/chsrc/issues/81
*
* chsrc set nvm
*
* @note nvm does not support Fish
* @note nvm 不支持 Fish
*/
void
pl_js_nvm_setsrc (char *option)
@@ -47,9 +69,6 @@ pl_js_nvm_setsrc (char *option)
}
/**
* chsrc reset nvm
*/
void
pl_js_nvm_resetsrc (char *option)
{
@@ -57,27 +76,3 @@ pl_js_nvm_resetsrc (char *option)
chsrc_error ("暂不支持对 nvm 重置");
exit (Exit_Unsupported);
}
/**
* chsrc ls nvm
*/
Feature_t
pl_js_nvm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = "";
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_nvm);
Target_t pl_js_nvm_target = {def_target_inner_gsrf(pl_js_nvm),def_target_sourcesn(pl_js_binary_release)};

View File

@@ -1,16 +1,38 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-04-18>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get pnpm
*/
def_target(pl_js_pnpm);
void
pl_js_pnpm_prelude (void)
{
use_this(pl_js_pnpm);
chef_set_created_on (this, "2024-04-18");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
void
pl_js_pnpm_getsrc (char *option)
{
@@ -21,8 +43,6 @@ pl_js_pnpm_getsrc (char *option)
/**
* @consult https://pnpm.io/feature-comparison
* @consult https://pnpm.io/cli/config
*
* chsrc set pnpm
*/
void
pl_js_pnpm_setsrc (char *option)
@@ -48,36 +68,8 @@ pl_js_pnpm_setsrc (char *option)
}
/**
* chsrc reset pnpm
*/
void
pl_js_pnpm_resetsrc (char *option)
{
pl_js_pnpm_setsrc (option);
}
/**
* chsrc ls pnpm
*/
Feature_t
pl_js_pnpm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_pnpm);
Target_t pl_js_pnpm_target = {def_target_inner_gsrf(pl_js_pnpm),def_target_sourcesn(pl_js_group)};