ai-project-manage-cli 6.0.87 → 6.0.88
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 +34 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2281,7 +2281,8 @@ function validateDeployPush(o) {
|
|
|
2281
2281
|
type: "deploy",
|
|
2282
2282
|
deploymentRunId: o.deploymentRunId.trim(),
|
|
2283
2283
|
workdir: o.workdir.trim(),
|
|
2284
|
-
environment
|
|
2284
|
+
environment,
|
|
2285
|
+
...o.packOnly === true ? { packOnly: true } : {}
|
|
2285
2286
|
}
|
|
2286
2287
|
};
|
|
2287
2288
|
}
|
|
@@ -2561,8 +2562,8 @@ async function uploadDeployArtifactZip(options) {
|
|
|
2561
2562
|
|
|
2562
2563
|
// src/commands/connect/deploy-run.ts
|
|
2563
2564
|
var DEPLOY_LOG_SYNC_INTERVAL_MS = 3e4;
|
|
2564
|
-
function resolveDeployCommand(environment) {
|
|
2565
|
-
return `apm deploy ${environment}`;
|
|
2565
|
+
function resolveDeployCommand(environment, packOnly) {
|
|
2566
|
+
return packOnly ? `apm deploy ${environment} --pack-only` : `apm deploy ${environment}`;
|
|
2566
2567
|
}
|
|
2567
2568
|
function buildDeployLog(stdout, stderr) {
|
|
2568
2569
|
return [stdout, stderr].filter(Boolean).join("\n");
|
|
@@ -2658,7 +2659,7 @@ async function handleInboundDeploy(cfg, msg, signal) {
|
|
|
2658
2659
|
status: "DEPLOYING"
|
|
2659
2660
|
});
|
|
2660
2661
|
const workdir = requireRemoteWorkdir(msg.workdir);
|
|
2661
|
-
const command = resolveDeployCommand(msg.environment);
|
|
2662
|
+
const command = resolveDeployCommand(msg.environment, msg.packOnly);
|
|
2662
2663
|
console.log(
|
|
2663
2664
|
`[apm] deploy start id=${deploymentRunId} env=${msg.environment} cwd=${workdir}`
|
|
2664
2665
|
);
|
|
@@ -4675,6 +4676,12 @@ function formatDeployNotConfiguredLines(env, deployCommands) {
|
|
|
4675
4676
|
"[apm] \u90E8\u5206\u9879\u76EE\u4E0D\u652F\u6301\u6216\u672A\u542F\u7528\u81EA\u52A8\u5316\u90E8\u7F72\uFF0C\u5C5E\u6B63\u5E38\u60C5\u51B5\uFF0C\u53EF\u8DF3\u8FC7\u90E8\u7F72"
|
|
4676
4677
|
];
|
|
4677
4678
|
}
|
|
4679
|
+
function formatWisdomFrontendBuildNotConfiguredLines(env, packageJsonPath) {
|
|
4680
|
+
return [
|
|
4681
|
+
`[apm] \u65E0\u6CD5\u6267\u884C\u4EC5\u6253\u5305\uFF1A${packageJsonPath} \u4E2D\u672A\u627E\u5230 build:${env} \u811A\u672C`,
|
|
4682
|
+
"[apm] \u8BF7\u914D\u7F6E npm run build:test / build:online \u540E\u518D\u8BD5"
|
|
4683
|
+
];
|
|
4684
|
+
}
|
|
4678
4685
|
function formatWisdomFrontendDeployNotConfiguredLines(env, packageJsonPath) {
|
|
4679
4686
|
return [
|
|
4680
4687
|
`[apm] \u65E0\u6CD5\u6267\u884C\u90E8\u7F72\uFF1A${packageJsonPath} \u4E2D\u672A\u627E\u5230 deploy:${env} \u811A\u672C`,
|
|
@@ -4857,7 +4864,7 @@ async function runWisdomSftpDeploy(params) {
|
|
|
4857
4864
|
zipPath: resolvedZipPath,
|
|
4858
4865
|
projectName: params.projectName,
|
|
4859
4866
|
kind: "frontend",
|
|
4860
|
-
uploadWithoutRunId: packOnly
|
|
4867
|
+
uploadWithoutRunId: packOnly && !resolveDeploymentRunIdFromEnv()
|
|
4861
4868
|
});
|
|
4862
4869
|
artifactUploaded = artifact !== null;
|
|
4863
4870
|
if (packOnly && artifactUploaded) {
|
|
@@ -5424,6 +5431,7 @@ async function runWisdomBackendDeploy(options) {
|
|
|
5424
5431
|
sourceDetail: config.mavenLocalRepoSourceDetail
|
|
5425
5432
|
});
|
|
5426
5433
|
if (packOnly) {
|
|
5434
|
+
const uploadWithoutRunId = !resolveDeploymentRunIdFromEnv();
|
|
5427
5435
|
if (config.mode === "full") {
|
|
5428
5436
|
const mainJar = locateMainJar(projectRoot);
|
|
5429
5437
|
const archiveZipPath = await createUpdatePackage(
|
|
@@ -5440,7 +5448,7 @@ async function runWisdomBackendDeploy(options) {
|
|
|
5440
5448
|
zipPath: archiveZipPath,
|
|
5441
5449
|
projectName: config.projectName,
|
|
5442
5450
|
kind: "backend",
|
|
5443
|
-
uploadWithoutRunId
|
|
5451
|
+
uploadWithoutRunId
|
|
5444
5452
|
});
|
|
5445
5453
|
} else {
|
|
5446
5454
|
const libDir = locateLibDir(projectRoot);
|
|
@@ -5453,7 +5461,7 @@ async function runWisdomBackendDeploy(options) {
|
|
|
5453
5461
|
zipPath,
|
|
5454
5462
|
projectName: config.projectName,
|
|
5455
5463
|
kind: "backend",
|
|
5456
|
-
uploadWithoutRunId
|
|
5464
|
+
uploadWithoutRunId
|
|
5457
5465
|
});
|
|
5458
5466
|
}
|
|
5459
5467
|
log("\u4EC5\u6253\u5305\u5B8C\u6210\uFF08\u672A\u4E0A\u4F20\u8FDC\u7A0B\u670D\u52A1\u5668\uFF09");
|
|
@@ -5580,6 +5588,14 @@ function resolveFrontendDeployCommand(env, cwd) {
|
|
|
5580
5588
|
}
|
|
5581
5589
|
return null;
|
|
5582
5590
|
}
|
|
5591
|
+
function resolveFrontendBuildCommand(env, cwd) {
|
|
5592
|
+
const scripts = readPackageScripts(cwd);
|
|
5593
|
+
const buildKey = `build:${env}`;
|
|
5594
|
+
if (scripts[buildKey]?.trim()) {
|
|
5595
|
+
return `npm run build:${env}`;
|
|
5596
|
+
}
|
|
5597
|
+
return null;
|
|
5598
|
+
}
|
|
5583
5599
|
function runShellCommand2(command, cwd, captureOutput) {
|
|
5584
5600
|
const result = spawnSync4(command, {
|
|
5585
5601
|
cwd,
|
|
@@ -5629,6 +5645,16 @@ async function runWisdomAutoDeploy(options) {
|
|
|
5629
5645
|
);
|
|
5630
5646
|
if (projectType === "frontend") {
|
|
5631
5647
|
if (packOnly) {
|
|
5648
|
+
const buildCmd = resolveFrontendBuildCommand(options.env, cwd);
|
|
5649
|
+
if (!buildCmd) {
|
|
5650
|
+
const lines = formatWisdomFrontendBuildNotConfiguredLines(
|
|
5651
|
+
options.env,
|
|
5652
|
+
path4.join(cwd, "package.json")
|
|
5653
|
+
);
|
|
5654
|
+
throw new DeployExecutionError(lines.join("\n"), 1, lines.join("\n"));
|
|
5655
|
+
}
|
|
5656
|
+
console.error(`[apm] \u524D\u7AEF\u4EC5\u6253\u5305\u6A21\u5F0F\uFF1A\u6267\u884C ${buildCmd}`);
|
|
5657
|
+
runShellCommand2(buildCmd, cwd, captureOutput);
|
|
5632
5658
|
const projectName = (cfg.name ?? "").trim();
|
|
5633
5659
|
if (!projectName) {
|
|
5634
5660
|
throw new DeployExecutionError(
|
|
@@ -6033,7 +6059,7 @@ function registerDeployMainCommand(program) {
|
|
|
6033
6059
|
"\u6C9F\u901A\u7FA4 ID\uFF1B\u4F20\u5165\u65F6\u5728\u5E73\u53F0\u521B\u5EFA\u90E8\u7F72\u8BB0\u5F55\u5E76\u540C\u6B65\u65E5\u5FD7"
|
|
6034
6060
|
).option(
|
|
6035
6061
|
"--pack-only",
|
|
6036
|
-
"\u4EC5\u6253\u5305\u5E76\u4E0A\u4F20 MinIO \u5F52\u6863\uFF0C\u4E0D\u4E0A\u4F20\u8FDC\u7A0B\u670D\u52A1\u5668\uFF08\
|
|
6062
|
+
"\u4EC5\u6784\u5EFA/\u6253\u5305\u5E76\u4E0A\u4F20 MinIO \u5F52\u6863\uFF0C\u4E0D\u4E0A\u4F20\u8FDC\u7A0B\u670D\u52A1\u5668\uFF08\u524D\u7AEF build:<env>\uFF0C\u540E\u7AEF Maven \u6784\u5EFA\uFF09"
|
|
6037
6063
|
).action(
|
|
6038
6064
|
async (env, opts) => {
|
|
6039
6065
|
const cwd = process.cwd();
|