mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-13 15:59:32 +08:00
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
/** ------------------------------------------------------------
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
* ------------------------------------------------------------*/
|
|
|
|
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)
|
|
{
|
|
chsrc_run ("pnpm config get registry", RunOpt_No_Last_New_Line);
|
|
}
|
|
|
|
|
|
/**
|
|
* @consult https://pnpm.io/feature-comparison
|
|
* @consult https://pnpm.io/cli/config
|
|
*/
|
|
void
|
|
pl_js_pnpm_setsrc (char *option)
|
|
{
|
|
chsrc_yield_source (pl_js_group);
|
|
if (chsrc_in_standalone_mode())
|
|
chsrc_confirm_source();
|
|
|
|
char *cmd = NULL;
|
|
|
|
if (chsrc_in_local_mode())
|
|
cmd = xy_2strjoin ("pnpm config --location project set registry ", source.url);
|
|
else
|
|
cmd = xy_2strjoin ("pnpm config -g set registry ", source.url);
|
|
|
|
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
|
|
|
if (chsrc_in_standalone_mode())
|
|
{
|
|
chsrc_determine_chgtype (ChgType_Auto);
|
|
chsrc_conclude (&source);
|
|
}
|
|
}
|
|
|
|
|
|
void
|
|
pl_js_pnpm_resetsrc (char *option)
|
|
{
|
|
pl_js_pnpm_setsrc (option);
|
|
}
|