mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-13 15:59:32 +08:00
85 lines
1.8 KiB
C
85 lines
1.8 KiB
C
/** ------------------------------------------------------------
|
|
* 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>
|
|
* ------------------------------------------------------------*/
|
|
|
|
/**
|
|
* chsrc get bun
|
|
*/
|
|
void
|
|
pl_js_bun_getsrc (char *option)
|
|
{
|
|
chsrc_view_file ("~/.bunfig.toml");
|
|
}
|
|
|
|
|
|
/**
|
|
* @consult https://bun.sh/docs/runtime/bunfig#global-vs-local
|
|
* @consult https://github.com/RubyMetric/chsrc/issues/83
|
|
* @consult https://github.com/RubyMetric/chsrc/pull/90
|
|
*
|
|
* chsrc set bun
|
|
*/
|
|
void
|
|
pl_js_bun_setsrc (char *option)
|
|
{
|
|
// 用的是 npm Registry 的源
|
|
chsrc_yield_source (pl_js_group);
|
|
|
|
char *content = RAWSTR_pl_js_bun_config;
|
|
|
|
content = xy_str_gsub (content, "@url@", source.url);
|
|
|
|
if (chsrc_in_local_mode())
|
|
{
|
|
chsrc_note2 ("请手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
|
|
}
|
|
else
|
|
{
|
|
chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
|
|
}
|
|
|
|
println (content);
|
|
|
|
chsrc_determine_chgtype (ChgType_Auto);
|
|
chsrc_conclude (&source);
|
|
}
|
|
|
|
|
|
/**
|
|
* chsrc reset bun
|
|
*/
|
|
void
|
|
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)};
|