bfi-cli 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +24 -1
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -136,7 +136,30 @@ function parseSource(input) {
136
136
  const alias = SOURCE_ALIASES[input];
137
137
  if (alias) input = alias;
138
138
  const githubPrefixMatch = input.match(/^github:(.+)$/);
139
- if (githubPrefixMatch) return parseSource(appendFragmentRef(githubPrefixMatch[1], fragmentRef, fragmentSkillFilter));
139
+ if (githubPrefixMatch) {
140
+ const rest = githubPrefixMatch[1];
141
+ const atSkill = rest.match(/^([^/]+)\/([^/@]+)@(.+)$/);
142
+ if (atSkill && !rest.includes(":")) {
143
+ const [, owner, repo, skillFilter] = atSkill;
144
+ return {
145
+ type: "github",
146
+ url: `https://github.com/${owner}/${repo}.git`,
147
+ ...fragmentRef ? { ref: fragmentRef } : {},
148
+ skillFilter: fragmentSkillFilter || skillFilter
149
+ };
150
+ }
151
+ const shorthand = rest.match(/^([^/]+)\/([^/]+)(?:\/(.+?))?\/?$/);
152
+ if (shorthand && !rest.includes(":") && !rest.startsWith(".")) {
153
+ const [, owner, repo, subpath] = shorthand;
154
+ return {
155
+ type: "github",
156
+ url: `https://github.com/${owner}/${repo}.git`,
157
+ ...fragmentRef ? { ref: fragmentRef } : {},
158
+ subpath: subpath ? sanitizeSubpath(subpath) : subpath,
159
+ ...fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}
160
+ };
161
+ }
162
+ }
140
163
  const gitlabPrefixMatch = input.match(/^gitlab:(.+)$/);
141
164
  if (gitlabPrefixMatch) return parseSource(appendFragmentRef(`https://gitlab.com/${gitlabPrefixMatch[1]}`, fragmentRef, fragmentSkillFilter));
142
165
  const githubTreeWithPathMatch = input.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {