From e83118fe2fd109aae83cc7006e01456a8d60259a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 12 Aug 2026 18:08:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E5=87=BA=20`Node.js-binary`?= =?UTF-8?q?=20target?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recipe/lang/JavaScript/JavaScript.c | 49 ++++++++++++-- src/recipe/lang/JavaScript/Node.js-binary.c | 31 +++++++++ src/recipe/lang/JavaScript/common.h | 74 --------------------- src/recipe/lang/JavaScript/nvm.c | 4 +- src/recipe/menu.c | 4 +- 5 files changed, 77 insertions(+), 85 deletions(-) create mode 100644 src/recipe/lang/JavaScript/Node.js-binary.c delete mode 100644 src/recipe/lang/JavaScript/common.h diff --git a/src/recipe/lang/JavaScript/JavaScript.c b/src/recipe/lang/JavaScript/JavaScript.c index efcffae7..dc5648af 100644 --- a/src/recipe/lang/JavaScript/JavaScript.c +++ b/src/recipe/lang/JavaScript/JavaScript.c @@ -1,14 +1,49 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Mr. Will - * | - * Created On : <2023-08-30> - * Major Revision : 2 - * Last Modified : <2025-07-11> * ------------------------------------------------------------*/ +static MirrorSite_t NpmMirror = +{ + IS_DedicatedMirrorSite, + "npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/", + {SKIP, NULL, NULL, NULL, ACCURATE} +}; + +def_target(pl_js_group, "js/javascript/node/nodejs"); + +void +pl_js_group_prelude (void) +{ + chef_prep_this (pl_js_group, gsr); + + chef_set_recipe_created_on (this, "2023-09-09"); + chef_set_recipe_last_updated (this, "2025-07-11"); + + // 组换源的 leader target 应把所有 follower target 的贡献者都记录过来 + chef_set_chefs (this, 1, "@ccmywish"); + chef_set_sauciers (this, 2, "@lontten", "@MrWillCom"); + + /* ProjectScope 支持 npm, yarn v2, pnpm, 不支持 yarn v1 */ + chef_set_scope_cap (this, ProjectScope, ScopeCap_Able_And_Implemented); + chef_set_scope_cap (this, UserScope, ScopeCap_Able_And_Implemented); + chef_set_scope_cap (this, SystemScope, ScopeCap_Unknown); + chef_set_default_scope (this, UserScope); + + chef_allow_english(this); + chef_allow_user_define(this); + + def_sources_begin() + {&UpstreamProvider, "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 大小 + chef_set_rest_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"); +} + + void pl_js_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist) { diff --git a/src/recipe/lang/JavaScript/Node.js-binary.c b/src/recipe/lang/JavaScript/Node.js-binary.c new file mode 100644 index 00000000..f4419222 --- /dev/null +++ b/src/recipe/lang/JavaScript/Node.js-binary.c @@ -0,0 +1,31 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------*/ + +def_sources_target(pl_nodejs_binary, "nodejs-binary"); + +void +pl_nodejs_binary_prelude (void) +{ + chef_prep_sources_target (pl_nodejs_binary); + + chef_set_recipe_created_on (this, "2023-09-09"); + chef_set_recipe_last_updated (this, "2026-08-12"); + + chef_set_chefs (this, 1, "@ccmywish"); + chef_set_sauciers (this, 0); + + chef_allow_user_define(this); + + def_sources_begin() + {&UpstreamProvider, "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() + + chef_set_rest_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"); +} diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h deleted file mode 100644 index 0896b0d5..00000000 --- a/src/recipe/lang/JavaScript/common.h +++ /dev/null @@ -1,74 +0,0 @@ -/** ------------------------------------------------------------ - * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------*/ - -static MirrorSite_t NpmMirror = -{ - IS_DedicatedMirrorSite, - "npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/", - {SKIP, NULL, NULL, NULL, ACCURATE} -}; - -def_target(pl_js_group, "js/javascript/node/nodejs"); - -void -pl_js_group_prelude (void) -{ - chef_prep_this (pl_js_group, gsr); - - chef_set_recipe_created_on (this, "2023-09-09"); - chef_set_recipe_last_updated (this, "2025-07-11"); - - // 组换源的 leader target 应把所有 follower target 的贡献者都记录过来 - chef_set_chefs (this, 1, "@ccmywish"); - chef_set_sauciers (this, 2, "@lontten", "@MrWillCom"); - - /* ProjectScope 支持 npm, yarn v2, pnpm, 不支持 yarn v1 */ - chef_set_scope_cap (this, ProjectScope, ScopeCap_Able_And_Implemented); - chef_set_scope_cap (this, UserScope, ScopeCap_Able_And_Implemented); - chef_set_scope_cap (this, SystemScope, ScopeCap_Unknown); - chef_set_default_scope (this, UserScope); - - chef_allow_english(this); - chef_allow_user_define(this); - - def_sources_begin() - {&UpstreamProvider, "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 大小 - chef_set_rest_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"); -} - - - -def_sources_target(pl_js_nodejs_binary, "nodejs-binary"); - -void -pl_js_nodejs_binary_prelude (void) -{ - chef_prep_sources_target (pl_js_nodejs_binary); - - chef_set_recipe_created_on (this, "2023-09-09"); - chef_set_recipe_last_updated (this, "2026-08-12"); - - chef_set_chefs (this, 1, "@ccmywish"); - chef_set_sauciers (this, 0); - - chef_allow_user_define(this); - - def_sources_begin() - {&UpstreamProvider, "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() - - chef_set_rest_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"); -} diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 5f462a12..649bd5fd 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -25,7 +25,7 @@ pl_nvm_prelude (void) chef_set_note (this, "nvm 不支持 Fish shell", "nvm does not support Fish"); - chef_use_other_target_sources (this, &pl_js_nodejs_binary_target); + chef_use_other_target_sources (this, &pl_nodejs_binary_target); } @@ -46,7 +46,7 @@ pl_nvm_getsrc (char *option) void pl_nvm_setsrc (char *option) { - Source_t source = chsrc_yield_source_and_confirm (&pl_js_nodejs_binary_target, option); + Source_t source = chsrc_yield_source_and_confirm (&pl_nodejs_binary_target, option); char *w = xy_strcat (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n"); diff --git a/src/recipe/menu.c b/src/recipe/menu.c index fa75845e..2a7dd1d8 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -27,7 +27,7 @@ #include "lang/Python/uv/uv.c" -#include "lang/JavaScript/common.h" +#include "lang/JavaScript/Node.js-binary.c" #include "lang/JavaScript/npm.c" #include "lang/JavaScript/pnpm.c" #include "lang/JavaScript/Yarn.c" @@ -242,5 +242,5 @@ chsrc_init_menu () #undef add chef_set_preludefn_for_sources_target (pl_py_pypi); - chef_set_preludefn_for_sources_target (pl_js_nodejs_binary); + chef_set_preludefn_for_sources_target (pl_nodejs_binary); }