yg-team-cli 2.3.10 → 2.3.11
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 +30 -51
- package/dist/cli.js.map +1 -1
- package/dist/index.js +30 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -903,7 +903,6 @@ var init_template_version = __esm({
|
|
|
903
903
|
|
|
904
904
|
// src/lib/module-registry.ts
|
|
905
905
|
import path5 from "path";
|
|
906
|
-
import fs3 from "fs-extra";
|
|
907
906
|
var ModuleManager;
|
|
908
907
|
var init_module_registry = __esm({
|
|
909
908
|
"src/lib/module-registry.ts"() {
|
|
@@ -976,17 +975,18 @@ var init_module_registry = __esm({
|
|
|
976
975
|
}
|
|
977
976
|
}
|
|
978
977
|
if (module.type === "local" && module.backendFragments) {
|
|
979
|
-
const
|
|
980
|
-
const
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
978
|
+
const backendJavaDir = path5.join(projectPath, "backend/src/main/java");
|
|
979
|
+
const commonBasePath = path5.join(backendJavaDir, "org/yungu/common");
|
|
980
|
+
for (const fragment of module.backendFragments) {
|
|
981
|
+
const sourcePath = path5.join(templatesDir, "modules", fragment.source);
|
|
982
|
+
const targetPath = path5.join(commonBasePath, fragment.target);
|
|
983
|
+
if (await FileUtils.exists(sourcePath)) {
|
|
984
|
+
await FileUtils.ensureDir(path5.dirname(targetPath));
|
|
985
|
+
let content = await FileUtils.read(sourcePath);
|
|
986
|
+
const targetPackage = "org.yungu.common." + path5.dirname(fragment.target).replace(/\//g, ".");
|
|
987
|
+
content = content.replace(/^package\s+[^;]+;/m, `package ${targetPackage};`);
|
|
988
|
+
await FileUtils.write(targetPath, content);
|
|
989
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
} else if (module.type === "remote") {
|
|
@@ -1009,27 +1009,6 @@ var init_module_registry = __esm({
|
|
|
1009
1009
|
`;
|
|
1010
1010
|
await FileUtils.write(targetPath, content);
|
|
1011
1011
|
}
|
|
1012
|
-
/**
|
|
1013
|
-
* 自动探测项目的 Base Package
|
|
1014
|
-
*/
|
|
1015
|
-
static async findBasePackage(searchDir) {
|
|
1016
|
-
if (!await FileUtils.exists(searchDir)) return null;
|
|
1017
|
-
const files = await FileUtils.findFiles("**/Application.java", searchDir);
|
|
1018
|
-
if (files.length > 0) {
|
|
1019
|
-
return path5.dirname(path5.join(searchDir, files[0]));
|
|
1020
|
-
}
|
|
1021
|
-
let current = searchDir;
|
|
1022
|
-
while (true) {
|
|
1023
|
-
const items = await fs3.readdir(current);
|
|
1024
|
-
const dirs = items.filter((c) => fs3.statSync(path5.join(current, c)).isDirectory());
|
|
1025
|
-
if (dirs.length === 1 && !["model", "controller", "service", "mapper", "config", "common"].includes(dirs[0])) {
|
|
1026
|
-
current = path5.join(current, dirs[0]);
|
|
1027
|
-
} else {
|
|
1028
|
-
break;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
return current;
|
|
1032
|
-
}
|
|
1033
1012
|
};
|
|
1034
1013
|
}
|
|
1035
1014
|
});
|
|
@@ -1472,7 +1451,7 @@ var init_gitlab_api = __esm({
|
|
|
1472
1451
|
import { Command } from "commander";
|
|
1473
1452
|
import inquirer from "inquirer";
|
|
1474
1453
|
import path7 from "path";
|
|
1475
|
-
import
|
|
1454
|
+
import fs3 from "fs-extra";
|
|
1476
1455
|
import os3 from "os";
|
|
1477
1456
|
import { Listr } from "listr2";
|
|
1478
1457
|
async function generateTechStack(projectPath) {
|
|
@@ -2051,10 +2030,10 @@ async function cloneBackendTemplate(projectPath, versionOptions) {
|
|
|
2051
2030
|
stdio: "pipe"
|
|
2052
2031
|
});
|
|
2053
2032
|
const latestTag = tags.split("\n")[0] || void 0;
|
|
2054
|
-
await
|
|
2033
|
+
await fs3.copy(tempDir, backendPath, {
|
|
2055
2034
|
filter: (src) => !src.includes(".git")
|
|
2056
2035
|
});
|
|
2057
|
-
await
|
|
2036
|
+
await fs3.remove(tempDir);
|
|
2058
2037
|
const gitDir = path7.join(backendPath, ".git");
|
|
2059
2038
|
if (await FileUtils.exists(gitDir)) {
|
|
2060
2039
|
await FileUtils.remove(gitDir);
|
|
@@ -2092,10 +2071,10 @@ async function cloneFrontendTemplate(projectPath, versionOptions = {}) {
|
|
|
2092
2071
|
cloneArgs.push(repository, tempDir);
|
|
2093
2072
|
await e("git", cloneArgs);
|
|
2094
2073
|
const { stdout: commit } = await e("git", ["rev-parse", "HEAD"], { cwd: tempDir });
|
|
2095
|
-
await
|
|
2074
|
+
await fs3.copy(tempDir, frontendPath, {
|
|
2096
2075
|
filter: (src) => !src.includes(".git")
|
|
2097
2076
|
});
|
|
2098
|
-
await
|
|
2077
|
+
await fs3.remove(tempDir);
|
|
2099
2078
|
await updateTemplateVersion(projectPath, "frontend", commit.trim(), {
|
|
2100
2079
|
tag: versionOptions.tag || latestTag,
|
|
2101
2080
|
branch: versionOptions.branch
|
|
@@ -2146,9 +2125,9 @@ docker push \${REGISTRY}/\${PROJECT_NAME}:latest
|
|
|
2146
2125
|
|
|
2147
2126
|
echo "\u2705 \u90E8\u7F72\u5B8C\u6210! \u955C\u50CF\u5730\u5740: \${REGISTRY}/\${IMAGE_TAG}"
|
|
2148
2127
|
`;
|
|
2149
|
-
await
|
|
2150
|
-
await
|
|
2151
|
-
await
|
|
2128
|
+
await fs3.writeFile(path7.join(backendPath, "Dockerfile"), dockerfile);
|
|
2129
|
+
await fs3.writeFile(path7.join(backendPath, "deploy.sh"), deploySh);
|
|
2130
|
+
await fs3.chmod(path7.join(backendPath, "deploy.sh"), 493);
|
|
2152
2131
|
}
|
|
2153
2132
|
async function initGit(projectPath, projectName) {
|
|
2154
2133
|
try {
|
|
@@ -5444,7 +5423,7 @@ import { Command as Command13 } from "commander";
|
|
|
5444
5423
|
import path18 from "path";
|
|
5445
5424
|
import { execa as execa4 } from "execa";
|
|
5446
5425
|
import inquirer9 from "inquirer";
|
|
5447
|
-
import
|
|
5426
|
+
import fs4 from "fs-extra";
|
|
5448
5427
|
async function performUpdate(projectPath, updates) {
|
|
5449
5428
|
logger.newLine();
|
|
5450
5429
|
logger.info("\u5F00\u59CB\u66F4\u65B0\u6A21\u677F...");
|
|
@@ -5483,7 +5462,7 @@ async function performUpdate(projectPath, updates) {
|
|
|
5483
5462
|
}
|
|
5484
5463
|
const ref = updateOptions?.tag || updateOptions?.branch || "HEAD";
|
|
5485
5464
|
const backupDir = path18.join(projectPath, `.backup-${Date.now()}`);
|
|
5486
|
-
await
|
|
5465
|
+
await fs4.copy(targetPath, path18.join(backupDir, targetDir));
|
|
5487
5466
|
logger.info(`\u5DF2\u521B\u5EFA\u5907\u4EFD: ${backupDir}`);
|
|
5488
5467
|
if (updateOptions?.dryRun) {
|
|
5489
5468
|
logger.info("[Dry Run] \u5C06\u4F1A\u66F4\u65B0\u5230\u4EE5\u4E0B\u7248\u672C:");
|
|
@@ -5512,15 +5491,15 @@ async function performUpdate(projectPath, updates) {
|
|
|
5512
5491
|
if (!keepFiles.includes(file)) {
|
|
5513
5492
|
const filePath = path18.join(targetPath, file);
|
|
5514
5493
|
try {
|
|
5515
|
-
await
|
|
5494
|
+
await fs4.remove(filePath);
|
|
5516
5495
|
} catch {
|
|
5517
5496
|
}
|
|
5518
5497
|
}
|
|
5519
5498
|
}
|
|
5520
|
-
await
|
|
5499
|
+
await fs4.copy(tempDir, targetPath, {
|
|
5521
5500
|
filter: (src) => !src.includes(".git")
|
|
5522
5501
|
});
|
|
5523
|
-
await
|
|
5502
|
+
await fs4.remove(tempDir);
|
|
5524
5503
|
await updateTemplateVersion(projectPath, type, commit.trim(), {
|
|
5525
5504
|
tag: updateOptions?.tag || latestTag,
|
|
5526
5505
|
branch: updateOptions?.branch
|
|
@@ -5531,9 +5510,9 @@ async function performUpdate(projectPath, updates) {
|
|
|
5531
5510
|
} catch (error) {
|
|
5532
5511
|
logger.error(`\u66F4\u65B0\u5931\u8D25: ${error.message}`);
|
|
5533
5512
|
logger.info("\u6B63\u5728\u6062\u590D\u5907\u4EFD...");
|
|
5534
|
-
await
|
|
5535
|
-
await
|
|
5536
|
-
await
|
|
5513
|
+
await fs4.remove(targetPath);
|
|
5514
|
+
await fs4.copy(path18.join(backupDir, targetDir), targetPath);
|
|
5515
|
+
await fs4.remove(backupDir);
|
|
5537
5516
|
logger.info("\u5DF2\u6062\u590D\u5230\u66F4\u65B0\u524D\u7684\u72B6\u6001");
|
|
5538
5517
|
}
|
|
5539
5518
|
}
|
|
@@ -6137,7 +6116,7 @@ var init_diff = __esm({
|
|
|
6137
6116
|
var index_exports = {};
|
|
6138
6117
|
import { Command as Command16 } from "commander";
|
|
6139
6118
|
import chalk4 from "chalk";
|
|
6140
|
-
import
|
|
6119
|
+
import fs5 from "fs-extra";
|
|
6141
6120
|
import path19 from "path";
|
|
6142
6121
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6143
6122
|
function showHelp() {
|
|
@@ -6217,7 +6196,7 @@ var init_index = __esm({
|
|
|
6217
6196
|
init_config();
|
|
6218
6197
|
init_diff();
|
|
6219
6198
|
__dirname2 = path19.dirname(fileURLToPath2(import.meta.url));
|
|
6220
|
-
pkg =
|
|
6199
|
+
pkg = fs5.readJsonSync(path19.join(__dirname2, "../package.json"));
|
|
6221
6200
|
program = new Command16();
|
|
6222
6201
|
program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version(pkg.version);
|
|
6223
6202
|
program.option("-v, --verbose", "\u8BE6\u7EC6\u8F93\u51FA\u6A21\u5F0F").option("--debug", "\u8C03\u8BD5\u6A21\u5F0F");
|