bfi-cli 0.1.15 → 0.1.16

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 +7 -5
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -26,6 +26,8 @@ import { parse } from "yaml";
26
26
  import { createHash as createHash$1 } from "crypto";
27
27
  import { determineAgent } from "@vercel/detect-agent";
28
28
  var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
29
+ const GIT_HOST = process.env.BFI_GIT_HOST || "github.com";
30
+ const GIT_URL = `https://${GIT_HOST}`;
29
31
  function getOwnerRepo(parsed) {
30
32
  if (parsed.type === "local") return null;
31
33
  const sshMatch = parsed.url.match(/^git@[^:]+:(.+)$/);
@@ -61,7 +63,7 @@ function parseOwnerRepo(ownerRepo) {
61
63
  }
62
64
  async function isRepoPrivate(owner, repo) {
63
65
  try {
64
- const res = await fetch(`https://api.github.com/repos/${owner}/${repo}`);
66
+ const res = await fetch(`https://api.${GIT_HOST}/repos/${owner}/${repo}`);
65
67
  if (!res.ok) return null;
66
68
  return (await res.json()).private === true;
67
69
  } catch {
@@ -141,7 +143,7 @@ function parseSource(input) {
141
143
  const [, owner, repo, ref, subpath] = githubTreeWithPathMatch;
142
144
  return {
143
145
  type: "github",
144
- url: `https://github.com/${owner}/${repo}.git`,
146
+ url: `${GIT_URL}/${owner}/${repo}.git`,
145
147
  ref: ref || fragmentRef,
146
148
  subpath: subpath ? sanitizeSubpath(subpath) : subpath
147
149
  };
@@ -151,7 +153,7 @@ function parseSource(input) {
151
153
  const [, owner, repo, ref] = githubTreeMatch;
152
154
  return {
153
155
  type: "github",
154
- url: `https://github.com/${owner}/${repo}.git`,
156
+ url: `${GIT_URL}/${owner}/${repo}.git`,
155
157
  ref: ref || fragmentRef
156
158
  };
157
159
  }
@@ -211,7 +213,7 @@ function parseSource(input) {
211
213
  const [, owner, repo, skillFilter] = atSkillMatch;
212
214
  return {
213
215
  type: "github",
214
- url: `https://github.com/${owner}/${repo}.git`,
216
+ url: `${GIT_URL}/${owner}/${repo}.git`,
215
217
  ...fragmentRef ? { ref: fragmentRef } : {},
216
218
  skillFilter: fragmentSkillFilter || skillFilter
217
219
  };
@@ -221,7 +223,7 @@ function parseSource(input) {
221
223
  const [, owner, repo, subpath] = shorthandMatch;
222
224
  return {
223
225
  type: "github",
224
- url: `https://github.com/${owner}/${repo}.git`,
226
+ url: `${GIT_URL}/${owner}/${repo}.git`,
225
227
  ...fragmentRef ? { ref: fragmentRef } : {},
226
228
  subpath: subpath ? sanitizeSubpath(subpath) : subpath,
227
229
  ...fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {