yg-team-cli 2.3.4 → 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/index.js CHANGED
@@ -2205,7 +2205,7 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
2205
2205
  const templateRepo = process.env.TEMPLATE_REPO || "git@gitlab.yungu-inc.org:yungu-app/java-scaffold-template.git";
2206
2206
  const backendPath = path7.join(projectPath, "backend");
2207
2207
  try {
2208
- const { execaCommand } = await import("execa");
2208
+ const { execa: e } = await import("execa");
2209
2209
  const tempDir = path7.join(projectPath, ".template-temp");
2210
2210
  if (versionOptions?.tag || versionOptions?.branch) {
2211
2211
  const { userConfigManager: userConfigManager2 } = await Promise.resolve().then(() => (init_user_config(), user_config_exports));
@@ -2234,12 +2234,16 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
2234
2234
  logger.warn("\u672A\u914D\u7F6E GitLab Token\uFF0C\u8DF3\u8FC7\u7248\u672C\u9A8C\u8BC1");
2235
2235
  }
2236
2236
  }
2237
- const ref = versionOptions?.tag || versionOptions?.branch || "HEAD";
2238
- await execaCommand(`git clone --depth=1 --branch ${ref} ${templateRepo} ${tempDir}`, {
2237
+ logger.info(`\u6B63\u5728\u514B\u9686\u540E\u7AEF\u6A21\u677F (${versionOptions?.tag || versionOptions?.branch || "latest"})...`);
2238
+ const cloneArgs = ["clone", "--depth=1"];
2239
+ if (versionOptions?.tag || versionOptions?.branch) {
2240
+ cloneArgs.push("--branch", versionOptions.tag || versionOptions.branch);
2241
+ }
2242
+ cloneArgs.push(templateRepo, tempDir);
2243
+ await e("git", cloneArgs, {
2239
2244
  stdio: "inherit",
2240
2245
  timeout: 6e4
2241
2246
  });
2242
- const { execa: e } = await import("execa");
2243
2247
  const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], {
2244
2248
  cwd: tempDir,
2245
2249
  stdio: "pipe"
@@ -2274,7 +2278,7 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2274
2278
  const templates = getDefaultTemplates();
2275
2279
  const repository = templates.frontend.repository;
2276
2280
  try {
2277
- const { execaCommand } = await import("execa");
2281
+ const { execa: e } = await import("execa");
2278
2282
  let latestTag = "";
2279
2283
  if (!versionOptions.tag && !versionOptions.branch) {
2280
2284
  latestTag = await getLatestTag(repository);
@@ -2283,9 +2287,13 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
2283
2287
  logger.info(`\u6B63\u5728\u514B\u9686\u524D\u7AEF\u6A21\u677F (${targetVersion || "HEAD"})...`);
2284
2288
  const tempDir = path7.join(os3.tmpdir(), `team-cli-fe-${Date.now()}`);
2285
2289
  await FileUtils.ensureDir(tempDir);
2286
- const cloneCmd = targetVersion ? `git clone --depth 1 --branch ${targetVersion} ${repository} ${tempDir}` : `git clone --depth 1 ${repository} ${tempDir}`;
2287
- await execaCommand(cloneCmd);
2288
- const { stdout: commit } = await execaCommand("git rev-parse HEAD", { cwd: tempDir });
2290
+ const cloneArgs = ["clone", "--depth", "1"];
2291
+ if (targetVersion) {
2292
+ cloneArgs.push("--branch", targetVersion);
2293
+ }
2294
+ cloneArgs.push(repository, tempDir);
2295
+ await e("git", cloneArgs);
2296
+ const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], { cwd: tempDir });
2289
2297
  await fs4.copy(tempDir, frontendPath, {
2290
2298
  filter: (src) => !src.includes(".git")
2291
2299
  });
@@ -2306,11 +2314,12 @@ async function generateDockerFiles() {
2306
2314
  }
2307
2315
  async function initGit(projectPath, projectName) {
2308
2316
  try {
2309
- const { execaCommand } = await import("execa");
2310
- await execaCommand("git init", { cwd: projectPath, stdio: "pipe" });
2311
- await execaCommand("git add .", { cwd: projectPath, stdio: "pipe" });
2312
- await execaCommand(
2313
- `git commit -m "feat: initialize ${projectName} project with team-cli"`,
2317
+ const { execa: e } = await import("execa");
2318
+ await e("git", ["init"], { cwd: projectPath, stdio: "pipe" });
2319
+ await e("git", ["add", "."], { cwd: projectPath, stdio: "pipe" });
2320
+ await e(
2321
+ "git",
2322
+ ["commit", "-m", `feat: initialize ${projectName} project with team-cli`],
2314
2323
  { cwd: projectPath, stdio: "pipe" }
2315
2324
  );
2316
2325
  logger.success("Git \u4ED3\u5E93\u521D\u59CB\u5316\u5B8C\u6210");