@lark-apaas/fullstack-cli 1.1.59-alpha.20260721044121 → 1.1.59-alpha.20260721164103
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 +47 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8632,8 +8632,8 @@ import { spawnSync as spawnSync8 } from "child_process";
|
|
|
8632
8632
|
import * as crypto from "crypto";
|
|
8633
8633
|
import * as fs30 from "fs";
|
|
8634
8634
|
import * as path26 from "path";
|
|
8635
|
-
var PREVIEW_ARTIFACT_SCHEMA_VERSION =
|
|
8636
|
-
var PREVIEW_ARTIFACT_PROTOCOL_VERSION =
|
|
8635
|
+
var PREVIEW_ARTIFACT_SCHEMA_VERSION = 3;
|
|
8636
|
+
var PREVIEW_ARTIFACT_PROTOCOL_VERSION = 3;
|
|
8637
8637
|
var MANIFEST_FILE = "manifest.json";
|
|
8638
8638
|
var PROBE_FILE = "probe.json";
|
|
8639
8639
|
var SERVER_FILE = "server.bundle.cjs";
|
|
@@ -8665,7 +8665,8 @@ function previewArtifactBuildEnvironment(environment, appBasePath) {
|
|
|
8665
8665
|
}
|
|
8666
8666
|
buildEnvironment.ASSETS_CDN_PATH = appBasePath;
|
|
8667
8667
|
buildEnvironment.CLIENT_BASE_PATH = appBasePath;
|
|
8668
|
-
buildEnvironment.
|
|
8668
|
+
buildEnvironment.MIAODA_BUILD_TARGET = "preview-artifact";
|
|
8669
|
+
buildEnvironment.NODE_ENV = "development";
|
|
8669
8670
|
return buildEnvironment;
|
|
8670
8671
|
}
|
|
8671
8672
|
function previewArtifactBuildEnvironmentHash(environment, appBasePath) {
|
|
@@ -9190,7 +9191,7 @@ function readPreviewArtifactEnvironmentFile(filePath) {
|
|
|
9190
9191
|
function previewArtifactRuntimeEnvironment(environment) {
|
|
9191
9192
|
return {
|
|
9192
9193
|
...environment,
|
|
9193
|
-
NODE_ENV:
|
|
9194
|
+
NODE_ENV: "development",
|
|
9194
9195
|
// Probe and switcher connect through 127.0.0.1. Linux may resolve
|
|
9195
9196
|
// `localhost` to IPv6-only ::1, so the isolated Nest process must bind to
|
|
9196
9197
|
// the same explicit private endpoint instead of inheriting app defaults.
|
|
@@ -9434,15 +9435,45 @@ function defaultGenerationId() {
|
|
|
9434
9435
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:.TZ]/g, "");
|
|
9435
9436
|
return `${timestamp}-${crypto2.randomBytes(5).toString("hex")}`;
|
|
9436
9437
|
}
|
|
9437
|
-
function
|
|
9438
|
-
const
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9438
|
+
function defaultPreviewBundleBuildCommands(projectRootInput) {
|
|
9439
|
+
const projectRoot = path30.resolve(projectRootInput);
|
|
9440
|
+
const executableSuffix = process.platform === "win32" ? ".cmd" : "";
|
|
9441
|
+
const localBinary = (name) => path30.join(
|
|
9442
|
+
projectRoot,
|
|
9443
|
+
"node_modules",
|
|
9444
|
+
".bin",
|
|
9445
|
+
`${name}${executableSuffix}`
|
|
9446
|
+
);
|
|
9447
|
+
const nodeBuildCommand = (label, binary, args) => process.platform === "win32" ? { label, command: binary, args } : { label, command: process.execPath, args: [binary, ...args] };
|
|
9448
|
+
return [
|
|
9449
|
+
nodeBuildCommand("server", localBinary("nest"), ["build"]),
|
|
9450
|
+
nodeBuildCommand("client", localBinary("vite"), [
|
|
9451
|
+
"build",
|
|
9452
|
+
"--mode",
|
|
9453
|
+
"development",
|
|
9454
|
+
"--config",
|
|
9455
|
+
"vite.config.ts"
|
|
9456
|
+
])
|
|
9457
|
+
];
|
|
9458
|
+
}
|
|
9459
|
+
function runBuildCommands(projectRoot, buildCommands, environment) {
|
|
9460
|
+
for (const buildCommand of buildCommands) {
|
|
9461
|
+
const result = spawnSync8(buildCommand.command, buildCommand.args, {
|
|
9462
|
+
cwd: projectRoot,
|
|
9463
|
+
env: { ...process.env, ...environment },
|
|
9464
|
+
encoding: "utf8",
|
|
9465
|
+
maxBuffer: 10 * 1024 * 1024
|
|
9466
|
+
});
|
|
9467
|
+
if (result.status !== 0) {
|
|
9468
|
+
const diagnostic = `${result.stdout ?? ""}
|
|
9469
|
+
${result.stderr ?? ""}`.trim().slice(-8 * 1024);
|
|
9470
|
+
return [
|
|
9471
|
+
`preview bundle ${buildCommand.label} build failed with exit ${result.status ?? "unknown"}${result.error ? `: ${result.error.message}` : ""}${diagnostic ? `
|
|
9472
|
+
${diagnostic}` : ""}`
|
|
9473
|
+
];
|
|
9474
|
+
}
|
|
9475
|
+
}
|
|
9476
|
+
return [];
|
|
9446
9477
|
}
|
|
9447
9478
|
function createClientArchive(clientDir, archivePath) {
|
|
9448
9479
|
if (!fs34.existsSync(path30.join(clientDir, "index.html"))) {
|
|
@@ -9483,9 +9514,10 @@ async function producePreviewArtifactGeneration(options) {
|
|
|
9483
9514
|
options.environment,
|
|
9484
9515
|
options.appBasePath
|
|
9485
9516
|
);
|
|
9486
|
-
const
|
|
9517
|
+
const buildCommands = options.buildCommands ?? (options.buildCommand ? [{ label: "custom", ...options.buildCommand }] : defaultPreviewBundleBuildCommands(projectRoot));
|
|
9518
|
+
const buildReasons = runBuildCommands(
|
|
9487
9519
|
projectRoot,
|
|
9488
|
-
|
|
9520
|
+
buildCommands,
|
|
9489
9521
|
buildEnvironment
|
|
9490
9522
|
);
|
|
9491
9523
|
if (buildReasons.length > 0) return failed(buildReasons);
|