yg-team-cli 2.3.3 → 2.3.5

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.
package/dist/cli.js CHANGED
@@ -892,7 +892,7 @@ var init_template_version = __esm({
892
892
  init_logger();
893
893
  DEFAULT_TEMPLATES = {
894
894
  frontend: {
895
- repository: "https://gitlab.yungu-inc.org/static/fe-tpl-ai"
895
+ repository: "git@gitlab.yungu-inc.org:static/fe-tpl-ai.git"
896
896
  },
897
897
  backend: {
898
898
  repository: "git@gitlab.yungu-inc.org:yungu-app/java-scaffold-template.git"
@@ -1998,7 +1998,7 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
1998
1998
  const templateRepo = process.env.TEMPLATE_REPO || "git@gitlab.yungu-inc.org:yungu-app/java-scaffold-template.git";
1999
1999
  const backendPath = path7.join(projectPath, "backend");
2000
2000
  try {
2001
- const { execaCommand } = await import("execa");
2001
+ const { execa: e } = await import("execa");
2002
2002
  const tempDir = path7.join(projectPath, ".template-temp");
2003
2003
  if (versionOptions?.tag || versionOptions?.branch) {
2004
2004
  const { userConfigManager: userConfigManager2 } = await Promise.resolve().then(() => (init_user_config(), user_config_exports));
@@ -2027,12 +2027,16 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
2027
2027
  logger.warn("\u672A\u914D\u7F6E GitLab Token\uFF0C\u8DF3\u8FC7\u7248\u672C\u9A8C\u8BC1");
2028
2028
  }
2029
2029
  }
2030
- const ref = versionOptions?.tag || versionOptions?.branch || "HEAD";
2031
- await execaCommand(`git clone --depth=1 --branch ${ref} ${templateRepo} ${tempDir}`, {
2030
+ logger.info(`\u6B63\u5728\u514B\u9686\u540E\u7AEF\u6A21\u677F (${versionOptions?.tag || versionOptions?.branch || "latest"})...`);
2031
+ const cloneArgs = ["clone", "--depth=1"];
2032
+ if (versionOptions?.tag || versionOptions?.branch) {
2033
+ cloneArgs.push("--branch", versionOptions.tag || versionOptions.branch);
2034
+ }
2035
+ cloneArgs.push(templateRepo, tempDir);
2036
+ await e("git", cloneArgs, {
2032
2037
  stdio: "inherit",
2033
2038
  timeout: 6e4
2034
2039
  });
2035
- const { execa: e } = await import("execa");
2036
2040
  const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], {
2037
2041
  cwd: tempDir,
2038
2042
  stdio: "pipe"
@@ -2067,7 +2071,7 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2067
2071
  const templates = getDefaultTemplates();
2068
2072
  const repository = templates.frontend.repository;
2069
2073
  try {
2070
- const { execaCommand } = await import("execa");
2074
+ const { execa: e } = await import("execa");
2071
2075
  let latestTag = "";
2072
2076
  if (!versionOptions.tag && !versionOptions.branch) {
2073
2077
  latestTag = await getLatestTag(repository);
@@ -2076,9 +2080,13 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2076
2080
  logger.info(`\u6B63\u5728\u514B\u9686\u524D\u7AEF\u6A21\u677F (${targetVersion || "HEAD"})...`);
2077
2081
  const tempDir = path7.join(os3.tmpdir(), `team-cli-fe-${Date.now()}`);
2078
2082
  await FileUtils.ensureDir(tempDir);
2079
- const cloneCmd = targetVersion ? `git clone --depth 1 --branch ${targetVersion} ${repository} ${tempDir}` : `git clone --depth 1 ${repository} ${tempDir}`;
2080
- await execaCommand(cloneCmd);
2081
- const { stdout: commit } = await execaCommand("git rev-parse HEAD", { cwd: tempDir });
2083
+ const cloneArgs = ["clone", "--depth", "1"];
2084
+ if (targetVersion) {
2085
+ cloneArgs.push("--branch", targetVersion);
2086
+ }
2087
+ cloneArgs.push(repository, tempDir);
2088
+ await e("git", cloneArgs);
2089
+ const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], { cwd: tempDir });
2082
2090
  await fs4.copy(tempDir, frontendPath, {
2083
2091
  filter: (src) => !src.includes(".git")
2084
2092
  });
@@ -2099,11 +2107,12 @@ async function generateDockerFiles() {
2099
2107
  }
2100
2108
  async function initGit(projectPath, projectName) {
2101
2109
  try {
2102
- const { execaCommand } = await import("execa");
2103
- await execaCommand("git init", { cwd: projectPath, stdio: "pipe" });
2104
- await execaCommand("git add .", { cwd: projectPath, stdio: "pipe" });
2105
- await execaCommand(
2106
- `git commit -m "feat: initialize ${projectName} project with team-cli"`,
2110
+ const { execa: e } = await import("execa");
2111
+ await e("git", ["init"], { cwd: projectPath, stdio: "pipe" });
2112
+ await e("git", ["add", "."], { cwd: projectPath, stdio: "pipe" });
2113
+ await e(
2114
+ "git",
2115
+ ["commit", "-m", `feat: initialize ${projectName} project with team-cli`],
2107
2116
  { cwd: projectPath, stdio: "pipe" }
2108
2117
  );
2109
2118
  logger.success("Git \u4ED3\u5E93\u521D\u59CB\u5316\u5B8C\u6210");